Add support for setting Android platform build flag in tests
Change-Id: Ic8c42f3b57b82638f6bc4797022079f23ea4c3e6
diff --git a/src/main/java/com/android/tools/r8/dump/DumpOptions.java b/src/main/java/com/android/tools/r8/dump/DumpOptions.java
index 3e87ab7..f2beb28 100644
--- a/src/main/java/com/android/tools/r8/dump/DumpOptions.java
+++ b/src/main/java/com/android/tools/r8/dump/DumpOptions.java
@@ -209,6 +209,9 @@
private static void parseKeyValue(Builder builder, String key, String value) {
switch (key) {
+ case ANDROID_PLATFORM_BUILD:
+ builder.setAndroidPlatformBuild(Boolean.parseBoolean(value));
+ return;
case BACKEND_KEY:
builder.setBackend(Backend.valueOf(value));
return;
diff --git a/src/test/testbase/java/com/android/tools/r8/R8TestBuilder.java b/src/test/testbase/java/com/android/tools/r8/R8TestBuilder.java
index 7ef9b00..066e1ff 100644
--- a/src/test/testbase/java/com/android/tools/r8/R8TestBuilder.java
+++ b/src/test/testbase/java/com/android/tools/r8/R8TestBuilder.java
@@ -95,6 +95,7 @@
private Path resourceShrinkerOutput = null;
private HashMap<String, Path> resourceShrinkerOutputForFeatures = new HashMap<>();
private Box<R8BuildMetadata> buildMetadata;
+ private boolean androidPlatformBuild = false;
@Override
public boolean isR8TestBuilder() {
@@ -141,6 +142,7 @@
ToolHelper.addSyntheticProguardRulesConsumerForTesting(
builder, rules -> box.syntheticProguardRules = rules);
libraryDesugaringTestConfiguration.configure(builder);
+ builder.setAndroidPlatformBuild(androidPlatformBuild);
if (!enableEmptyMemberRulesToDefaultInitRuleConversion.isUnknown()) {
builder.setEnableEmptyMemberRulesToDefaultInitRuleConversion(
enableEmptyMemberRulesToDefaultInitRuleConversion.toBoolean());
@@ -1054,4 +1056,9 @@
buildMetadata = new Box<>();
return self();
}
+
+ public T setAndroidPlatformBuild() {
+ androidPlatformBuild = true;
+ return self();
+ }
}