SkidSolutions
This commit is contained in:
commit
14b3235b41
7727 files changed
+864433
No files matched your search
+325
@@ -0,0 +1,325 @@
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
group = 'cc.novoline'
|
||||
version = '6.99'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = 'Mojang'
|
||||
url = 'https://libraries.minecraft.net/'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
asmTools
|
||||
mcLibs
|
||||
mcNatives
|
||||
clientBundle
|
||||
implementation.extendsFrom(mcLibs, clientBundle)
|
||||
}
|
||||
|
||||
def java8Compiler = javaToolchains.compilerFor {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
def java8Launcher = javaToolchains.launcherFor {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
def gradleHostJavaExe = Jvm.current().javaExecutable.absolutePath
|
||||
|
||||
def customDepsJar = file('libs/novoline-custom-deps.jar')
|
||||
def jfxJar = file('libs/jfxrt-java8.jar')
|
||||
|
||||
// Resolve nashorn.jar automatically from the provisioned Java 8 Toolchain
|
||||
def resolveJava8Nashorn = {
|
||||
def j8Home = java8Launcher.get().metadata.installationPath.asFile
|
||||
def c1 = new File(j8Home, 'jre/lib/ext/nashorn.jar')
|
||||
if (c1.isFile()) return files(c1)
|
||||
def c2 = new File(j8Home, 'lib/ext/nashorn.jar')
|
||||
return c2.isFile() ? files(c2) : files()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly files(layout.buildDirectory.dir('tmp/restored-props'))
|
||||
implementation files(customDepsJar, jfxJar)
|
||||
implementation files({ resolveJava8Nashorn() })
|
||||
|
||||
// Client libraries bundled into standalone runtime JAR (resolved from Maven Central)
|
||||
clientBundle 'it.unimi.dsi:fastutil:8.2.1'
|
||||
clientBundle 'net.sf.trove4j:trove4j:3.0.3'
|
||||
clientBundle 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20'
|
||||
clientBundle 'org.jetbrains.kotlin:kotlin-reflect:1.6.20'
|
||||
clientBundle 'com.squareup.okhttp3:okhttp:4.11.0'
|
||||
|
||||
// Minecraft 1.8.8 official libraries (resolved automatically from Mojang & Maven Central)
|
||||
mcLibs 'com.mojang:netty:1.8.8'
|
||||
mcLibs 'oshi-project:oshi-core:1.1'
|
||||
mcLibs 'net.java.dev.jna:jna:3.4.0'
|
||||
mcLibs 'net.java.dev.jna:platform:3.4.0'
|
||||
mcLibs 'com.ibm.icu:icu4j-core-mojang:51.2'
|
||||
mcLibs 'net.sf.jopt-simple:jopt-simple:4.6'
|
||||
mcLibs 'com.paulscode:codecjorbis:20101023'
|
||||
mcLibs 'com.paulscode:codecwav:20101023'
|
||||
mcLibs 'com.paulscode:libraryjavasound:20101123'
|
||||
mcLibs 'com.paulscode:librarylwjglopenal:20100824'
|
||||
mcLibs 'com.paulscode:soundsystem:20120107'
|
||||
mcLibs 'io.netty:netty-all:4.0.23.Final'
|
||||
mcLibs 'com.google.guava:guava:17.0'
|
||||
mcLibs 'org.apache.commons:commons-lang3:3.3.2'
|
||||
mcLibs 'commons-io:commons-io:2.4'
|
||||
mcLibs 'commons-codec:commons-codec:1.9'
|
||||
mcLibs 'net.java.jinput:jinput:2.0.5'
|
||||
mcLibs 'net.java.jutils:jutils:1.0.0'
|
||||
mcLibs 'com.google.code.gson:gson:2.2.4'
|
||||
mcLibs 'com.mojang:authlib:1.5.21'
|
||||
mcLibs 'com.mojang:realms:1.7.39'
|
||||
mcLibs 'org.apache.commons:commons-compress:1.8.1'
|
||||
mcLibs 'org.apache.httpcomponents:httpclient:4.3.3'
|
||||
mcLibs 'commons-logging:commons-logging:1.1.3'
|
||||
mcLibs 'org.apache.httpcomponents:httpcore:4.3.2'
|
||||
mcLibs 'org.apache.logging.log4j:log4j-api:2.0-beta9'
|
||||
mcLibs 'org.apache.logging.log4j:log4j-core:2.0-beta9'
|
||||
mcLibs 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209'
|
||||
mcLibs 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209'
|
||||
mcLibs 'tv.twitch:twitch:6.5'
|
||||
|
||||
// Native libraries for LWJGL / OpenAL / JInput / Twitch (auto-extracted on runClient)
|
||||
def osName = System.getProperty('os.name', '').toLowerCase(Locale.ROOT)
|
||||
if (osName.contains('win')) {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-windows'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-windows'
|
||||
mcNatives 'tv.twitch:twitch-platform:6.5:natives-windows-64'
|
||||
mcNatives 'tv.twitch:twitch-external-platform:4.5:natives-windows-64'
|
||||
} else if (osName.contains('mac')) {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-osx'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-osx'
|
||||
mcNatives 'tv.twitch:twitch-platform:6.5:natives-osx'
|
||||
} else {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-linux'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-linux'
|
||||
}
|
||||
|
||||
// Build-time ASM post-processor dependencies
|
||||
asmTools 'org.ow2.asm:asm:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-tree:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-analysis:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-commons:9.10.1'
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
downloadJavadoc = false
|
||||
downloadSources = false
|
||||
scopes.COMPILE.plus += [configurations.compileClasspath]
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
propertyJavaIncludes = [
|
||||
'cc/novoline/modules/configurations/property/AbstractNumberProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/ColorProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/DoubleProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/FloatProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/IntProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/ListProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/LongProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/StringProperty.java'
|
||||
]
|
||||
emptySourceDir = layout.buildDirectory.dir('tmp/empty-sourcepath').get().asFile
|
||||
}
|
||||
|
||||
def configureJava8Compile = { JavaCompile t, boolean allowImplicitFromSrc ->
|
||||
t.javaCompiler.set(java8Compiler)
|
||||
t.options.encoding = 'UTF-8'
|
||||
t.options.fork = true
|
||||
t.options.forkOptions.memoryMaximumSize = allowImplicitFromSrc ? '512m' : '1536m'
|
||||
if (allowImplicitFromSrc) {
|
||||
t.options.sourcepath = files('src/main/java')
|
||||
t.options.compilerArgs.addAll(['-XDignore.symbol.file', '-Xlint:-options', '-proc:none'])
|
||||
} else {
|
||||
t.doFirst { emptySourceDir.mkdirs() }
|
||||
t.options.sourcepath = files(emptySourceDir)
|
||||
t.options.compilerArgs.addAll(['-XDignore.symbol.file', '-Xlint:-options', '-proc:none', '-implicit:none'])
|
||||
}
|
||||
}
|
||||
|
||||
def propRawOutDir = layout.buildDirectory.dir('tmp/javac-props')
|
||||
def propRestoredDir = layout.buildDirectory.dir('tmp/restored-props')
|
||||
|
||||
tasks.register('compilePropertiesJava', JavaCompile) {
|
||||
description = 'Phase 1: Compiles the 8 Novoline @Property hierarchy classes from pure Java source.'
|
||||
source = fileTree('src/main/java') {
|
||||
include propertyJavaIncludes
|
||||
}
|
||||
classpath = files(customDepsJar, jfxJar, { resolveJava8Nashorn() }, configurations.clientBundle, configurations.mcLibs)
|
||||
destinationDirectory.set(propRawOutDir)
|
||||
configureJava8Compile(it, true)
|
||||
}
|
||||
|
||||
tasks.register('restorePropertySignatures', Exec) {
|
||||
description = 'Phase 2: Restores original JVM generic bridge methods on the 8 @Property classes.'
|
||||
dependsOn 'compilePropertiesJava', configurations.asmTools
|
||||
doFirst {
|
||||
propRestoredDir.get().asFile.mkdirs()
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/PropertySignatures.java').absolutePath,
|
||||
'restore',
|
||||
file('tools/property-bridges.tsv').absolutePath,
|
||||
propRawOutDir.get().asFile.absolutePath,
|
||||
propRestoredDir.get().asFile.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('compileJava', JavaCompile) {
|
||||
dependsOn 'restorePropertySignatures'
|
||||
exclude propertyJavaIncludes
|
||||
configureJava8Compile(it, false)
|
||||
finalizedBy 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.register('restoreBooleanArguments', Exec) {
|
||||
description = 'Phase 3a: Merges restored @Property classes and restores non-canonical int->boolean arguments.'
|
||||
dependsOn configurations.asmTools
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
def boolReport = layout.buildDirectory.file('reports/boolean-arguments.tsv').get().asFile
|
||||
doFirst {
|
||||
copy {
|
||||
from propRestoredDir
|
||||
into outClassesDir
|
||||
}
|
||||
boolReport.parentFile.mkdirs()
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/BooleanArgumentBytecode.java').absolutePath,
|
||||
outClassesDir.absolutePath,
|
||||
boolReport.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('restoreClientBytecode', Exec) {
|
||||
description = 'Phase 3b: Restores ZKM bridges, class versions/flags, and strips spurious narrowing casts.'
|
||||
dependsOn 'restoreBooleanArguments', configurations.asmTools
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
doFirst {
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/Stage4BytecodeRestore.java').absolutePath,
|
||||
file('tools/bridge-delegates.tsv').absolutePath,
|
||||
file('tools/bytecode-metadata.tsv').absolutePath,
|
||||
outClassesDir.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('classes') {
|
||||
dependsOn 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.named('jar') {
|
||||
dependsOn 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.register('clientJar', Exec) {
|
||||
group = 'build'
|
||||
description = 'Builds 100% standalone novoline-6.99-runtime.jar from compiled sources + resources + third-party libs.'
|
||||
dependsOn 'classes', configurations.clientBundle
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
def resourcesDir = file('src/main/resources')
|
||||
def runtimeOut = layout.buildDirectory.file('libs/novoline-6.99-runtime.jar').get().asFile
|
||||
doFirst {
|
||||
def bundlePath = files(customDepsJar, configurations.clientBundle).asPath
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
file('tools/BuildStandaloneClientJar.java').absolutePath,
|
||||
outClassesDir.absolutePath,
|
||||
resourcesDir.absolutePath,
|
||||
bundlePath,
|
||||
runtimeOut.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('assemble') {
|
||||
dependsOn 'clientJar'
|
||||
}
|
||||
|
||||
def extractedNativesDir = layout.buildDirectory.dir('natives')
|
||||
|
||||
tasks.register('extractNatives', Sync) {
|
||||
description = 'Extracts platform LWJGL/OpenAL/JInput/Twitch native libraries from Mojang Maven.'
|
||||
dependsOn configurations.mcNatives
|
||||
from {
|
||||
configurations.mcNatives.collect { zipTree(it) }
|
||||
}
|
||||
exclude 'META-INF/**'
|
||||
into extractedNativesDir
|
||||
}
|
||||
|
||||
def resolveDefaultMcAssetsDir = {
|
||||
def custom = findProperty('mcAssetsDir')
|
||||
if (custom != null) return file(custom)
|
||||
def osName = System.getProperty('os.name', '').toLowerCase(Locale.ROOT)
|
||||
def home = System.getProperty('user.home', '.')
|
||||
File cand
|
||||
if (osName.contains('win')) {
|
||||
def appData = System.getenv('APPDATA') ?: new File(home, 'AppData/Roaming').absolutePath
|
||||
cand = new File(appData, '.minecraft/assets')
|
||||
} else if (osName.contains('mac')) {
|
||||
cand = new File(home, 'Library/Application Support/minecraft/assets')
|
||||
} else {
|
||||
cand = new File(home, '.minecraft/assets')
|
||||
}
|
||||
return cand.isDirectory() ? cand : file('run/assets')
|
||||
}
|
||||
|
||||
tasks.register('runClient', JavaExec) {
|
||||
group = 'application'
|
||||
description = 'Builds novoline-6.99-runtime.jar from 100% full Java source and launches Novoline 6.99 under Java 8.'
|
||||
dependsOn 'clientJar', 'extractNatives', configurations.mcLibs
|
||||
javaLauncher.set(java8Launcher)
|
||||
def runtimeOut = layout.buildDirectory.file('libs/novoline-6.99-runtime.jar').get().asFile
|
||||
def runDir = file('run')
|
||||
workingDir = runDir
|
||||
maxHeapSize = '2G'
|
||||
mainClass = 'net.minecraft.client.main.Main'
|
||||
classpath = files(runtimeOut, jfxJar, { resolveJava8Nashorn() }, configurations.mcLibs)
|
||||
doFirst {
|
||||
runDir.mkdirs()
|
||||
def assetsDir = resolveDefaultMcAssetsDir()
|
||||
assetsDir.mkdirs()
|
||||
new File(runDir, 'Novoline/configs').mkdirs()
|
||||
new File(runDir, 'Novoline/scripts').mkdirs()
|
||||
jvmArgs("-Djava.library.path=${extractedNativesDir.get().asFile.absolutePath}")
|
||||
args(
|
||||
'--version', 'Novoline-6.99',
|
||||
'--accessToken', '0',
|
||||
'--assetsDir', assetsDir.absolutePath,
|
||||
'--assetIndex', '1.8',
|
||||
'--userProperties', '{}',
|
||||
'--gameDir', runDir.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user