Forward --horizontal-class-merging from test.py to InternalOptions
Change-Id: I636dd1d1c042c0aaa7a08f644f06d8b7b5c6dc04
diff --git a/build.gradle b/build.gradle
index c47befd..b7c7830 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1939,6 +1939,11 @@
systemProperty 'runtimes', project.property('runtimes')
}
+ if (project.hasProperty('horizontalClassMerging')) {
+ println "NOTE: Running with horizontal class merging"
+ systemProperty 'com.android.tools.r8.horizontalClassMerging', 'true'
+ }
+
if (project.hasProperty('slow_tests')) {
systemProperty 'slow_tests', project.property('slow_tests')
}
diff --git a/src/main/java/com/android/tools/r8/D8Command.java b/src/main/java/com/android/tools/r8/D8Command.java
index 9e462dd..84bc9b3 100644
--- a/src/main/java/com/android/tools/r8/D8Command.java
+++ b/src/main/java/com/android/tools/r8/D8Command.java
@@ -398,6 +398,7 @@
// Assert some of R8 optimizations are disabled.
assert !internal.enableInlining;
assert !internal.enableClassInlining;
+ assert !internal.enableHorizontalClassMerging;
assert !internal.enableStaticClassMerging;
assert !internal.enableVerticalClassMerging;
assert !internal.enableClassStaticizer;
diff --git a/src/main/java/com/android/tools/r8/L8Command.java b/src/main/java/com/android/tools/r8/L8Command.java
index db24f23..221df4c 100644
--- a/src/main/java/com/android/tools/r8/L8Command.java
+++ b/src/main/java/com/android/tools/r8/L8Command.java
@@ -167,6 +167,7 @@
// Assert some of R8 optimizations are disabled.
assert !internal.enableInlining;
assert !internal.enableClassInlining;
+ assert !internal.enableHorizontalClassMerging;
assert !internal.enableStaticClassMerging;
assert !internal.enableVerticalClassMerging;
assert !internal.enableClassStaticizer;
diff --git a/src/main/java/com/android/tools/r8/R8Command.java b/src/main/java/com/android/tools/r8/R8Command.java
index 7c78db1..0375b6b 100644
--- a/src/main/java/com/android/tools/r8/R8Command.java
+++ b/src/main/java/com/android/tools/r8/R8Command.java
@@ -845,6 +845,7 @@
? LineNumberOptimization.ON
: LineNumberOptimization.OFF;
+ assert proguardConfiguration.isOptimizing() || !internal.enableHorizontalClassMerging;
assert internal.enableStaticClassMerging || !proguardConfiguration.isOptimizing();
assert !internal.enableTreeShakingOfLibraryMethodOverrides;
assert internal.enableVerticalClassMerging || !proguardConfiguration.isOptimizing();
@@ -854,6 +855,7 @@
internal.getProguardConfiguration().getKeepAttributes().localVariableTypeTable = true;
internal.enableInlining = false;
internal.enableClassInlining = false;
+ internal.enableHorizontalClassMerging = false;
internal.enableStaticClassMerging = false;
internal.enableVerticalClassMerging = false;
internal.enableClassStaticizer = false;
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index cdd3ca3..a7481b7 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -186,6 +186,7 @@
enableClassStaticizer = false;
enableDevirtualization = false;
enableLambdaMerging = false;
+ enableHorizontalClassMerging = false;
enableStaticClassMerging = false;
enableVerticalClassMerging = false;
enableEnumUnboxing = false;
@@ -220,7 +221,8 @@
public boolean enableFieldBitAccessAnalysis =
System.getProperty("com.android.tools.r8.fieldBitAccessAnalysis") != null;
public boolean enableStaticClassMerging = true;
- public boolean enableHorizontalClassMerging = false;
+ public boolean enableHorizontalClassMerging =
+ System.getProperty("com.android.tools.r8.horizontalClassMerging") != null;
public boolean enableVerticalClassMerging = true;
public boolean enableArgumentRemoval = true;
public boolean enableUnusedInterfaceRemoval = true;
diff --git a/tools/test.py b/tools/test.py
index 654ceaa..27f15a8 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -162,13 +162,12 @@
def Main():
(options, args) = ParseOptions()
- if options.horizontal_class_merging:
- # This flag is in preperation of running horizontal class merging
- # but currently is the same as the default tests. Don't run to
- # save resources on the bots.
- return 0
-
if utils.is_bot():
+ if options.horizontal_class_merging:
+ # This flag is in preparation of running horizontal class merging
+ # but currently is the same as the default tests. Don't run to
+ # save resources on the bots.
+ return 0
gradle.RunGradle(['--no-daemon', 'clean'])
gradle_args = ['--stacktrace']
@@ -297,6 +296,9 @@
return_code = gradle.RunGradle(gradle_args, throw_on_failure=False)
return archive_and_return(return_code, options)
+ if options.horizontal_class_merging:
+ gradle_args.append('-PhorizontalClassMerging')
+
# Now run tests on selected runtime(s).
if options.runtimes:
if options.dex_vm != 'default':