Determine compiler for compiling dump from build.properties
Change-Id: Ief3a66ff803550b58c0688c87e7287faabaa9057
diff --git a/tools/compiledump.py b/tools/compiledump.py
index e8070da..504496e 100755
--- a/tools/compiledump.py
+++ b/tools/compiledump.py
@@ -209,12 +209,21 @@
return dump.version()
return args.version
-def determine_compiler(args, dump):
+def determine_compiler(args, build_properties):
compilers = ['d8', 'r8', 'r8full', 'l8']
- if args.compiler not in compilers:
+ compiler = args.compiler
+ if not compiler and 'tool' in build_properties:
+ compiler = build_properties.get('tool').lower()
+ if (compiler == 'r8'):
+ if not 'force-proguard-compatibility' in build_properties:
+ error("Unable to determine R8 compiler variant from build.properties."
+ " No value for 'force-proguard-compatibility'.")
+ if build_properties.get('force-proguard-compatibility').lower() == 'false':
+ compiler = compiler + 'full'
+ if compiler not in compilers:
error("Unable to determine a compiler to use. Specified %s,"
" Valid options: %s" % (args.compiler, ', '.join(compilers)))
- return args.compiler
+ return compiler
def determine_output(args, temp):
return os.path.join(temp, 'out.jar')
@@ -295,7 +304,7 @@
print("WARNING: Unexpected lack of library classes in dump")
build_properties = determine_build_properties(args, dump)
version = determine_version(args, dump)
- compiler = determine_compiler(args, dump)
+ compiler = determine_compiler(args, build_properties)
out = determine_output(args, temp)
min_api = determine_min_api(args, build_properties)
classfile = determine_class_file(args, build_properties)