Ignore Proguard option -target
This doesn't apply since R/D8 don't emit class files
Change-Id: Ib8bbc85bd69cd465b912a6aed0b8d4fb6d9edca1
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java b/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
index 2b086ae..c37948c 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardConfigurationParser.java
@@ -37,7 +37,9 @@
private final DexItemFactory dexItemFactory;
private static final List<String> ignoredSingleArgOptions = ImmutableList
- .of("protomapping", "optimizationpasses");
+ .of("protomapping",
+ "optimizationpasses",
+ "target");
private static final List<String> ignoredFlagOptions = ImmutableList
.of("forceprocessing", "dontusemixedcaseclassnames",
"dontpreverify", "experimentalshrinkunusedprotofields",
diff --git a/src/test/java/com/android/tools/r8/shaking/ProguardConfigurationParserTest.java b/src/test/java/com/android/tools/r8/shaking/ProguardConfigurationParserTest.java
index 115f1f9..727d533 100644
--- a/src/test/java/com/android/tools/r8/shaking/ProguardConfigurationParserTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/ProguardConfigurationParserTest.java
@@ -63,6 +63,8 @@
VALID_PROGUARD_DIR + "skipnonpubliclibraryclasses.flags";
private static final String PARSE_AND_SKIP_SINGLE_ARGUMENT =
VALID_PROGUARD_DIR + "parse-and-skip-single-argument.flags";
+ private static final String TARGET =
+ VALID_PROGUARD_DIR + "target.flags";
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -344,6 +346,13 @@
}
@Test
+ public void parseTarget()
+ throws IOException, ProguardRuleParserException {
+ ProguardConfigurationParser parser = new ProguardConfigurationParser(new DexItemFactory());
+ parser.parse(Paths.get(TARGET));
+ }
+
+ @Test
public void parseInvalidKeepClassOption() throws IOException, ProguardRuleParserException {
thrown.expect(ProguardRuleParserException.class);
thrown.expectMessage("Unknown option at ");
diff --git a/src/test/proguard/valid/target.flags b/src/test/proguard/valid/target.flags
new file mode 100644
index 0000000..3b9154d
--- /dev/null
+++ b/src/test/proguard/valid/target.flags
@@ -0,0 +1,6 @@
+# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+-target 1.7
+-target 8