-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbuild.gradle.kts
37 lines (31 loc) · 1.21 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
import java.nio.file.Files.copy
import java.nio.file.Files.move
import java.nio.file.StandardCopyOption
plugins {
base
}
tasks.register("jar") {
dependsOn(subprojects.map { it.tasks.named("jar") })
doLast {
rootProject.layout.buildDirectory.get().asFile.mkdirs()
subprojects.forEach { subproject ->
val rootFile = rootProject.layout.buildDirectory.file("${subproject.name}.jar").get().asFile.toPath()
copy(subproject.layout.buildDirectory.file("libs/${subproject.name}.jar").get().asFile.toPath(), rootFile, StandardCopyOption.REPLACE_EXISTING)
println("project build: ${subproject.name}")
}
}
}
tasks.register("shadowJar") {
dependsOn(subprojects.map { it.tasks.named("shadowJar") })
doLast {
subprojects.forEach { subproject ->
val rootFile = rootProject.layout.buildDirectory.file("${subproject.name}.jar").get().asFile.toPath()
delete(rootFile)
move(subproject.layout.buildDirectory.file("libs/${subproject.name}-all.jar").get().asFile.toPath(), rootFile)
println("project build: ${subproject.name}")
}
}
}
tasks.clean {
dependsOn(subprojects.map { it.tasks.named("clean") })
}