Tools: Switch from JAR-per-tool to a single swiss army knife
Introduce SwissArmyKnife entrypoint that defers to the different
entrypoints based on the first argument, defaulting to R8.main()
if the first argument is not recognized as the name of a tool.
In build.gradle, change tasks for D8, CompatDx and CompatProguard
to simply repackaging the R8 JAR but with a different Main-Class.
Remove gradle tasks for DexFileMerger, DexSplitter, D8Logger, disasm,
bisect, DexSegments, maindex, ExtractMarker, jardiff.
Introduce toolhelper.py with a run() method that runs the swiss army
knife. Change r8.py, d8.py, compatdx.py nad bisect.py to use
toolhelper.run(), and add Python scripts compatproguard, d8logger,
dexfilemerger, dexsegments, dexsplitter, disasm, extractmarker, jardiff,
maindex that use toolhelper.run().
Make archive.py use subprocess.check_output() directly instead of going
through r8.run() and d8.run() to get the versions.
Simplify run_on_app.py a bit by using toolhelper.run().
Change-Id: I752705188e728d2c4f7bfdc61b90448298eaa5bd
diff --git a/tools/run-d8-on-gmscore.py b/tools/run-d8-on-gmscore.py
index 63865d0..b1bdc6e 100755
--- a/tools/run-d8-on-gmscore.py
+++ b/tools/run-d8-on-gmscore.py
@@ -3,11 +3,11 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-import d8
import gmscore_data
import optparse
import os
import sys
+import toolhelper
def ParseOptions():
result = optparse.OptionParser()
@@ -70,8 +70,13 @@
with open(options.dump_args_file, 'w') as args_file:
args_file.writelines([arg + os.linesep for arg in args])
else:
- d8.run(args, not options.no_build, not options.no_debug, options.profile,
- options.track_memory_to_file)
+ toolhelper.run(
+ 'd8',
+ args,
+ build=not options.no_build,
+ debug=not options.no_debug,
+ profile=options.profile,
+ track_memory_to_file=options.track_memory_to_file)
if __name__ == '__main__':
sys.exit(main())