From 6dcc9844bd7c3833d48e9747d70ffa425c91cdd1 Mon Sep 17 00:00:00 2001 From: "Daniel A. A. Pelsmaeker" Date: Mon, 22 Jul 2024 15:49:47 +0200 Subject: [PATCH] Fix publishing --- .github/workflows/build.yaml | 4 ++-- build.gradle.kts | 4 ++++ .../RootProjectConventionExtension.kt | 14 +++++------ .../convention/RootProjectConventionPlugin.kt | 24 +++++++++---------- depman/build.gradle.kts | 4 ++++ docs/content/conventions/rootproject.md | 8 +++---- example/build.gradle.kts | 4 ++++ 7 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ea9402e..497d2e5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: uses: metaborg/actions/.github/workflows/gradle-publish.yaml@main with: gradle-command: | - gradle :convention-plugin:publish -Pgitonium.isSnapshot=true + gradle :publish -Pgitonium.isSnapshot=true gradle-version-command: | gradle -q :convention-plugin:printVersion -Pgitonium.isSnapshot=true if: "github.event_name == 'push' && github.ref == 'refs/heads/main'" @@ -26,7 +26,7 @@ jobs: uses: metaborg/actions/.github/workflows/gradle-publish.yaml@main with: gradle-command: | - gradle :convention-plugin:publish + gradle :publish gradle-version-command: | gradle -q :convention-plugin:printVersion if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-')" diff --git a/build.gradle.kts b/build.gradle.kts index acc197e..3675a01 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,7 @@ plugins { id("org.metaborg.convention.root-project") } + +rootProjectConvention { + registerPublishTasks.set(true) +} \ No newline at end of file diff --git a/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionExtension.kt b/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionExtension.kt index 9934af3..d33addd 100644 --- a/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionExtension.kt +++ b/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionExtension.kt @@ -11,16 +11,16 @@ open class RootProjectConventionExtension @Inject constructor( ) { /** Whether to add the aggregate `assembleAll`, `buildAll`, `checkAll`, and `cleanAll` lifecycle tasks. */ - val addAggregateLifecycleTasks: Property = objects.property(Boolean::class.java) + val registerLifecycleTasks: Property = objects.property(Boolean::class.java) .convention(true) /** Whether to add the aggregate `publishAll`, `publishAllToMavenLocal` lifecycle tasks. */ - val addAggregatePublishTasks: Property = objects.property(Boolean::class.java) + val registerPublishTasks: Property = objects.property(Boolean::class.java) .convention(false) - /** Whether to add stub `assemble`, `build`, `check`, and `clean` lifecycle tasks that depend on their `*All` counterparts, if not already defined. */ - val addStubLifecycleTasks: Property = objects.property(Boolean::class.java) - .convention(true) + /** Whether to register stub `assemble`, `build`, `check`, and `clean` lifecycle tasks that depend on their `*All` counterparts, if not already defined. */ + val registerStubLifecycleTasks: Property = objects.property(Boolean::class.java) + .convention(registerLifecycleTasks) /** Whether to add stub `publish` and `publishToMavenLocal` tasks that depend on their `*All` counterparts, if not already defined. */ - val addStubPublishTasks: Property = objects.property(Boolean::class.java) - .convention(false) + val registerStubPublishTasks: Property = objects.property(Boolean::class.java) + .convention(registerPublishTasks) } \ No newline at end of file diff --git a/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionPlugin.kt b/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionPlugin.kt index f94e84c..63099a6 100644 --- a/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionPlugin.kt +++ b/convention-plugin/src/main/kotlin/org/metaborg/convention/RootProjectConventionPlugin.kt @@ -33,32 +33,32 @@ class RootProjectConventionPlugin: Plugin { LifecycleBasePlugin.ASSEMBLE_TASK_NAME, LifecycleBasePlugin.BUILD_GROUP, "Assembles the outputs of this project, subprojects, and included builds.", - extension.addAggregateLifecycleTasks.get(), - extension.addStubLifecycleTasks.get(), + extension.registerLifecycleTasks.get(), + extension.registerStubLifecycleTasks.get(), ) registerRootTasks( "${LifecycleBasePlugin.BUILD_TASK_NAME}All", LifecycleBasePlugin.BUILD_TASK_NAME, LifecycleBasePlugin.BUILD_GROUP, "Assembles and tests this project, subprojects, and included builds.", - extension.addAggregateLifecycleTasks.get(), - extension.addStubLifecycleTasks.get(), + extension.registerLifecycleTasks.get(), + extension.registerStubLifecycleTasks.get(), ) registerRootTasks( "${LifecycleBasePlugin.CLEAN_TASK_NAME}All", LifecycleBasePlugin.CLEAN_TASK_NAME, LifecycleBasePlugin.BUILD_GROUP, "Cleans the outputs of this project, subprojects, and included builds.", - extension.addAggregateLifecycleTasks.get(), - extension.addStubLifecycleTasks.get(), + extension.registerLifecycleTasks.get(), + extension.registerStubLifecycleTasks.get(), ) registerRootTasks( "${LifecycleBasePlugin.CHECK_TASK_NAME}All", LifecycleBasePlugin.CHECK_TASK_NAME, LifecycleBasePlugin.VERIFICATION_GROUP, "Runs all checks on this project, subprojects, and included builds.", - extension.addAggregateLifecycleTasks.get(), - extension.addStubLifecycleTasks.get(), + extension.registerLifecycleTasks.get(), + extension.registerStubLifecycleTasks.get(), ) // Publish tasks @@ -67,16 +67,16 @@ class RootProjectConventionPlugin: Plugin { PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME, PublishingPlugin.PUBLISH_TASK_GROUP, "Publishes all publications produced by this project, subprojects, and included builds to remote Maven repositories.", - extension.addAggregatePublishTasks.get(), - extension.addStubPublishTasks.get(), + extension.registerPublishTasks.get(), + extension.registerStubPublishTasks.get(), ) registerRootTasks( "${PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME}AllToMavenLocal", "${PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME}ToMavenLocal", PublishingPlugin.PUBLISH_TASK_GROUP, "Publishes all Maven publications produced by this project, subprojects, and included builds to the local Maven cache.", - extension.addAggregatePublishTasks.get(), - extension.addStubPublishTasks.get(), + extension.registerPublishTasks.get(), + extension.registerStubPublishTasks.get(), ) } } diff --git a/depman/build.gradle.kts b/depman/build.gradle.kts index 3a2ded3..3dc3ff1 100644 --- a/depman/build.gradle.kts +++ b/depman/build.gradle.kts @@ -6,6 +6,10 @@ plugins { id("org.metaborg.gitonium") version "1.7.1" } +rootProjectConvention { + registerPublishTasks.set(true) +} + allprojects { apply(plugin = "org.metaborg.gitonium") diff --git a/docs/content/conventions/rootproject.md b/docs/content/conventions/rootproject.md index caf7bfb..6599a9a 100644 --- a/docs/content/conventions/rootproject.md +++ b/docs/content/conventions/rootproject.md @@ -15,10 +15,10 @@ The plugin can be configured using the `rootProjectConvention` extension: ```kotlin title="build.gradle.kts" rootProjectConvention { - addAggregateLifecycleTasks.set(true) - addAggregatePublishTasks.set(false) + registerLifecycleTasks.set(true) + registerPublishTasks.set(false) - addStubLifecycleTasks.set(true) - addStubPublishTasks.set(false) + registerStubLifecycleTasks.set(true) + registerStubPublishTasks.set(false) } ``` diff --git a/example/build.gradle.kts b/example/build.gradle.kts index 0136a45..8a56bec 100644 --- a/example/build.gradle.kts +++ b/example/build.gradle.kts @@ -14,3 +14,7 @@ allprojects { } } + +rootProjectConvention { + registerStubPublishTasks.set(true) +} \ No newline at end of file