Add more options to tools/compiledump.py
* Add --enable-test-assertions to enable test assertions. This is no
longer the default
* Add option for passing JVM options
One use case for passing JVM options to only enable assertions for a
specific class:
tools/compiledump.py \
--disable_assertions \
-J-ea:com.android.tools.r8.ir.optimize.DeadCodeRemover \
...
Bug: b/312926551
Change-Id: Ib1eb4d72fd9acca6f84f2401128742246794dba6
diff --git a/tools/compiledump.py b/tools/compiledump.py
index ce09db8..3abe651 100755
--- a/tools/compiledump.py
+++ b/tools/compiledump.py
@@ -95,6 +95,21 @@
'Disable Java assertions when running the compiler (default enabled)',
default=False,
action='store_true')
+ parser.add_argument(
+ '--enable-test-assertions',
+ '--enable_test_assertions',
+ help=
+ 'Enable additional test assertions when running the compiler (default disabled)',
+ default=False,
+ action='store_true')
+ parser.add_argument(
+ '--java-opts',
+ '--java-opts',
+ '-J',
+ metavar='<JVM argument(s)>',
+ default=[],
+ action='append',
+ help='Additional options to pass to JVM invocation')
parser.add_argument('--classfile',
help='Run with classfile output',
default=False,
@@ -559,6 +574,7 @@
cmd.append('-Xmx' + args.xmx)
if not args.disable_assertions:
cmd.append('-ea')
+ if args.enable_test_assertions:
cmd.append('-Dcom.android.tools.r8.enableTestAssertions=1')
if args.print_times:
cmd.append('-Dcom.android.tools.r8.printtimes=1')
@@ -567,6 +583,7 @@
if hasattr(args, 'properties'):
cmd.extend(args.properties)
cmd.extend(determine_properties(build_properties))
+ cmd.extend(args.java_opts)
cmd.extend(['-cp', '%s:%s' % (temp, jar)])
if compiler == 'd8':
prepare_d8_wrapper(jar, temp, jdkhome)