Some more work on getting mixins injected into the jar
This commit is contained in:
parent
425a8d2948
commit
a37f724fa7
2 changed files with 55 additions and 1 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -21,4 +21,6 @@ changelog.txt
|
||||||
*.project
|
*.project
|
||||||
*.classpath
|
*.classpath
|
||||||
.idea/*
|
.idea/*
|
||||||
java_pid2412.hprof
|
java_pid2412.hprof
|
||||||
|
/asmTemp/
|
||||||
|
/logs/
|
||||||
|
|
52
build.gradle
52
build.gradle
|
@ -16,10 +16,15 @@ buildscript {
|
||||||
maven {
|
maven {
|
||||||
url "https://plugins.gradle.org/m2/"
|
url "https://plugins.gradle.org/m2/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = 'mojang'
|
||||||
|
url = 'https://libraries.minecraft.net/'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
|
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
|
||||||
|
classpath 'ASM-Injector:ASM-Injector:1.0.0.25'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +312,54 @@ task signJar(type: SignJar, dependsOn: reobfJar) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task asmInjectJar {
|
||||||
|
doLast {
|
||||||
|
def cacheFiles = new File(".gradle/asmInjector")
|
||||||
|
if (!cacheFiles.exists()) {
|
||||||
|
cacheFiles.mkdirs()
|
||||||
|
}
|
||||||
|
//Downloads the maven meta data
|
||||||
|
def mavenMetadata = new File(cacheFiles, "maven-metadata.xml")
|
||||||
|
logger.lifecycle("ASMInjector: Downloading reborn core metadata")
|
||||||
|
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/RebornCore/RebornCore-1.12/maven-metadata.xml"), mavenMetadata)
|
||||||
|
|
||||||
|
def metadata = new XmlSlurper().parseText(FileUtils.readFileToString(mavenMetadata))
|
||||||
|
def rcVersion = metadata.versioning.release
|
||||||
|
|
||||||
|
def rebornCoreJar = new File(cacheFiles, "${rcVersion}.jar")
|
||||||
|
def localRCJar = new File(cacheFiles, "RebornCore-1.12-3.1.0-universal.jar")
|
||||||
|
if (localRCJar.exists()) {
|
||||||
|
logger.lifecycle("ASMInjector: using local RebornCore")
|
||||||
|
rebornCoreJar = localRCJar
|
||||||
|
} else {
|
||||||
|
logger.lifecycle("ASMInjector: downloading RebornCore")
|
||||||
|
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/RebornCore/RebornCore-1.12/${rcVersion}/RebornCore-1.12-${rcVersion}-dev.jar"), rebornCoreJar)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logger.lifecycle("ASMInjector: setting up injector")
|
||||||
|
def injector = new me.modmuss50.asmInjector.ASMInjector()
|
||||||
|
injector.addClasspathFile(rebornCoreJar)
|
||||||
|
injector.addClasspathFile(jar.archivePath)
|
||||||
|
configurations.forgeGradleMc.collect {
|
||||||
|
injector.addClasspathFile(it)
|
||||||
|
}
|
||||||
|
configurations.compile.collect {
|
||||||
|
if(!it.getName().contains("RebornCore")){
|
||||||
|
injector.addClasspathFile(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
injector.addTransformer("reborncore.mixin.transformer.MixinTransformer")
|
||||||
|
injector.callSetupClass("reborncore.mixin.implementations.asmInjector.ASMInjectorSetupClass")
|
||||||
|
logger.lifecycle("ASMInjector: injecting")
|
||||||
|
injector.inject(jar.archivePath, jar.archivePath)
|
||||||
|
logger.lifecycle("ASMInjector: done")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
build.dependsOn signJar
|
build.dependsOn signJar
|
||||||
|
signJar.dependsOn asmInjectJar
|
||||||
|
|
||||||
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
|
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue