build: Configure task rules for multiproject builds

This commit is contained in:
Siphalor committed 2026-11-15 21:57:52 +01:00
1 parent fddca3ffd4
commit 4976602a68
5 files changed
+46 -12

No files matched your search

@@ -0,0 +1,16 @@
listOf("compileJava", "assemble", "test", "build", "publish").forEach {
tasks.register(it) {
description = "Composite task for $this"
dependsOn(getTasksByName(it, true).filter { t -> t != this })
}
}
tasks.addRule("All subproject tasks are available as composite tasks running across all subprojects") {
val subProjectTasks = getTasksByName(this, true)
if (subProjectTasks.isNotEmpty()) {
tasks.register(this) {
description = "composite task for $this"
dependsOn(subProjectTasks)
}
}
}
+27
View File
@@ -0,0 +1,27 @@
tasks.register("compileJava") {
group = BasePlugin.BUILD_GROUP
description = "Compile Java"
dependsOn(gradle.includedBuilds.map { it.task(":compileJava") })
}
tasks.register("test") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Test all"
dependsOn(gradle.includedBuilds.map { it.task(":test") })
}
tasks.register("build") {
group = BasePlugin.BUILD_GROUP
description = "Build and test"
dependsOn(gradle.includedBuilds.map { it.task(":build") })
}
tasks.register("publish") {
group = PublishingPlugin.PUBLISH_TASK_GROUP
description = "Publish all"
dependsOn(gradle.includedBuilds.map { it.task(":publish") })
}
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/env sh
cd tweed5 || exit
../gradlew publish
cd .. || exit
cd tweed5-minecraft || exit
./helpers/run-each-mc.sh ../gradlew publish
cd .. || exit
+1 -1
View File
@@ -1,6 +1,6 @@
plugins {
`maven-publish`
id("de.siphalor.tweed5.root-properties")
id("de.siphalor.tweed5.transitive-tasks")
}
group = "de.siphalor.tweed5.minecraft"
+2 -3
View File
@@ -1,8 +1,8 @@
plugins {
`test-report-aggregation`
`jacoco-report-aggregation`
`maven-publish`
id("de.siphalor.tweed5.root-properties")
id("de.siphalor.tweed5.transitive-tasks")
}
group = "de.siphalor.tweed5"
@@ -41,9 +41,8 @@ reporting {
}
}
tasks.register("test") {
tasks.named("test") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Runs all tests"
subprojects.mapNotNull { it.tasks.findByName("test") }.forEach { dependsOn(it) }
finalizedBy(tasks.named("aggregatedTestReport"), tasks.named("aggregatedCoverageReport"))
}