Files
OrangeX-Client/build.gradle
T
xiaozhou233 8b9dbce0f7 Refactor: Make runtime detection extensible and Java 8 compatible
Split the runtime package into small, single-purpose pieces so new loaders and Minecraft versions can be added by registration instead of editing control flow.

- Add LoaderProbe registry for mod loader detection

- Add VersionSignatureRegistry/VersionSignature and move structural version signatures out of VersionDetector

- Add VersionIdSource list for Forge/NeoForge metadata readers

- Extract ModernVersionDetector and CandidateClassLoaders

- Replace MinecraftVersion's mutable static id with RuntimeInfo.versionId

- Target Java 8 with source/target 1.8 and --release 8 on JDK 9+

- Add docs/adding-minecraft-versions.md
2026-11-04 01:04:50 +08:00

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 = 8
}
}
}
tasks.matching { it.name == 'shadowJar' }.configureEach {
mustRunAfter rootProject.tasks.named('cleanOut')
}
}