hi! We have a code base with lotsa composite buil...
# community-support
g
hi! We have a code base with lotsa composite builds. i am wondering if there is a way to easily set up a recursive variant for a list of tasks. just like for every task there is automatically a corresponding
clean
task, is there a way to do something similar but let's say with the
recursive
- prefix? so each task would automatically have a recursive counterpart which runs the same task in the builds we include? like
recursiveClean
would clean the current build - but also call
recursiveClean
on all included builds.
recursiveTest
to run all the unit tests in all relevant builds, etc. so far i have just been doing it manually for each task type, i hope there is a better solution:
Copy code
tasks.register('recursiveTest') {
    dependsOn test

    project.gradle.includedBuilds.forEach { includedBuild ->
        var recursiveBuildTask = includedBuild.task(':test')
        dependsOn recursiveBuildTask
    }
}
v
Maybe with a task rule. But no idea whether it will work.
g
thanks, ill give it a try!
👌 1
yeah, this works pretty well, thank you!
👌 1