Skip to content

Commit

Permalink
Fix publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Virtlink committed Jul 22, 2024
1 parent 6207a61 commit 6dcc984
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
Expand All @@ -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-')"
Expand Down
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id("org.metaborg.convention.root-project")
}

rootProjectConvention {
registerPublishTasks.set(true)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ open class RootProjectConventionExtension @Inject constructor(
) {

/** Whether to add the aggregate `assembleAll`, `buildAll`, `checkAll`, and `cleanAll` lifecycle tasks. */
val addAggregateLifecycleTasks: Property<Boolean> = objects.property(Boolean::class.java)
val registerLifecycleTasks: Property<Boolean> = objects.property(Boolean::class.java)
.convention(true)
/** Whether to add the aggregate `publishAll`, `publishAllToMavenLocal` lifecycle tasks. */
val addAggregatePublishTasks: Property<Boolean> = objects.property(Boolean::class.java)
val registerPublishTasks: Property<Boolean> = 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<Boolean> = 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<Boolean> = 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<Boolean> = objects.property(Boolean::class.java)
.convention(false)
val registerStubPublishTasks: Property<Boolean> = objects.property(Boolean::class.java)
.convention(registerPublishTasks)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,32 +33,32 @@ class RootProjectConventionPlugin: Plugin<Project> {
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
Expand All @@ -67,16 +67,16 @@ class RootProjectConventionPlugin: Plugin<Project> {
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(),
)
}
}
Expand Down
4 changes: 4 additions & 0 deletions depman/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ plugins {
id("org.metaborg.gitonium") version "1.7.1"
}

rootProjectConvention {
registerPublishTasks.set(true)
}

allprojects {
apply(plugin = "org.metaborg.gitonium")

Expand Down
8 changes: 4 additions & 4 deletions docs/content/conventions/rootproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
```
4 changes: 4 additions & 0 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ allprojects {
}
}


rootProjectConvention {
registerStubPublishTasks.set(true)
}

0 comments on commit 6dcc984

Please sign in to comment.