Prune -libraryjars, -injars and print statements from compiledump inputs
Change-Id: I957f1c592371e4c4d9a3a84c0caf4c0e073299da
diff --git a/tools/compiledump.py b/tools/compiledump.py
index 83bc2aa..e8070da 100755
--- a/tools/compiledump.py
+++ b/tools/compiledump.py
@@ -252,6 +252,19 @@
utils.download_file_from_cloud_storage(source, dest)
return dest
+
+def clean_config(file):
+ with open(file) as f:
+ lines = f.readlines()
+ with open(file, 'w') as f:
+ for line in lines:
+ if ('-injars' not in line and '-libraryjars' not in line and
+ '-print' not in line):
+ f.write(line)
+ else:
+ print('Removing from config line: \n%s' % line)
+
+
def prepare_wrapper(dist, temp, jdkhome):
wrapper_file = os.path.join(
utils.REPO_ROOT,
@@ -329,6 +342,10 @@
if compiler != 'd8' and dump.config_file():
if hasattr(args, 'config_file_consumer') and args.config_file_consumer:
args.config_file_consumer(dump.config_file())
+ else:
+ # If we get a dump from the wild we can't use -injars, -libraryjars or
+ # -print{mapping,usage}
+ clean_config(dump.config_file())
cmd.extend(['--pg-conf', dump.config_file()])
if dump.main_dex_rules_resource():
cmd.extend(['--main-dex-rules', dump.main_dex_rules_resource()])