-
Notifications
You must be signed in to change notification settings - Fork 8
Split the plugin in 2 parts: regular and aggregation #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1fa7ecd
wip
martinbonnin 281fa66
Split the plugin in 2
martinbonnin 87d59e6
update CHANGELOG
martinbonnin 7ac3e89
remove leftovers
martinbonnin ac9d7db
Remove the plugin boilerplate
martinbonnin 05d0ea0
tweak error message, thanks @vlsi!
martinbonnin 7c30fe3
put smaller code first
martinbonnin 79fe2c9
tweak message
martinbonnin 1d43f45
fix wording
martinbonnin 6f0706b
Remove verifyStatus
martinbonnin 4e7a93d
remove useless code
martinbonnin 3b41d9e
Use aggregation consistently
martinbonnin 8234974
remove unused class
martinbonnin f063a3f
Update src/main/kotlin/nmcp/internal/task/publish.kt
martinbonnin baf5bb2
Update src/main/kotlin/nmcp/internal/task/publish.kt
martinbonnin adb9d56
Update src/main/kotlin/nmcp/internal/task/publish.kt
martinbonnin 9a15ce7
Merge branch 'main' into rearchitecture
martinbonnin 6dde059
unbreak tests
martinbonnin 95fe190
NmcpSpec -> CentralPortalOptions
martinbonnin 424ef0b
Update src/main/kotlin/nmcp/NmcpExtension.kt
martinbonnin de6e2e5
configuration cache
martinbonnin 7f3279b
missing parenthesis
martinbonnin 2504216
unbreak tests
martinbonnin 7cdaf30
format
martinbonnin 066ead4
Merge branch 'main' into rearchitecture
martinbonnin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## Split the plugin in 2 separate plugins: | ||
|
|
||
| - `com.gradleup.nmcp` creates a `zip${publicationName.capitalized()}Publication` and `publish${publicationName.capitalized()}PublicationToCentralPortal` task for each publication | ||
| - `publish${publicationName.capitalized()}PublicationToCentralPortal` can be used to publish an individual publication to the central portal. If using this, you need to configure the `centralPortal {}` block. | ||
| - The output of `zip${publicationName.capitalized()}Publication` is registered as an outgoing artifact so that the aggregation plugin can collect the files from all projects. | ||
| - `com.gradleup.nmcp.aggregation` can aggregate all zips from several projects and upload them in a single deployment to the central portal. | ||
|
|
||
| ## Other changes: | ||
|
|
||
| - The default `publicationType` is now `"AUTOMATIC"`, make sure to set it to `"USER_MANAGED"` if you want to manually confirm releases. | ||
| - `NmcpSpec.endpoint` is replaced by `NmcpSpec.baseUrl`. | ||
| - `NmcpSpec.publicationType` is renamed `NmcpSpec.publishingType`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| [versions] | ||
| kgp = "2.1.20" | ||
| ksp = "2.1.20-2.0.0" | ||
|
|
||
| [libraries] | ||
| json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1" | ||
| okio = "com.squareup.okio:okio:3.8.0" | ||
| okhttp = "com.squareup.okhttp3:okhttp:4.12.0" | ||
| okhttp-logging-interceptor = "com.squareup.okhttp3:logging-interceptor:4.12.0" | ||
| mockwebserver = "com.squareup.okhttp3:mockwebserver:4.12.0" | ||
| gradle-min = "dev.gradleplugins:gradle-api:8.0" | ||
|
|
||
| [plugins] | ||
| kgp = { id = "org.jetbrains.kotlin.jvm", version.ref = "kgp" } | ||
| kgp = { id = "org.jetbrains.kotlin.jvm", version.ref = "kgp" } | ||
| ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } | ||
| ggp = { id = "com.gradleup.gratatouille", version = "0.0.6-SNAPSHOT-b6a9df610d12e3bbd5066d4bb8f6d640efcc0ca5" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| package nmcp | ||
|
|
||
| import gratatouille.GExtension | ||
| import nmcp.internal.configureAttributes | ||
| import nmcp.internal.nmcpConsumerConfigurationName | ||
| import nmcp.internal.task.registerPublishTask | ||
| import org.gradle.api.Action | ||
| import org.gradle.api.Project | ||
| import org.gradle.api.tasks.bundling.Zip | ||
|
|
||
| @GExtension(pluginId = "com.gradleup.nmcp.aggregation") | ||
| open class NmcpAggregationExtension(private val project: Project) { | ||
| internal val spec = project.objects.newInstance(NmcpSpec::class.java) | ||
|
|
||
| internal val consumerConfiguration = project.configurations.create(nmcpConsumerConfigurationName) { | ||
| it.isCanBeResolved = true | ||
| it.isCanBeConsumed = false | ||
|
|
||
| it.configureAttributes(project) | ||
| } | ||
martinbonnin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| val zipTaskProvider = project.tasks.register("zipAggregationPublication", Zip::class.java) { | ||
| it.archiveFileName.set("publicationAggregated.zip") | ||
martinbonnin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| it.destinationDirectory.set(project.layout.buildDirectory.dir("nmcp/zip")) | ||
| it.from(consumerConfiguration.elements.map { | ||
| check (it.isNotEmpty()) { | ||
| "nmcp: aggregation is empty. Make sure to create publications in sub-projects and specify projects to publish by adding them to the 'nmcpAggregation' configuration." | ||
| } | ||
| it.map { | ||
| project.zipTree(it) | ||
martinbonnin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| }) | ||
| } | ||
|
|
||
| init { | ||
| project.registerPublishTask( | ||
| taskName = "publishAggregatedPublicationToCentralPortal", | ||
| inputFile = zipTaskProvider.flatMap { it.archiveFile }, | ||
| spec = spec | ||
| ) | ||
| } | ||
martinbonnin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Configures the central portal parameters | ||
| */ | ||
| fun centralPortal(action: Action<NmcpSpec>) { | ||
martinbonnin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| action.execute(spec) | ||
| } | ||
|
|
||
| /** | ||
| * Applies the `com.gradleup.nmcp` plugin to every project that also applies `maven-publish` and adds the | ||
| * `publishAggregatedPublicationToCentralPortal` task to publish a bundle containing all projects. | ||
| * | ||
| * This is breaking project isolation | ||
| */ | ||
| fun publishAllProjectsProbablyBreakingProjectIsolation() { | ||
| check(project === project.rootProject) { | ||
| "publishAllProjectsProbablyBreakingProjectIsolation() must be called from root project" | ||
| } | ||
martinbonnin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| project.allprojects { aproject -> | ||
| aproject.pluginManager.withPlugin("maven-publish") { | ||
| aproject.pluginManager.apply("com.gradleup.nmcp") | ||
|
|
||
| consumerConfiguration.dependencies.add(aproject.dependencies.create(aproject)) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.