-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
33 lines (27 loc) · 985 Bytes
/
build.gradle.kts
File metadata and controls
33 lines (27 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
addDependencyOnChildTasksOfIncludedBuilds("assemble", "build", "clean", "check")
defaultTasks("run")
tasks.register("run") {
dependsOn(gradle.includedBuild("example").task(":app:run"))
}
tasks.register("test") {
dependsOn(gradle.includedBuild("pui").task(":pui:test"))
dependsOn(gradle.includedBuild("fraiselait").task(":fraiselait:test"))
}
fun filteredIncludedBuilds(filter: (IncludedBuild) -> Boolean = { true }) =
gradle.includedBuilds
.filter { it.name != "build-logic" && it.name != "platforms" }
.filter(filter)
fun addDependencyOnChildTasksOfIncludedBuilds(vararg taskNames: String) {
taskNames.forEach { taskName ->
tasks.register(taskName) {
dependsOn(
filteredIncludedBuilds().flatMap {
it.projectDir.walkTopDown().filter { it.name == "build.gradle.kts" }.map { file ->
val path = file.parentFile.relativeTo(it.projectDir).path
it.task(":$path:$taskName")
}
}
)
}
}
}