This message was deleted.
# community-support
s
This message was deleted.
c
Something like this might work:
Copy code
gradle.includedBuilds.forEach { includedBuild ->
  project.tasks.named("clean") {
    dependsOn(includedBuild.task(":clean"))
  }
}
Bear in mind that this can only target a specific task (note the leading colon).
Not sure what that would do to a
build-logic
included build either!
d
hrm, lemme see. I was going down that road, but didn't see what I needed, but I think I was thinking backwards.
I was trying to make the root projects' clean task depend on the included build's clean task
Ahh, that helped! Thanks!
👍 1
Solution: Root project build.gradle.kts:
Copy code
val includedBuildCleanTasks = gradle.includedBuilds.map {includedBuild ->
    includedBuild.task(":clean")
}

tasks.register("clean") {
    dependsOn(includedBuildCleanTasks)
}
Included builds' root project build.gradle.kts:
Copy code
tasks.register("clean") {
    val subprojectCleanTasks = project.subprojects.map { sp ->
        sp.tasks.findByName("clean")
    }
    dependsOn(subprojectCleanTasks)
    description = "Deletes build directories of all plugins"
}
Didn't think you could make a task depend on either a
TaskReference
or
TaskContainer