Add programs to compare R8 and ProGuard output sizes

The script r8lib_size_compare.py runs R8 and ProGuard on r8.jar to
produce a minified r8lib.jar that keeps everything marked @Keep.

By default, inlining is disabled in both R8 and ProGuard to make
method-by-method comparison much easier. Pass --inlining to enable
inlining.

By default, the script only shows methods where R8's DEX output is 5 or
more instructions larger than ProGuard+D8's output. Pass --threshold 0
to display all methods.

* Pass extra keyword arguments from build_r8lib() to toolhelper.run() to
  allow disabling inlining in R8 by passing the system property
  -Dcom.android.tools.r8.disableinlining=1 to the JVM.

Change-Id: I35e2b0742c39a4a09aa61bc2bbc857cca8594843
diff --git a/tools/build_r8lib.py b/tools/build_r8lib.py
index c855bc5..4b7473e 100755
--- a/tools/build_r8lib.py
+++ b/tools/build_r8lib.py
@@ -25,16 +25,21 @@
 ANDROID_JAR = 'third_party/android_jar/lib-v%s/android.jar' % API_LEVEL
 
 
-def build_r8lib():
+def build_r8lib(output_path=None, output_map=None, **kwargs):
+  if output_path is None:
+    output_path = R8LIB_JAR
+  if output_map is None:
+    output_map = R8LIB_MAP_FILE
   toolhelper.run(
       'r8',
       ('--release',
        '--classfile',
        '--lib', utils.RT_JAR,
        utils.R8_JAR,
-       '--output', R8LIB_JAR,
+       '--output', output_path,
        '--pg-conf', utils.R8LIB_KEEP_RULES,
-       '--pg-map-output', R8LIB_MAP_FILE))
+       '--pg-map-output', output_map),
+      **kwargs)
 
 
 def test_d8sample():