mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 13:05:52 +08:00
- Compile main sources with --release 8 - Move record-dependent v26_2 input classes to a separate source set - Use a JDK 25 toolchain for that source set, still emitting class version 52 - Fix the Injector PrintStream charset constructor for Java 8
81 lines
2.2 KiB
Groovy
81 lines
2.2 KiB
Groovy
plugins {
|
|
id 'base'
|
|
}
|
|
apply from: 'gradle/dependencies.gradle'
|
|
|
|
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 downloadDependencies
|
|
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 = 8
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.matching { it.name == 'shadowJar' }.configureEach {
|
|
mustRunAfter rootProject.tasks.named('cleanOut')
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.whenReady { taskGraph ->
|
|
if (taskGraph.hasTask(':build')) {
|
|
throw new GradleException('---> The build task is not supported. Please refer to the documentation. <---')
|
|
}
|
|
}
|