gradle: add properties and modify injected-client (#1145)
* add implementation for getItemCount * Ignore build directory in project root * save injector results as class files * package injected-client for shading into client * auto-updating properties * fix run task * shade injected-client into jar
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
group = 'net.runelite.rs'
|
||||
description = 'Injector'
|
||||
|
||||
def osrsRevision = 181
|
||||
def rootPath = project.rootDir.toString().replace('\\', '/')
|
||||
def buildPath = project.buildDir.toString().replace('\\', '/')
|
||||
def buildPath = buildDir.toString().replace('\\', '/') // this doesnt work in an ext block for some reason
|
||||
|
||||
def deobfuscatedJar = "${rootPath}/runescape-client/build/libs/rs-client-${project.version}.jar"
|
||||
def vanillaJar = "${buildPath}/vanilla-${osrsRevision}.jar"
|
||||
def injectedJar = "${rootPath}/injected-client/build/libs/injected-client-${project.version}.jar"
|
||||
def vanillaJar = "${buildPath}/vanilla-${rsversion}.jar"
|
||||
|
||||
|
||||
configurations {
|
||||
vanilla
|
||||
@@ -17,7 +16,6 @@ dependencies {
|
||||
implementation project(':mixins')
|
||||
implementation project(':runelite-api')
|
||||
implementation project(':runescape-api')
|
||||
implementation project(':injected-client')
|
||||
implementation group: 'com.google.guava', name: 'guava', version: '28.0-jre'
|
||||
implementation group: 'org.apache.maven', name: 'maven-plugin-api', version: '3.6.1'
|
||||
implementation group: 'org.ow2.asm', name: 'asm-debug-all', version: '5.2'
|
||||
@@ -26,14 +24,14 @@ dependencies {
|
||||
testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.0.0'
|
||||
compileOnly group: 'org.apache.maven.plugin-tools', name: 'maven-plugin-annotations', version: '3.6.0'
|
||||
annotationProcessor group: 'org.eclipse.sisu', name: 'org.eclipse.sisu.inject', version: '0.3.3'
|
||||
vanilla "net.runelite.rs:vanilla:"+osrsRevision
|
||||
vanilla "net.runelite.rs:vanilla:${rsversion}"
|
||||
}
|
||||
|
||||
compileJava {
|
||||
dependsOn ":rs-client:build"
|
||||
}
|
||||
|
||||
compileJava.outputs.upToDateWhen {false}
|
||||
compileJava.outputs.upToDateWhen { false }
|
||||
|
||||
compileJava.doLast() {
|
||||
copy {
|
||||
@@ -46,7 +44,7 @@ compileJava.doLast() {
|
||||
String[] jarPaths = [
|
||||
deobfuscatedJar.toString(),
|
||||
vanillaJar.toString(),
|
||||
injectedJar.toString()
|
||||
injectedClassesPath.toString()
|
||||
]
|
||||
inject.main(jarPaths)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ package net.runelite.injector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import net.runelite.asm.ClassFile;
|
||||
import net.runelite.asm.ClassGroup;
|
||||
import net.runelite.deob.util.JarUtil;
|
||||
|
||||
@@ -69,7 +72,13 @@ public class Injector
|
||||
|
||||
private void save(File out) throws IOException
|
||||
{
|
||||
JarUtil.saveJar(vanilla, out);
|
||||
out.mkdirs();
|
||||
for (ClassFile cf : vanilla.getClasses())
|
||||
{
|
||||
File f = new File(out, cf.getClassName() + ".class");
|
||||
byte[] data = JarUtil.writeClass(vanilla, cf);
|
||||
Files.write(data, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user