mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 21:15:53 +08:00
shadowJar tasks now output to their default build/libs directories, and buildInjection copies the jars into out/tmp. Previously cleanTmp (Delete out/tmp) and shadowJar tasks (writing into out/tmp) had no mutual ordering guarantee, which could delete freshly built jars.
55 lines
1.4 KiB
Groovy
55 lines
1.4 KiB
Groovy
plugins {
|
|
id 'lifecycle-base'
|
|
}
|
|
|
|
// ============================
|
|
// Variables
|
|
// ============================
|
|
def outDir = layout.projectDirectory.dir("out")
|
|
def tmpDir = layout.projectDirectory.dir("out/tmp")
|
|
|
|
tasks.register("cleanTmp", Delete) {
|
|
delete tmpDir
|
|
}
|
|
|
|
tasks.register("buildInjection", Copy) {
|
|
outputs.upToDateWhen { false }
|
|
|
|
dependsOn(
|
|
tasks.named("cleanTmp"),
|
|
project(':OrangeX').tasks.named('shadowJar'),
|
|
project(':Injector').tasks.named('shadowJar'),
|
|
project(':Loader').tasks.named('shadowJar')
|
|
)
|
|
|
|
from(project(':OrangeX').tasks.named('shadowJar').flatMap { it.archiveFile })
|
|
from(project(':Loader').tasks.named('shadowJar').flatMap { it.archiveFile })
|
|
from(rootProject.layout.projectDirectory.dir('natives'))
|
|
from(rootProject.layout.projectDirectory.dir('resources'))
|
|
into(tmpDir)
|
|
}
|
|
|
|
tasks.register("packInjection", Zip) {
|
|
group = 'build'
|
|
description = 'Package all files from tmp into injection.zip'
|
|
|
|
dependsOn(tasks.named("buildInjection"))
|
|
|
|
destinationDirectory.set(outDir)
|
|
archiveFileName.set("injection.zip")
|
|
|
|
from(tmpDir)
|
|
}
|
|
|
|
tasks.register("buildAll") {
|
|
dependsOn(tasks.named("buildInjection"))
|
|
dependsOn(tasks.named("packInjection"))
|
|
|
|
doFirst {
|
|
println("Building OrangeX-Client...")
|
|
}
|
|
|
|
doLast {
|
|
println("Build finished!")
|
|
}
|
|
} |