from `mustRunAfter` not working in Composite Build · Issue #32758 · gradle/gradle · GitHub
Current Behavior
I’m having a composite build with a mustRunAfter
declared task using:
tasks.register("checkDist") {
dependsOn(gradle.includedBuild("build-tests").task(":test"))
mustRunAfter("assemble")
}
tasks.check {
dependsOn("checkDist")
}
but when running ./gradlew clean assemble check
tests from the included build are executed before the assemble task is finished.
When I try with ---dry-run
all looks ok:
composite-build on main via 🅶 v8.10 via ☕ v21.0.5 via 🅺
❯ ./gradlew assemble check --dry-run
:dist SKIPPED
:distTar SKIPPED
:distZip SKIPPED
:assemble SKIPPED
:checkDist SKIPPED
:check SKIPPED
> Task :build-tests:test
DistTest > testDistFile() PASSED
BUILD SUCCESSFUL in 898ms
9 actionable tasks: 1 executed, 8 up-to-date
but when executing the checkDist
task is run before the assemble
task.
composite-build on main via 🅶 v8.10 via ☕ v21.0.5 via 🅺
❯ ./gradlew assemble check
> Task :build-tests:test
DistTest > testDistFile() PASSED
> Task :dist
Writing dist file: /Users/workspace/composite-build/build/data/dist.txt
Writing dist file finished
BUILD SUCCESSFUL in 5s
10 actionable tasks: 2 executed, 8 up-to-date
Expected Behavior
Expected behavior is that the checkDist
task is executed after the assemble
task is finished.
Self-contained Reproducer Project
Gradle version
8.10