Search in sources :

Example 1 with ClientVersion

use of net.runelite.deob.clientver.ClientVersion in project runelite by runelite.

the class InjectMojo method execute.

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    ClientVersion ver = new ClientVersion(new File(vanillaPath));
    int version;
    try {
        version = ver.getVersion();
    } catch (IOException ex) {
        throw new MojoExecutionException("Unable to read vanilla client version", ex);
    }
    log.info("Vanilla client version " + version);
    ClassGroup rs;
    ClassGroup vanilla;
    try {
        rs = JarUtil.loadJar(new File(rsClientPath));
        vanilla = JarUtil.loadJar(new File(vanillaPath));
    } catch (IOException ex) {
        throw new MojoExecutionException("Unable to load dependency jars", ex);
    }
    Injector injector = new Injector(rs, vanilla);
    try {
        injector.inject();
    } catch (InjectionException ex) {
        throw new MojoExecutionException("Error injecting client", ex);
    }
    InjectorValidator iv = new InjectorValidator(vanilla);
    iv.validate();
    if (iv.getError() > 0) {
        throw new MojoExecutionException("Error building injected jar");
    }
    if (iv.getMissing() > 0) {
        throw new MojoExecutionException("Unable to inject all methods");
    }
    try {
        writeClasses(vanilla, outputDirectory);
    } catch (IOException ex) {
        throw new MojoExecutionException("Unable to write classes", ex);
    }
    log.info("Injector wrote " + vanilla.getClasses().size() + " classes, " + iv.getOkay() + " injected methods");
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ClassGroup(net.runelite.asm.ClassGroup) IOException(java.io.IOException) ClientVersion(net.runelite.deob.clientver.ClientVersion) File(java.io.File) ClassFile(net.runelite.asm.ClassFile)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ClassFile (net.runelite.asm.ClassFile)1 ClassGroup (net.runelite.asm.ClassGroup)1 ClientVersion (net.runelite.deob.clientver.ClientVersion)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1