summaryrefslogtreecommitdiffstats
path: root/jack-tests/src/com/android/jack
diff options
context:
space:
mode:
authorJean-Marie Henaff <jmhenaff@google.com>2015-01-16 17:37:51 +0100
committerJean-Marie Henaff <jmhenaff@google.com>2015-02-18 11:40:13 +0100
commit00ed782574b3de6f2926ebaf540778be7c3008f2 (patch)
tree6c51d92346502f313e6338214714b4c5b797ed29 /jack-tests/src/com/android/jack
parentb9298649de45a68fbd449cdf7e13968bdaea0e30 (diff)
downloadtoolchain_jack-00ed782574b3de6f2926ebaf540778be7c3008f2.zip
toolchain_jack-00ed782574b3de6f2926ebaf540778be7c3008f2.tar.gz
toolchain_jack-00ed782574b3de6f2926ebaf540778be7c3008f2.tar.bz2
Fix LegacyJillToolchain in jack-tests
Change-Id: Ib9d9f88e1edc231be58125bca9ac71b7af88990f
Diffstat (limited to 'jack-tests/src/com/android/jack')
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java52
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/DummyToolchain.java5
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/IToolchain.java3
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/JackBasedToolchain.java6
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/JackCliToolchain.java25
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/JillBasedToolchain.java12
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/LegacyJillToolchain.java249
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/LegacyToolchain.java13
-rw-r--r--jack-tests/src/com/android/jack/test/toolchain/Toolchain.java5
9 files changed, 307 insertions, 63 deletions
diff --git a/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java b/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
index bf6007a..0c9fa32 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/AbstractTestTools.java
@@ -135,8 +135,8 @@ public abstract class AbstractTestTools {
@Override
public IToolchain build() {
- return new LegacyJillToolchain(getPrebuilt("jill"), getPrebuilt("jack"),
- getPrebuilt("jarjar"), getPrebuilt("proguard"));
+ return new LegacyJillToolchain(getPrebuilt("legacy-java-compiler"), getPrebuilt("jill"),
+ getPrebuilt("jack"), getPrebuilt("jarjar"), getPrebuilt("proguard"));
}
}
@@ -300,6 +300,37 @@ public abstract class AbstractTestTools {
}
}
+ public static void copyDirectory(@Nonnull File source, @Nonnull File dest) throws IOException {
+ if (!source.isDirectory() || !dest.isDirectory()) {
+ throw new AssertionError("Existing directories must be provided");
+ }
+ recursiveFileCopy(source, dest);
+ }
+
+ private static void recursiveFileCopy(@Nonnull File src, @Nonnull File dest)
+ throws IOException {
+
+ if (src.isDirectory()) {
+
+ if (!dest.exists() && !dest.mkdir()) {
+ throw new AssertionError("Unable to create directory '" + dest.getPath() + "'");
+ }
+
+ for (String file : src.list()) {
+ File srcFile = new File(src, file);
+ File destFile = new File(dest, file);
+ recursiveFileCopy(srcFile, destFile);
+ }
+
+ } else {
+
+ assert src.isFile();
+
+ Files.copy(src, dest);
+ }
+ }
+
+
@Nonnull
public static String getClasspathAsString(@Nonnull File[] files) {
if (files.length == 0) {
@@ -460,6 +491,23 @@ public abstract class AbstractTestTools {
}
}
+ public static void zip(@Nonnull File directory, @Nonnull File outputFile) throws IOException {
+ String[] args = new String[] {"zip", "-r", outputFile.getAbsolutePath(), "."};
+
+ ExecuteFile execFile = new ExecuteFile(args);
+ execFile.setWorkingDir(directory, /* create = */ false);
+ execFile.setErr(System.err);
+ execFile.setOut(System.out);
+
+ try {
+ if (execFile.run() != 0) {
+ throw new RuntimeException("Zip exited with an error");
+ }
+ } catch (ExecFileException e) {
+ throw new RuntimeException("An error occured while running zip", e);
+ }
+ }
+
public static void createjar(@Nonnull File jarfile, @Nonnull File inputFiles) {
String[] args = new String[] {"jar",
"cf",
diff --git a/jack-tests/src/com/android/jack/test/toolchain/DummyToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/DummyToolchain.java
index 741c946..27c3135 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/DummyToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/DummyToolchain.java
@@ -72,4 +72,9 @@ public class DummyToolchain extends AndroidToolchain {
return ".dummy";
}
+ @Override
+ @Nonnull
+ public String getLibraryElementsExtension() {
+ return ".dummy";
+ }
}
diff --git a/jack-tests/src/com/android/jack/test/toolchain/IToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/IToolchain.java
index 44ed63c..7fa2620 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/IToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/IToolchain.java
@@ -63,6 +63,9 @@ public interface IToolchain {
IToolchain addToClasspath(@Nonnull File... classpath);
@Nonnull
+ String getLibraryElementsExtension();
+
+ @Nonnull
IToolchain setWithDebugInfos(boolean withDebugInfos);
@Nonnull
diff --git a/jack-tests/src/com/android/jack/test/toolchain/JackBasedToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/JackBasedToolchain.java
index 5691890..5414e02 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/JackBasedToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/JackBasedToolchain.java
@@ -171,4 +171,10 @@ public abstract class JackBasedToolchain extends AndroidToolchain {
return ".jack";
}
+ @Override
+ @Nonnull
+ public String getLibraryElementsExtension() {
+ return ".jayce";
+ }
+
}
diff --git a/jack-tests/src/com/android/jack/test/toolchain/JackCliToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/JackCliToolchain.java
index 574f446..9378e0e 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/JackCliToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/JackCliToolchain.java
@@ -38,11 +38,11 @@ public class JackCliToolchain extends JackBasedToolchain {
protected File jackPrebuilt;
@Nonnull
- private List<String> extraJackArgs = new ArrayList<String>(0);
+ protected List<String> extraJackArgs = new ArrayList<String>(0);
@CheckForNull
- private File incrementalFolder;
+ protected File incrementalFolder;
@Nonnull
- private Options.VerbosityLevel verbosityLevel = VerbosityLevel.WARNING;
+ protected Options.VerbosityLevel verbosityLevel = VerbosityLevel.WARNING;
JackCliToolchain(@Nonnull File prebuilt) {
this.jackPrebuilt = prebuilt;
@@ -198,7 +198,7 @@ public class JackCliToolchain extends JackBasedToolchain {
public void libToExe(@Nonnull File[] in, @Nonnull File out, boolean zipFile) throws Exception {
List<String> args = new ArrayList<String>();
- libToCommon(args, in);
+ libToCommon(args, getClasspathAsString(), in);
if (zipFile) {
args.add("--output-dex-zip");
@@ -222,7 +222,7 @@ public class JackCliToolchain extends JackBasedToolchain {
public void libToLib(@Nonnull File[] in, @Nonnull File out, boolean zipFiles) throws Exception {
List<String> args = new ArrayList<String>();
- libToCommon(args, in);
+ libToCommon(args, getClasspathAsString(), in);
if (zipFiles) {
args.add("--output-jack");
@@ -242,7 +242,8 @@ public class JackCliToolchain extends JackBasedToolchain {
}
- private void libToCommon(@Nonnull List<String> args, @Nonnull File[] in) {
+ protected void libToCommon(@Nonnull List<String> args, @Nonnull String classpath,
+ @Nonnull File[] in) throws Exception {
args.add("java");
args.add("-cp");
args.add(jackPrebuilt.getAbsolutePath());
@@ -267,9 +268,9 @@ public class JackCliToolchain extends JackBasedToolchain {
addProperties(properties, args);
- if (classpath.size() > 0) {
+ if (!classpath.equals("")) {
args.add("--classpath");
- args.add(getClasspathAsString());
+ args.add(classpath);
}
if (jarjarRules != null) {
@@ -282,6 +283,12 @@ public class JackCliToolchain extends JackBasedToolchain {
args.add(flags.getAbsolutePath());
}
+ libToImportStaticLibs(args, in);
+
+ }
+
+ protected void libToImportStaticLibs(@Nonnull List<String> args, @Nonnull File[] in)
+ throws Exception {
for (File staticlib : in) {
args.add("--import");
args.add(staticlib.getAbsolutePath());
@@ -306,7 +313,7 @@ public class JackCliToolchain extends JackBasedToolchain {
return this;
}
- private static void addProperties(@Nonnull Map<String, String> properties,
+ protected static void addProperties(@Nonnull Map<String, String> properties,
@Nonnull List<String> args) {
for (Entry<String, String> entry : properties.entrySet()) {
args.add("-D");
diff --git a/jack-tests/src/com/android/jack/test/toolchain/JillBasedToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/JillBasedToolchain.java
index cc79239..6660d02 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/JillBasedToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/JillBasedToolchain.java
@@ -39,19 +39,17 @@ public abstract class JillBasedToolchain extends JackCliToolchain {
this.jillPrebuilt = jillPrebuilt;
}
- protected void executeJill(@Nonnull File in, @Nonnull File out, boolean zipFiles) {
+ protected void executeJill(@Nonnull File in, @Nonnull File out) {
List<String> args = new ArrayList<String>();
args.add("java");
args.add("-jar");
args.add(jillPrebuilt.getAbsolutePath());
- args.add("--verbose");
- args.add(String.valueOf(isVerbose));
- if (zipFiles) {
- args.add("--container");
- args.add("zip");
+ if (isVerbose) {
+ args.add("--verbose");
}
+
args.add(in.getAbsolutePath());
- args.add("-o");
+ args.add("--output");
args.add(out.getAbsolutePath());
ExecuteFile execFile = new ExecuteFile(args.toArray(new String[args.size()]));
diff --git a/jack-tests/src/com/android/jack/test/toolchain/LegacyJillToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/LegacyJillToolchain.java
index 32040f1..f35e053 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/LegacyJillToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/LegacyJillToolchain.java
@@ -16,13 +16,22 @@
package com.android.jack.test.toolchain;
+import com.google.common.base.Joiner;
+import com.google.common.io.Files;
+
+import com.android.jack.library.FileType;
+import com.android.jack.library.JackLibrary;
+import com.android.jack.test.TestsProperties;
import com.android.jack.test.util.ExecFileException;
import com.android.jack.test.util.ExecuteFile;
import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
import javax.annotation.Nonnull;
@@ -32,13 +41,16 @@ import javax.annotation.Nonnull;
public class LegacyJillToolchain extends JillBasedToolchain {
@Nonnull
+ private File refCompilerPrebuilt;
+ @Nonnull
private File jarjarPrebuilt;
@Nonnull
private File proguardPrebuilt;
- public LegacyJillToolchain(@Nonnull File jillPrebuilt, @Nonnull File jackPrebuilt,
- @Nonnull File jarjarPrebuilt, @Nonnull File proguardPrebuilt) {
+ public LegacyJillToolchain(@Nonnull File refCompilerPrebuilt, @Nonnull File jillPrebuilt,
+ @Nonnull File jackPrebuilt, @Nonnull File jarjarPrebuilt, @Nonnull File proguardPrebuilt) {
super(jillPrebuilt, jackPrebuilt);
+ this.refCompilerPrebuilt = refCompilerPrebuilt;
this.jarjarPrebuilt = jarjarPrebuilt;
this.proguardPrebuilt = proguardPrebuilt;
}
@@ -48,29 +60,21 @@ public class LegacyJillToolchain extends JillBasedToolchain {
throws Exception {
try {
- File jarFile = AbstractTestTools.createTempFile("legacyLib", ".jar");
- File jarFileJarjar = AbstractTestTools.createTempFile("legacyLibJarjar", ".jar");
- File jarFileProguard = AbstractTestTools.createTempFile("legacyLibProguard", ".jar");
-
- srcToLib(jarFile, true /* zipFiles = */, sources);
-
- if (jarjarRules != null) {
- processWithJarJar(jarjarRules, jarFile, jarFileJarjar);
- } else {
- jarFileJarjar = jarFile;
+ File jarFile = AbstractTestTools.createTempFile("legacyLib", ".jar");
+ File classesDir = AbstractTestTools.createTempDir();
+ List<String> staticLibsAsCp = new ArrayList<String>(staticLibs.size());
+ for (File staticLib : staticLibs) {
+ staticLibsAsCp.add(staticLib.getAbsolutePath());
}
+ String staticLibsAsCpAsString = Joiner.on(File.pathSeparatorChar).join(staticLibsAsCp);
- if (proguardFlags.size() > 0) {
- processWithProguard(getClasspathAsString(), proguardFlags, jarFileJarjar,
- jarFileProguard);
- } else {
- jarFileProguard = jarFileJarjar;
+ if (sources.length > 0) {
+ compileWithExternalRefCompiler(sources,
+ getClasspathAsString() + File.pathSeparatorChar + staticLibsAsCpAsString, classesDir);
}
+ AbstractTestTools.createjar(jarFile, classesDir);
- File jillLib = AbstractTestTools.createTempFile("jillLib", ".jar");
- executeJill(jarFileProguard, jillLib, true);
-
- libToExe(jillLib, out, zipFile);
+ libToExe(jarFile, out, zipFile);
} catch (IOException e) {
throw new RuntimeException("Legacy toolchain exited with an error", e);
@@ -81,10 +85,6 @@ public class LegacyJillToolchain extends JillBasedToolchain {
public void srcToLib(@Nonnull File out, boolean zipFiles, @Nonnull File... sources)
throws Exception {
- if (withDebugInfos) {
- // TODO(jmhenaff): warning log?
- }
-
try {
File classesDir;
if (zipFiles) {
@@ -93,16 +93,61 @@ public class LegacyJillToolchain extends JillBasedToolchain {
classesDir = out;
}
- compileWithExternalRefCompiler(sources, getClasspathAsString(), classesDir);
-
if (staticLibs.size() > 0) {
for (File staticLib : staticLibs) {
- AbstractTestTools.unzip(staticLib, classesDir);
+ if (staticLib.isDirectory()) {
+ AbstractTestTools.copyDirectory(staticLib, classesDir);
+ } else {
+ assert staticLib.isFile();
+ AbstractTestTools.unzip(staticLib, classesDir);
+ }
+ }
+ }
+
+ if (sources.length > 0) {
+ compileWithExternalRefCompiler(sources,
+ getClasspathAsString() + File.pathSeparatorChar
+ + classesDir.getPath(), classesDir);
+ }
+
+ File resDestDir;
+ if (resImport.size() > 0) {
+ resDestDir = new File(classesDir, FileType.RSC.getPrefix());
+ if (!resDestDir.exists() && !resDestDir.mkdir()) {
+ throw new AssertionError("Could not create rsc dir");
+ }
+
+ for (File res : resImport) {
+ AbstractTestTools.copyDirectory(res, resDestDir);
}
}
+
+ File tmpJarsDir = AbstractTestTools.createTempDir();
+ File jarFile = new File(tmpJarsDir, "legacyLib.jar");
+ File jarFileJarjar = new File(tmpJarsDir, "legacyLibJarjar.jar");
+ File jarFileProguard = new File(tmpJarsDir, "legacyLibProguard.jar");
+
+ AbstractTestTools.createjar(jarFile, classesDir);
+
+ if (jarjarRules != null) {
+ processWithJarJar(jarjarRules, jarFile, jarFileJarjar);
+ } else {
+ jarFileJarjar = jarFile;
+ }
+
+ if (proguardFlags.size() > 0) {
+ processWithProguard(getClasspathAsString(), proguardFlags, jarFileJarjar,
+ jarFileProguard);
+ } else {
+ jarFileProguard = jarFileJarjar;
+ }
+
if (zipFiles) {
- AbstractTestTools.createjar(out, classesDir);
+ Files.copy(jarFileProguard, out);
+ } else {
+ AbstractTestTools.unzip(jarFileProguard, out);
}
+
} catch (IOException e) {
throw new RuntimeException("Legacy toolchain exited with an error", e);
}
@@ -110,13 +155,132 @@ public class LegacyJillToolchain extends JillBasedToolchain {
@Override
public void libToLib(@Nonnull File[] in, @Nonnull File out, boolean zipFiles) throws Exception {
- throw new AssertionError("Not Yet Implemented");
+ List<String> args = new ArrayList<String>();
+ libToCommon(args, convertClasspahtWithJillAsString(), in);
+
+ if (zipFiles) {
+ args.add("--output-jack");
+ } else {
+ args.add("--output-jack-dir");
+ }
+ args.add(out.getAbsolutePath());
+
+ ExecuteFile exec = new ExecuteFile(args.toArray(new String[args.size()]));
+ exec.setErr(outRedirectStream);
+ exec.setOut(errRedirectStream);
+ exec.setVerbose(isVerbose);
+
+ if (exec.run() != 0) {
+ throw new RuntimeException("Jack compiler exited with an error");
+ }
+
+ }
+
+ @Override
+ protected void libToImportStaticLibs(@Nonnull List<String> args, @Nonnull File[] in)
+ throws Exception {
+
+ for (int i = 0; i < in.length; i++) {
+ File tmpDir = AbstractTestTools.createTempDir();
+ File jilledLib = new File(tmpDir, "jilledLib_" + i + ".jack");
+ executeJillWithResources(in[i], jilledLib, /* zipFiles = */ true);
+ args.add("--import");
+ args.add(jilledLib.getAbsolutePath());
+ }
+
+ for (int i = 0; i < staticLibs.size(); i++) {
+ File jilledLib = AbstractTestTools.createTempFile("jilledLib", ".jack");
+ executeJillWithResources(staticLibs.get(i), jilledLib, /* zipFiles = */ true);
+ args.add("--import");
+ args.add(jilledLib.getAbsolutePath());
+ }
+ }
+
+ private void executeJillWithResources(@Nonnull File in, @Nonnull File out, boolean zipFiles)
+ throws IOException {
+
+ File tmpOut = AbstractTestTools.createTempFile("out", ".jack");
+ executeJill(in, tmpOut);
+
+ File rscDir;
+ if (in.isDirectory()) {
+ rscDir = new File(in, FileType.RSC.getPrefix());
+ } else {
+ // Assume it's a library archive
+ File tmpUnzippedLib = AbstractTestTools.createTempDir();
+ AbstractTestTools.unzip(in, tmpUnzippedLib);
+ rscDir = new File(tmpUnzippedLib, FileType.RSC.getPrefix());
+ }
+
+ if (rscDir.exists()) {
+
+ File tmpUnzippedOutLib = AbstractTestTools.createTempDir();
+ AbstractTestTools.unzip(tmpOut, tmpUnzippedOutLib);
+
+ File destRscDir = new File(tmpUnzippedOutLib, FileType.RSC.getPrefix());
+ if (!destRscDir.mkdir()) {
+ throw new AssertionError("Could not create directory: '" + destRscDir.getPath() + "'");
+ }
+
+ AbstractTestTools.copyDirectory(rscDir, destRscDir);
+
+ File jackProperties;
+ jackProperties = new File(tmpUnzippedOutLib, JackLibrary.LIBRARY_PROPERTIES);
+
+ Properties prop = new Properties();
+ FileReader fr = new FileReader(jackProperties);
+ prop.load(fr);
+ fr.close();
+ prop.setProperty("rsc", "true");
+ FileWriter fw = new FileWriter(jackProperties);
+ prop.store(fw, "Edited by legacy-jill toolchain");
+ fw.close();
+
+ AbstractTestTools.zip(tmpUnzippedOutLib, out);
+ } else {
+ Files.copy(tmpOut, out);
+ }
}
@Override
+ public void libToExe(@Nonnull File[] in, @Nonnull File out, boolean zipFile) throws Exception {
+ List<String> args = new ArrayList<String>();
+ libToCommon(args, convertClasspahtWithJillAsString(), in);
+
+ if (zipFile) {
+ args.add("--output-dex-zip");
+ } else {
+ args.add("--output-dex");
+ }
+ args.add(out.getAbsolutePath());
+
+ ExecuteFile exec = new ExecuteFile(args.toArray(new String[args.size()]));
+ exec.setErr(outRedirectStream);
+ exec.setOut(errRedirectStream);
+ exec.setVerbose(isVerbose);
+
+ if (exec.run() != 0) {
+ throw new RuntimeException("Jack compiler exited with an error");
+ }
+ }
+
@Nonnull
- public JackBasedToolchain addResource(@Nonnull File resource) {
- throw new AssertionError("Not applicable");
+ private String convertClasspahtWithJillAsString() throws IOException {
+ File[] result = new File[classpath.size()];
+ for (int i = 0; i < classpath.size(); i++) {
+ result[i] = AbstractTestTools.createTempFile(classpath.get(i).getName(), ".jack");
+ executeJill(classpath.get(i), result[i]);
+ }
+ return AbstractTestTools.getClasspathAsString(result);
+ }
+
+ @Override
+ @Nonnull
+ public File[] getDefaultBootClasspath() {
+ return new File[] {
+ new File(TestsProperties.getJackRootDir(), "jack-tests/prebuilts/core-stubs-mini.jar"),
+ new File(TestsProperties.getJackRootDir(), "jack-tests/libs/junit4.jar")
+ };
}
@Override
@@ -125,21 +289,22 @@ public class LegacyJillToolchain extends JillBasedToolchain {
return ".jar";
}
+ @Override
+ @Nonnull
+ public String getLibraryElementsExtension() {
+ return ".class";
+ }
+
private void compileWithExternalRefCompiler(@Nonnull File[] sources,
@Nonnull String classpath, @Nonnull File out) {
List<String> arguments = new ArrayList<String>();
- String refCompilerPath = System.getenv("REF_JAVA_COMPILER");
+ arguments.add(refCompilerPrebuilt.getPath());
- if (refCompilerPath == null) {
- throw new RuntimeException("REF_JAVA_COMPILER environment variable not set");
+ if (isVerbose) {
+ arguments.add("-verbose");
}
- arguments.add(refCompilerPath.trim());
-
- arguments.add("-verbose");
- arguments.add(String.valueOf(isVerbose));
-
addSourceLevel(sourceLevel, arguments);
if (annotationProcessorClass != null) {
@@ -157,6 +322,10 @@ public class LegacyJillToolchain extends JillBasedToolchain {
AbstractTestTools.addFile(arguments, false, sources);
+ if (withDebugInfos) {
+ arguments.add("-g");
+ }
+
arguments.add("-d");
arguments.add(out.getAbsolutePath());
diff --git a/jack-tests/src/com/android/jack/test/toolchain/LegacyToolchain.java b/jack-tests/src/com/android/jack/test/toolchain/LegacyToolchain.java
index 4118bf0..809393f 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/LegacyToolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/LegacyToolchain.java
@@ -56,9 +56,10 @@ public class LegacyToolchain extends AndroidToolchain {
try {
- File jarFile = AbstractTestTools.createTempFile("legacyLib", ".jar");
- File jarFileJarjar = AbstractTestTools.createTempFile("legacyLibJarjar", ".jar");
- File jarFileProguard = AbstractTestTools.createTempFile("legacyLibProguard", ".jar");
+ File tmpJarsDir = AbstractTestTools.createTempDir();
+ File jarFile = new File(tmpJarsDir, "legacyLib.jar");
+ File jarFileJarjar = new File(tmpJarsDir, "legacyLibJarjar.jar");
+ File jarFileProguard = new File(tmpJarsDir, "legacyLibProguard.jar");
srcToLib(jarFile, true /* zipFiles = */, sources);
@@ -147,6 +148,12 @@ public class LegacyToolchain extends AndroidToolchain {
return ".jar";
}
+ @Override
+ @Nonnull
+ public String getLibraryElementsExtension() {
+ return ".class";
+ }
+
private void processWithJarJar(@Nonnull File jarjarRules,
@Nonnull File inJar, @Nonnull File outJar) {
String[] args = new String[]{"java", "-Dverbose=" + String.valueOf(isVerbose), "-jar",
diff --git a/jack-tests/src/com/android/jack/test/toolchain/Toolchain.java b/jack-tests/src/com/android/jack/test/toolchain/Toolchain.java
index 68a29f2..52e4d1f 100644
--- a/jack-tests/src/com/android/jack/test/toolchain/Toolchain.java
+++ b/jack-tests/src/com/android/jack/test/toolchain/Toolchain.java
@@ -81,12 +81,13 @@ public abstract class Toolchain implements IToolchain {
boolean zipFiles, @Nonnull File... sources) throws Exception;
@Override
- public void libToExe(@Nonnull File in, @Nonnull File out, boolean zipFile) throws Exception {
+ public final void libToExe(@Nonnull File in, @Nonnull File out, boolean zipFile)
+ throws Exception {
libToExe(new File[] {in}, out, zipFile);
}
@Override
- public void libToExe(@Nonnull List<File> in, @Nonnull File out, boolean zipFile)
+ public final void libToExe(@Nonnull List<File> in, @Nonnull File out, boolean zipFile)
throws Exception {
libToExe(in.toArray(new File[in.size()]), out, zipFile);
}