-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
61 lines (53 loc) · 1.71 KB
/
build.gradle.kts
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
val projectPathMap: Map<String, String> = mapOf(
"graphics" to "graphics",
"parcelize" to "parcelize",
"resources" to "resources",
"resources-gradle-plugin" to "resources-generator",
"mvvm" to "mvvm",
"template" to "mpp-library",
"template" to "android-app"
)
fun createProxyTask(taskName: String) {
tasks.create(taskName) {
group = "build"
projectPathMap.forEach { (build, project) ->
val includedBuild = gradle.includedBuild(build)
dependsOn(includedBuild.task(":$project:$taskName"))
}
}
}
createProxyTask("build")
createProxyTask("clean")
data class TaskDesc(
val includedBuild: String,
val projectPath: String = includedBuild,
val tasks: List<String> = listOf(
"assemble",
"assembleDebug",
"assembleRelease",
"compileKotlinIosArm64",
"compileKotlinIosX64",
"build",
"clean",
"dependencies"
)
)
listOf(
TaskDesc(includedBuild = "graphics"),
TaskDesc(includedBuild = "parcelize"),
TaskDesc(includedBuild = "resources"),
TaskDesc(includedBuild = "mvvm"),
TaskDesc(includedBuild = "errors"),
TaskDesc(includedBuild = "network"),
TaskDesc(includedBuild = "template", projectPath = "mpp-library")
).forEach { taskDesc ->
taskDesc.tasks.forEach { taskName ->
val includedBuildName = taskDesc.includedBuild.capitalize()
val projectName = taskDesc.projectPath.capitalize()
tasks.create("$taskName$includedBuildName$projectName") {
group = taskDesc.includedBuild
val task = gradle.includedBuild(taskDesc.includedBuild).task(":${taskDesc.projectPath}:$taskName")
dependsOn(task)
}
}
}