forked from HollowHorizon/HollowEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
96 lines (81 loc) · 2.87 KB
/
build.gradle.kts
File metadata and controls
96 lines (81 loc) · 2.87 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import org.gradle.api.tasks.Sync
import org.gradle.api.tasks.Copy
plugins {
base
}
val bootstrapModulePath = if (name.contains('-')) ":bootstrap:$name" else null
val bootstrapBuildProjects = file("bootstrap/versions")
.listFiles()
?.filter { it.isDirectory }
?.map { ":bootstrap:${it.name}" }
.orEmpty()
val compilerBuildProjects = file("compiler/versions")
.listFiles()
?.filter { it.isDirectory }
?.map { ":compiler:${it.name}" }
.orEmpty()
if (bootstrapModulePath != null) {
evaluationDependsOn(bootstrapModulePath)
val compilerModulePath = if (file("compiler/versions/$name").exists()) ":compiler:$name" else null
if (compilerModulePath != null) {
evaluationDependsOn(compilerModulePath)
}
tasks.named("assemble") {
dependsOn("$bootstrapModulePath:assemble")
if (compilerModulePath != null) dependsOn("$compilerModulePath:assemble")
}
tasks.named("build") {
dependsOn("$bootstrapModulePath:build")
if (compilerModulePath != null) dependsOn("$compilerModulePath:build")
}
tasks.register<Copy>("buildAndCollect") {
group = "build"
val mergedDir = rootProject.layout.projectDirectory.dir("merged")
into(mergedDir)
val bootstrapRemapJar = project(bootstrapModulePath).tasks.named("remapJar")
dependsOn(bootstrapRemapJar)
from(bootstrapRemapJar)
if (compilerModulePath != null) {
val compilerShadowJar = project(compilerModulePath).tasks.named("shadowJar")
dependsOn(compilerShadowJar)
from(compilerShadowJar)
}
doFirst {
delete(
fileTree(mergedDir) {
include("HollowEngineBridge-*.jar")
include("HollowEngineRuntime-*.jar")
}
)
}
}
tasks.register("runActive") {
group = "project"
dependsOn("$bootstrapModulePath:runActive")
}
} else {
bootstrapBuildProjects.forEach(::evaluationDependsOn)
compilerBuildProjects.forEach(::evaluationDependsOn)
tasks.named("assemble") {
dependsOn(bootstrapBuildProjects.map { "$it:assemble" })
dependsOn(compilerBuildProjects.map { "$it:assemble" })
}
tasks.named("build") {
dependsOn(bootstrapBuildProjects.map { "$it:build" })
dependsOn(compilerBuildProjects.map { "$it:build" })
}
tasks.register<Sync>("buildAndCollect") {
group = "build"
into(layout.projectDirectory.dir("merged"))
bootstrapBuildProjects.forEach { path ->
val remapJar = project(path).tasks.named("remapJar")
dependsOn(remapJar)
from(remapJar)
}
compilerBuildProjects.forEach { path ->
val shadowJar = project(path).tasks.named("shadowJar")
dependsOn(shadowJar)
from(shadowJar)
}
}
}