diff options
author | Yohann Roussel <yroussel@google.com> | 2014-04-08 17:23:52 +0200 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2014-05-20 20:30:34 +0200 |
commit | c0f268d5b5d2405a8665c33f813a4698715500b8 (patch) | |
tree | 2ac8913ecf15daacce125483491b0c3df85a0779 | |
parent | 52abb1ff9df376267eb7b10b2d3f4765638fd2e3 (diff) | |
download | toolchain_jack-c0f268d5b5d2405a8665c33f813a4698715500b8.zip toolchain_jack-c0f268d5b5d2405a8665c33f813a4698715500b8.tar.gz toolchain_jack-c0f268d5b5d2405a8665c33f813a4698715500b8.tar.bz2 |
Clean ecj paths and change some ecj arguments handling.
Change-Id: Ice72d7a51ccb772ba022a4e06402299f863e66e6
6 files changed, 24 insertions, 61 deletions
diff --git a/jack/src/com/android/jack/Jack.java b/jack/src/com/android/jack/Jack.java index 6e03f00..c313d2a 100644 --- a/jack/src/com/android/jack/Jack.java +++ b/jack/src/com/android/jack/Jack.java @@ -609,17 +609,6 @@ public abstract class Jack { putInJackClasspath(options.getClasspath(), rootPackage, phantomLookup, hooks); if (ecjArguments != null) { - String bootclasspathOption = "-bootclasspath"; - - int bootclasspathIndex = ecjArguments.indexOf(bootclasspathOption); - if (bootclasspathIndex != -1) { - String previousBootclasspath = ecjArguments.get(bootclasspathIndex + 1); - ecjArguments.set(bootclasspathIndex + 1, previousBootclasspath + File.pathSeparatorChar - + JackBatchCompiler.JACK_LOGICAL_PATH_ENTRY); - } else { - ecjArguments.add(bootclasspathOption); - ecjArguments.add(JackBatchCompiler.JACK_LOGICAL_PATH_ENTRY); - } JackBatchCompiler jbc = new JackBatchCompiler(session, jayceImporter); diff --git a/jack/src/com/android/jack/Main.java b/jack/src/com/android/jack/Main.java index 9710169..2f2fdad 100644 --- a/jack/src/com/android/jack/Main.java +++ b/jack/src/com/android/jack/Main.java @@ -27,8 +27,6 @@ import javax.annotation.Nonnull; * Command line to run the jack compiler. */ public abstract class Main extends CommandLine { - @Nonnull - private static final String[] EXTRA_ARGS = new String[]{"-noExit"}; /** * Runs the jack compiler from the command line @@ -96,9 +94,6 @@ public abstract class Main extends CommandLine { parser.parseArgument(args); parser.stopOptionParsing(); - if (options.ecjArguments != null) { - parser.parseArgument(EXTRA_ARGS); - } return options; } diff --git a/jack/src/com/android/jack/frontend/java/JackBatchCompiler.java b/jack/src/com/android/jack/frontend/java/JackBatchCompiler.java index c87f8c8..f38a468 100644 --- a/jack/src/com/android/jack/frontend/java/JackBatchCompiler.java +++ b/jack/src/com/android/jack/frontend/java/JackBatchCompiler.java @@ -61,9 +61,6 @@ public class JackBatchCompiler extends Main { } @Nonnull - public static final String JACK_LOGICAL_PATH_ENTRY = "<jack-logical-entry>"; - - @Nonnull private static final String USE_SINGLE_THREAD_SYSPROP = "jdt.compiler.useSingleThread"; @Nonnull @@ -78,12 +75,14 @@ public class JackBatchCompiler extends Main { public JackBatchCompiler(@Nonnull JSession session, @Nonnull JayceFileImporter jayceFileImporter) { - super(new PrintWriter(System.out), new PrintWriter(System.err), true, null, null); + super(new PrintWriter(System.out), new PrintWriter(System.err), + false /* systemExitWhenFinished */, null /* customDefaultOptions */, + null /* compilationProgress */); this.session = session; jayceImporter = jayceFileImporter; } - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({"rawtypes"}) @Override protected void addNewEntry(ArrayList paths, String currentClasspathName, @@ -102,8 +101,6 @@ public class JackBatchCompiler extends Main { destPath, isSourceOnly, rejectDestinationPathOnJars); - } else if (JACK_LOGICAL_PATH_ENTRY.equals(currentClasspathName)) { - paths.add(new JAstClasspath(currentClasspathName, session.getLookup(), null)); } else { /* Call super so that it make the required checks and prepare ClasspathDex @@ -206,4 +203,11 @@ public class JackBatchCompiler extends Main { } logger.printStats(); } + + @Override + public void configure(String[] argv) { + super.configure(argv); + checkedClasspaths = new FileSystem.Classpath[] { + new JAstClasspath("<jack-logical-entry>", session.getLookup(), null)}; + } } diff --git a/jack/tests/com/android/jack/AnnotationTestTools.java b/jack/tests/com/android/jack/AnnotationTestTools.java index 344aada..1152cbb 100644 --- a/jack/tests/com/android/jack/AnnotationTestTools.java +++ b/jack/tests/com/android/jack/AnnotationTestTools.java @@ -46,8 +46,7 @@ public class AnnotationTestTools { proguardFlags, false /* withDebugInfo */); - Options refOptions = TestTools.buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList, - true /* useOnlyCompatibleOptions */); + Options refOptions = TestTools.buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList); compareDexToReference(jackDex, refOptions, diff --git a/jack/tests/com/android/jack/TestTools.java b/jack/tests/com/android/jack/TestTools.java index 6f37c04..a61685e 100644 --- a/jack/tests/com/android/jack/TestTools.java +++ b/jack/tests/com/android/jack/TestTools.java @@ -219,7 +219,7 @@ public class TestTools { } else { options.jayceOutDir = out; } - options.ecjArguments = buildEcjArgs(false); + options.ecjArguments = buildEcjArgs(); addFile(sourceFolderOrSourceList, options.ecjArguments); options.emitLocalDebugInfo = withDebugInfos; Jack.run(options); @@ -281,7 +281,7 @@ public class TestTools { @CheckForNull JarJarRules jarjarRules, @CheckForNull ProguardFlags[] flagFiles, boolean withDebugInfo) throws Exception { - options.ecjArguments = buildEcjArgs(false); + options.ecjArguments = buildEcjArgs(); addFile(sourceFolderOrSourceList, options.ecjArguments); options.classpath = classpath; if (zip) { @@ -387,15 +387,10 @@ public class TestTools { } @Nonnull - protected static List<String> buildEcjArgs( - boolean useOnlyCompatible) { + protected static List<String> buildEcjArgs() { List<String> ecjArgs = new ArrayList<String>(); ecjArgs.add("-nowarn"); - if (!useOnlyCompatible) { - ecjArgs.add("-noExit"); - } - return ecjArgs; } @@ -423,7 +418,7 @@ public class TestTools { public static Options buildCommandLineArgs(@Nonnull File fileOrSourcelist, @CheckForNull File jarjarRules) { Options options = buildCommandLineArgs(null /* bootclasspath */, null /* classpath */, - new File[]{fileOrSourcelist}, false /* useOnlyCompatibleOptions */); + new File[]{fileOrSourcelist}); options.jarjarRulesFile = jarjarRules; return options; @@ -432,7 +427,7 @@ public class TestTools { @Nonnull public static Options buildCommandLineArgs(@Nonnull File[] filesOrSourcelists) { return buildCommandLineArgs(null /* bootclasspath */, null /* classpath */, - filesOrSourcelists, false /* useOnlyCompatibleOptions */); + filesOrSourcelists); } @Nonnull @@ -440,16 +435,7 @@ public class TestTools { @CheckForNull File[] bootclasspath, @CheckForNull File[] classpath, @Nonnull File fileOrSourceList, @CheckForNull ProguardFlags[] proguardFlagsFiles, boolean runDxOptimizations, boolean emitDebugInfo) { - return buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList, proguardFlagsFiles, - runDxOptimizations, emitDebugInfo, false); - } - - @Nonnull - public static Options buildCommandLineArgs( - @CheckForNull File[] bootclasspath, @CheckForNull File[] classpath, - @Nonnull File fileOrSourceList, @CheckForNull ProguardFlags[] proguardFlagsFiles, - boolean runDxOptimizations, boolean emitDebugInfo, boolean useOnlyCompatibleOptions) { - Options options = buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList, useOnlyCompatibleOptions); + Options options = buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList); options.proguardFlagsFiles = new ArrayList<File>(); options.emitLocalDebugInfo = emitDebugInfo; if (runDxOptimizations) { @@ -467,15 +453,12 @@ public class TestTools { @Nonnull public static Options buildCommandLineArgs(@CheckForNull File[] bootclasspath, - @CheckForNull File[] classpath, @Nonnull File fileOrSourcelist, - boolean useOnlyCompatibleOptions) { - return buildCommandLineArgs(bootclasspath, classpath, new File[]{fileOrSourcelist}, - useOnlyCompatibleOptions); + @CheckForNull File[] classpath, @Nonnull File fileOrSourcelist) { + return buildCommandLineArgs(bootclasspath, classpath, new File[]{fileOrSourcelist}); } @Nonnull public static Options buildCommandLineArgs(@CheckForNull File[] bootclasspath, - @CheckForNull File[] classpath, @Nonnull File[] filesOrSourcelists, - boolean useOnlyCompatibleOptions) { + @CheckForNull File[] classpath, @Nonnull File[] filesOrSourcelists) { Options options = new Options(); if (bootclasspath == null) { @@ -493,7 +476,7 @@ public class TestTools { options.classpath = classpathStr; } - List<String> ecjArgs = buildEcjArgs(useOnlyCompatibleOptions); + List<String> ecjArgs = buildEcjArgs(); for (File file : filesOrSourcelists) { addFile(file, ecjArgs); } @@ -503,12 +486,6 @@ public class TestTools { } @Nonnull - public static Options buildCommandLineArgs( - @CheckForNull File[] bootclasspath, @CheckForNull File[] classpath, @Nonnull File fileOrSourceList) { - return buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList, false); - } - - @Nonnull public static JSession buildJAst(@Nonnull Options options) throws Exception { RunnableHooks hooks = new RunnableHooks(); try { @@ -649,8 +626,7 @@ public class TestTools { proguardFlagFiles, withDebugInfo); - Options refOptions = buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList, - true /* useOnlyCompatibleOptions */); + Options refOptions = buildCommandLineArgs(bootclasspath, classpath, fileOrSourceList); TestTools.compareDexToReference(jackDex, refOptions, diff --git a/jack/tests/com/android/jack/experimental/incremental/IncrementalTestingEnvironment.java b/jack/tests/com/android/jack/experimental/incremental/IncrementalTestingEnvironment.java index 75e54f5..8f1c1c6 100644 --- a/jack/tests/com/android/jack/experimental/incremental/IncrementalTestingEnvironment.java +++ b/jack/tests/com/android/jack/experimental/incremental/IncrementalTestingEnvironment.java @@ -212,7 +212,7 @@ public class IncrementalTestingEnvironment extends TestTools { @Nonnull File sourceFolderOrSourceList, @CheckForNull String classpath, @Nonnull File out) throws Exception { - options.setEcjArguments(TestTools.buildEcjArgs(false)); + options.setEcjArguments(TestTools.buildEcjArgs()); addFile(sourceFolderOrSourceList, options.getEcjArguments()); options.setClasspath(classpath); options.setOutputFile(out); |