Search in sources :

Example 1 with InvocationWeaver

use of com.googlecode.d2j.tools.jar.InvocationWeaver in project dex2jar by pxb1988.

the class JarWeaverCmd method doCommandLine.

@Override
protected void doCommandLine() throws Exception {
    if (remainingArgs.length == 0) {
        throw new HelpException("no jar");
    }
    InvocationWeaver invocationWeaver = (InvocationWeaver) new InvocationWeaver().withConfig(config);
    try (FileSystem fs = createZip(output)) {
        final Path outRoot = fs.getPath("/");
        for (String str : remainingArgs) {
            Path p = new File(str).toPath();
            System.err.println(p + " -> " + output);
            if (Files.isDirectory(p)) {
                invocationWeaver.wave(p, outRoot);
            } else {
                try (FileSystem fs2 = openZip(p)) {
                    invocationWeaver.wave(fs2.getPath("/"), outRoot);
                }
            }
        }
        if (stub != null) {
            System.err.println(stub + " -> " + output);
            walkJarOrDir(stub, new FileVisitorX() {

                @Override
                public void visitFile(Path file, String relative) throws IOException {
                    Path out = outRoot.resolve(relative);
                    if (Files.exists(out)) {
                        System.err.println("skip " + relative + " in " + stub);
                    } else {
                        createParentDirectories(out);
                        Files.copy(file, out);
                    }
                }
            });
        }
    }
}
Also used : InvocationWeaver(com.googlecode.d2j.tools.jar.InvocationWeaver) Path(java.nio.file.Path) FileSystem(java.nio.file.FileSystem) IOException(java.io.IOException) File(java.io.File)

Example 2 with InvocationWeaver

use of com.googlecode.d2j.tools.jar.InvocationWeaver in project dex2jar by pxb1988.

the class WaveTest method testA.

@Test
public void testA() throws IOException, RecognitionException {
    InvocationWeaver iw = new InvocationWeaver();
    iw.setInvocationInterfaceDesc("Lp;");
    iw.withConfig("d LA;.m()V=LB;.t(Lp;)Ljava/lang/Object;");
    test0(iw, "a");
}
Also used : InvocationWeaver(com.googlecode.d2j.tools.jar.InvocationWeaver) Test(org.junit.Test)

Example 3 with InvocationWeaver

use of com.googlecode.d2j.tools.jar.InvocationWeaver in project dex2jar by pxb1988.

the class WaveTest method testB.

@Test
public void testB() throws IOException, RecognitionException {
    InvocationWeaver iw = new InvocationWeaver();
    iw.setInvocationInterfaceDesc("Lp;");
    iw.withConfig("r Ljava/util/ArrayList;.size=Lcom/googlecode/d2j/tools/jar/test/WaveTest;.size(Lp;)Ljava/lang/Object;");
    iw.withConfig("r Ljava/util/ArrayList;.add=Lcom/googlecode/d2j/tools/jar/test/WaveTest;.add(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
    iw.withConfig("r Ljava/io/PrintStream;.append(Ljava/lang/CharSequence;)Ljava/io/PrintStream;=Lcom/googlecode/d2j/tools/jar/test/WaveTest;.append(Lp;)Ljava/lang/Object;");
    iw.withConfig("r Ljava/io/PrintStream;.println(Ljava/lang/String;)V=Lcom/googlecode/d2j/tools/jar/test/WaveTest;.println(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
    test0(iw, "b");
}
Also used : InvocationWeaver(com.googlecode.d2j.tools.jar.InvocationWeaver) Test(org.junit.Test)

Example 4 with InvocationWeaver

use of com.googlecode.d2j.tools.jar.InvocationWeaver in project dex2jar by pxb1988.

the class WaveTest method testC.

@Test
public void testC() throws IOException, RecognitionException {
    InvocationWeaver iw = new InvocationWeaver();
    iw.setInvocationInterfaceDesc("Lp;");
    iw.withConfig("r LT;.a()V=LB;.a(Lp;)Ljava/lang/Object;");
    iw.withConfig("r LT;.b()V=LB;.b(Lp;)V");
    iw.withConfig("r LT;.c()I=LB;.c(Lp;)Ljava/lang/Object;");
    // iw.withConfig("r LT;.d()I=LB;.d(Lp;)V");
    test0(iw, "c");
}
Also used : InvocationWeaver(com.googlecode.d2j.tools.jar.InvocationWeaver) Test(org.junit.Test)

Aggregations

InvocationWeaver (com.googlecode.d2j.tools.jar.InvocationWeaver)4 Test (org.junit.Test)3 File (java.io.File)1 IOException (java.io.IOException)1 FileSystem (java.nio.file.FileSystem)1 Path (java.nio.file.Path)1