mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 21:15:53 +08:00
73 lines
1.9 KiB
Groovy
73 lines
1.9 KiB
Groovy
plugins {
|
|
id 'base'
|
|
}
|
|
|
|
def outputDir = layout.projectDirectory.dir('out/tmp')
|
|
def distDir = layout.projectDirectory.dir('out')
|
|
def resourcesDir = layout.projectDirectory.dir('resources')
|
|
def nativesDir = layout.projectDirectory.dir('natives')
|
|
|
|
tasks.register('cleanOut') {
|
|
group = 'build'
|
|
description = 'Deletes the shaded jar output directory (out/tmp)'
|
|
doLast {
|
|
delete outputDir
|
|
}
|
|
}
|
|
|
|
tasks.register('prepareInjection') {
|
|
group = 'build'
|
|
description = 'Copies resources and natives into out/tmp (both flattened)'
|
|
dependsOn cleanOut
|
|
dependsOn ':Loader:shadowJar', ':OrangeX:shadowJar'
|
|
doLast {
|
|
copy {
|
|
from resourcesDir
|
|
into outputDir
|
|
exclude '**/.gitkeep'
|
|
}
|
|
copy {
|
|
from nativesDir
|
|
into outputDir
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('injectionZip', Zip) {
|
|
group = 'build'
|
|
description = 'Zips out/tmp into out/injection.zip'
|
|
dependsOn prepareInjection
|
|
destinationDirectory = distDir
|
|
archiveFileName = 'injection.zip'
|
|
from outputDir
|
|
}
|
|
|
|
tasks.register('packageAll') {
|
|
group = 'build'
|
|
description = 'Builds Loader, OrangeX and Injector, then zips out/tmp into out/injection.zip'
|
|
dependsOn cleanOut
|
|
dependsOn ':Loader:shadowJar', ':OrangeX:shadowJar', ':Injector:jar'
|
|
dependsOn injectionZip
|
|
}
|
|
|
|
subprojects {
|
|
plugins.withId('java') {
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8'
|
|
if (JavaVersion.current().isJava9Compatible()) {
|
|
// Fail fast if a post-Java-8 API is used.
|
|
options.release = 25
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.matching { it.name == 'shadowJar' }.configureEach {
|
|
mustRunAfter rootProject.tasks.named('cleanOut')
|
|
}
|
|
}
|