client-patch

Caches current injected client to root of project for analysis.

Now uses client-patch from our maven repo. This prevents snapshot client-patches from disrupting our weekly build cycles.
This commit is contained in:
zeruth
2019-05-24 01:40:24 -04:00
parent cb795a48f7
commit de9f5987c0
3 changed files with 32 additions and 6 deletions

1
.gitignore vendored
View File

@@ -12,3 +12,4 @@ runelite-client/src/main/resources/META-INF/MANIFEST.MF
git git
classes/artifacts/client_jar/run.bat classes/artifacts/client_jar/run.bat
classes/artifacts/client_jar/client.jar classes/artifacts/client_jar/client.jar
*.jar

View File

@@ -194,9 +194,9 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.runelite</groupId> <groupId>net.runelit</groupId>
<artifactId>client-patch</artifactId> <artifactId>client-patch</artifactId>
<version>${project.version}</version> <version>1.5.25.1</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -327,7 +327,14 @@
<!-- include runtime apis --> <!-- include runtime apis -->
<filter> <filter>
<!-- net.runelite:client-patch and net.runelite:api --> <!-- net.runelite:client-patch and net.runelite:api -->
<artifact>net.runelite:*</artifact> <artifact>net.runelite:api</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<!-- net.runelit:client-patch -->
<artifact>net.runelite:client-patch</artifact>
<includes> <includes>
<include>**</include> <include>**</include>
</includes> </includes>

View File

@@ -34,6 +34,8 @@ import io.sigpipe.jbsdiff.InvalidHeaderException;
import io.sigpipe.jbsdiff.Patch; import io.sigpipe.jbsdiff.Patch;
import java.applet.Applet; import java.applet.Applet;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@@ -49,6 +51,7 @@ import java.util.Map;
import java.util.jar.Attributes; import java.util.jar.Attributes;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarInputStream; import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
@@ -181,6 +184,11 @@ public class ClientLoader
if (updateCheckMode == AUTO) if (updateCheckMode == AUTO)
{ {
File injectedClientFile = new File("./InjectedClient.jar");
Manifest manifest2 = new Manifest();
manifest2.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
JarOutputStream target = new JarOutputStream(new FileOutputStream(injectedClientFile), manifest2);
ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024); ByteArrayOutputStream patchOs = new ByteArrayOutputStream(756 * 1024);
int patchCount = 0; int patchCount = 0;
@@ -202,8 +210,12 @@ public class ClientLoader
file.setValue(patchOs.toByteArray()); file.setValue(patchOs.toByteArray());
++patchCount; ++patchCount;
if (!file.getKey().startsWith("META"))
{
add(file.getValue(), file.getKey(), target);
} }
}
target.close();
log.info("Patched {} classes", patchCount); log.info("Patched {} classes", patchCount);
} }
@@ -211,7 +223,6 @@ public class ClientLoader
if (updateCheckMode == AUTO) if (updateCheckMode == AUTO)
{ {
HashMap<String, byte[]> patches = new HashMap<>(); HashMap<String, byte[]> patches = new HashMap<>();
for (Map.Entry<String, byte[]> file : zipFile.entrySet()) for (Map.Entry<String, byte[]> file : zipFile.entrySet())
@@ -228,7 +239,6 @@ public class ClientLoader
} }
patches.put(file.getKey(), patchClass); patches.put(file.getKey(), patchClass);
} }
new MixinRunner(zipFile, patches).run(); new MixinRunner(zipFile, patches).run();
@@ -285,4 +295,12 @@ public class ClientLoader
Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt")); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt"));
return certificates.toArray(new Certificate[0]); return certificates.toArray(new Certificate[0]);
} }
private void add(byte[] bytes, String entryName, JarOutputStream target) throws IOException
{
JarEntry entry = new JarEntry(entryName);
target.putNextEntry(entry);
target.write(bytes);
target.closeEntry();
}
} }