Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file |
| 3 | # for details. All rights reserved. Use of this source code is governed by a |
| 4 | # BSD-style license that can be found in the LICENSE file. |
| 5 | |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 6 | from __future__ import print_function |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 7 | from glob import glob |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 8 | import copy |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 9 | import optparse |
| 10 | import os |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 11 | import sys |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 12 | import time |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 13 | |
Søren Gjesse | 5ecb04a | 2017-06-13 09:44:32 +0200 | [diff] [blame] | 14 | import gmail_data |
Ian Zerny | 877c186 | 2017-07-06 11:12:26 +0200 | [diff] [blame] | 15 | import gmscore_data |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 16 | import golem |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 17 | import toolhelper |
Ian Zerny | 877c186 | 2017-07-06 11:12:26 +0200 | [diff] [blame] | 18 | import utils |
| 19 | import youtube_data |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 20 | import chrome_data |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 21 | |
| 22 | TYPES = ['dex', 'deploy', 'proguarded'] |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 23 | APPS = ['gmscore', 'youtube', 'gmail', 'chrome'] |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 24 | COMPILERS = ['d8', 'r8'] |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 25 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 26 | def ParseOptions(argv): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 27 | result = optparse.OptionParser() |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 28 | result.add_option('--compiler', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 29 | help='The compiler to use', |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 30 | choices=COMPILERS) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 31 | result.add_option('--app', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 32 | help='What app to run on', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 33 | choices=APPS) |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 34 | result.add_option('--run-all', |
| 35 | help='Compile all possible combinations', |
| 36 | default=False, |
| 37 | action='store_true') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 38 | result.add_option('--type', |
Tamas Kenez | 3fdaabd | 2017-06-15 13:05:12 +0200 | [diff] [blame] | 39 | help='Default for R8: deploy, for D8: proguarded', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 40 | choices=TYPES) |
| 41 | result.add_option('--out', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 42 | help='Where to place the output', |
Rico Wind | e9485ba | 2018-10-01 07:04:16 +0200 | [diff] [blame^] | 43 | default=utils.BUILD) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 44 | result.add_option('--no-build', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 45 | help='Run without building first', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 46 | default=False, |
| 47 | action='store_true') |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 48 | result.add_option('--golem', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 49 | help='Running on golem, do not build or download', |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 50 | default=False, |
| 51 | action='store_true') |
Rico Wind | 139eece | 2018-09-25 09:42:09 +0200 | [diff] [blame] | 52 | result.add_option('--ignore-java-version', |
| 53 | help='Do not check java version', |
| 54 | default=False, |
| 55 | action='store_true') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 56 | result.add_option('--no-libraries', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 57 | help='Do not pass in libraries, even if they exist in conf', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 58 | default=False, |
| 59 | action='store_true') |
| 60 | result.add_option('--no-debug', |
| 61 | help='Run without debug asserts.', |
| 62 | default=False, |
| 63 | action='store_true') |
| 64 | result.add_option('--version', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 65 | help='The version of the app to run') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 66 | result.add_option('-k', |
| 67 | help='Override the default ProGuard keep rules') |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 68 | result.add_option('--compiler-flags', |
| 69 | help='Additional option(s) for the compiler. ' + |
| 70 | 'If passing several options use a quoted string.') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 71 | result.add_option('--r8-flags', |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 72 | help='Additional option(s) for the compiler. ' + |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 73 | 'Same as --compiler-flags, keeping it for backward' |
| 74 | ' compatibility. ' + |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 75 | 'If passing several options use a quoted string.') |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 76 | # TODO(tamaskenez) remove track-memory-to-file as soon as we updated golem |
| 77 | # to use --print-memoryuse instead |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 78 | result.add_option('--track-memory-to-file', |
| 79 | help='Track how much memory the jvm is using while ' + |
| 80 | ' compiling. Output to the specified file.') |
| 81 | result.add_option('--profile', |
| 82 | help='Profile R8 run.', |
| 83 | default=False, |
| 84 | action='store_true') |
| 85 | result.add_option('--dump-args-file', |
| 86 | help='Dump a file with the arguments for the specified ' + |
| 87 | 'configuration. For use as a @<file> argument to perform ' + |
| 88 | 'the run.') |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 89 | result.add_option('--print-runtimeraw', |
| 90 | metavar='BENCHMARKNAME', |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 91 | help='Print the line \'<BENCHMARKNAME>(RunTimeRaw):' + |
| 92 | ' <elapsed> ms\' at the end where <elapsed> is' + |
| 93 | ' the elapsed time in milliseconds.') |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 94 | result.add_option('--print-memoryuse', |
| 95 | metavar='BENCHMARKNAME', |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 96 | help='Print the line \'<BENCHMARKNAME>(MemoryUse):' + |
| 97 | ' <mem>\' at the end where <mem> is the peak' + |
| 98 | ' peak resident set size (VmHWM) in bytes.') |
| 99 | result.add_option('--print-dexsegments', |
| 100 | metavar='BENCHMARKNAME', |
| 101 | help='Print the sizes of individual dex segments as ' + |
| 102 | '\'<BENCHMARKNAME>-<segment>(CodeSize): <bytes>\'') |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 103 | return result.parse_args(argv) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 104 | |
Søren Gjesse | 5945958 | 2018-04-06 10:12:45 +0200 | [diff] [blame] | 105 | # Most apps have the -printmapping, -printseeds and -printusage in the |
| 106 | # Proguard configuration. However we don't want to write these files |
| 107 | # in the locations specified. Instead generate an auxiliary Proguard |
| 108 | # configuration placing these two output files together with the dex |
| 109 | # output. |
Søren Gjesse | 3a5aed9 | 2017-06-14 15:36:02 +0200 | [diff] [blame] | 110 | def GenerateAdditionalProguardConfiguration(temp, outdir): |
| 111 | name = "output.config" |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 112 | with open(os.path.join(temp, name), 'w') as f: |
| 113 | f.write('-printmapping ' + os.path.join(outdir, 'proguard.map') + "\n") |
| 114 | f.write('-printseeds ' + os.path.join(outdir, 'proguard.seeds') + "\n") |
Søren Gjesse | 5945958 | 2018-04-06 10:12:45 +0200 | [diff] [blame] | 115 | f.write('-printusage ' + os.path.join(outdir, 'proguard.usage') + "\n") |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 116 | return os.path.abspath(f.name) |
Søren Gjesse | 3a5aed9 | 2017-06-14 15:36:02 +0200 | [diff] [blame] | 117 | |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 118 | # Please add bug number for disabled permutations and please explicitly |
| 119 | # do Bug: #BUG in the commit message of disabling to ensure re-enabling |
| 120 | DISABLED_PERMUTATIONS = [ |
| 121 | ('youtube', '12.10', 'dex'), # b/116089492 |
Rico Wind | 2a19d93 | 2018-09-25 16:48:56 +0200 | [diff] [blame] | 122 | ('youtube', '12.10', 'proguarded'), # b/116089492 |
Rico Wind | d5a3607 | 2018-09-25 14:38:01 +0200 | [diff] [blame] | 123 | ('gmscore', 'latest', 'deploy') # b/116575775 |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 124 | ] |
| 125 | |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 126 | def get_permutations(): |
| 127 | data_providers = { |
| 128 | 'gmscore': gmscore_data, |
| 129 | 'youtube': youtube_data, |
| 130 | 'chrome': chrome_data, |
| 131 | 'gmail': gmail_data |
| 132 | } |
| 133 | # Check to ensure that we add all variants here. |
| 134 | assert len(APPS) == len(data_providers) |
| 135 | for app, data in data_providers.iteritems(): |
| 136 | for version in data.VERSIONS: |
| 137 | for type in data.VERSIONS[version]: |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 138 | if (app, version, type) not in DISABLED_PERMUTATIONS: |
| 139 | yield app, version, type |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 140 | |
| 141 | def run_all(options, args): |
| 142 | # Args will be destroyed |
| 143 | assert len(args) == 0 |
| 144 | for name, version, type in get_permutations(): |
| 145 | print('Execution %s %s %s' % (name, version, type)) |
| 146 | compiler = 'r8' if type == 'deploy' else 'd8' |
| 147 | fixed_options = copy.copy(options) |
| 148 | fixed_options.app = name |
| 149 | fixed_options.version = version |
| 150 | fixed_options.compiler = compiler |
| 151 | fixed_options.type = type |
| 152 | exit_code = run_with_options(fixed_options, []) |
| 153 | if exit_code != 0: |
| 154 | print('Failed %s %s %s with %s' % (name, version, type, compiler)) |
| 155 | exit(exit_code) |
| 156 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 157 | def main(argv): |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 158 | (options, args) = ParseOptions(argv) |
Rico Wind | 139eece | 2018-09-25 09:42:09 +0200 | [diff] [blame] | 159 | if not options.ignore_java_version: |
| 160 | utils.check_java_version() |
| 161 | |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 162 | if options.run_all: |
| 163 | return run_all(options, args) |
| 164 | return run_with_options(options, args) |
| 165 | |
| 166 | def run_with_options(options, args): |
| 167 | app_provided_pg_conf = False; |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 168 | if options.golem: |
| 169 | golem.link_third_party() |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 170 | outdir = options.out |
| 171 | data = None |
| 172 | if options.app == 'gmscore': |
| 173 | options.version = options.version or 'v9' |
| 174 | data = gmscore_data |
| 175 | elif options.app == 'youtube': |
Søren Gjesse | cc33fb4 | 2017-06-09 10:25:08 +0200 | [diff] [blame] | 176 | options.version = options.version or '12.22' |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 177 | data = youtube_data |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 178 | elif options.app == 'chrome': |
| 179 | options.version = options.version or 'default' |
| 180 | data = chrome_data |
Søren Gjesse | 5ecb04a | 2017-06-13 09:44:32 +0200 | [diff] [blame] | 181 | elif options.app == 'gmail': |
| 182 | options.version = options.version or '170604.16' |
| 183 | data = gmail_data |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 184 | else: |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 185 | raise Exception("You need to specify '--app={}'".format('|'.join(APPS))) |
| 186 | |
| 187 | if options.compiler not in COMPILERS: |
| 188 | raise Exception("You need to specify '--compiler={}'" |
| 189 | .format('|'.join(COMPILERS))) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 190 | |
| 191 | if not options.version in data.VERSIONS.keys(): |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 192 | print('No version {} for application {}' |
| 193 | .format(options.version, options.app)) |
| 194 | print('Valid versions are {}'.format(data.VERSIONS.keys())) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 195 | return 1 |
| 196 | |
| 197 | version = data.VERSIONS[options.version] |
| 198 | |
Tamas Kenez | 3fdaabd | 2017-06-15 13:05:12 +0200 | [diff] [blame] | 199 | if not options.type: |
| 200 | options.type = 'deploy' if options.compiler == 'r8' \ |
| 201 | else 'proguarded' |
| 202 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 203 | if options.type not in version: |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 204 | print('No type {} for version {}'.format(options.type, options.version)) |
| 205 | print('Valid types are {}'.format(version.keys())) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 206 | return 1 |
| 207 | values = version[options.type] |
| 208 | inputs = None |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 209 | # For R8 'deploy' the JAR is located using the Proguard configuration |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 210 | # -injars option. For chrome we don't have the injars in the proguard files. |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 211 | if 'inputs' in values and (options.compiler != 'r8' |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 212 | or options.type != 'deploy' |
| 213 | or options.app == 'chrome'): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 214 | inputs = values['inputs'] |
| 215 | |
| 216 | args.extend(['--output', outdir]) |
Ian Zerny | 877c186 | 2017-07-06 11:12:26 +0200 | [diff] [blame] | 217 | if 'min-api' in values: |
| 218 | args.extend(['--min-api', values['min-api']]) |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 219 | |
| 220 | if options.compiler == 'r8': |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 221 | if 'pgconf' in values and not options.k: |
| 222 | for pgconf in values['pgconf']: |
| 223 | args.extend(['--pg-conf', pgconf]) |
Søren Gjesse | da2ac8d | 2017-06-22 14:14:36 +0200 | [diff] [blame] | 224 | app_provided_pg_conf = True |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 225 | if options.k: |
| 226 | args.extend(['--pg-conf', options.k]) |
Søren Gjesse | c801ecc | 2017-08-03 13:40:06 +0200 | [diff] [blame] | 227 | if 'maindexrules' in values: |
| 228 | for rules in values['maindexrules']: |
| 229 | args.extend(['--main-dex-rules', rules]) |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 230 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 231 | if not options.no_libraries and 'libraries' in values: |
| 232 | for lib in values['libraries']: |
| 233 | args.extend(['--lib', lib]) |
| 234 | |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 235 | if not outdir.endswith('.zip') and not outdir.endswith('.jar') \ |
| 236 | and not os.path.exists(outdir): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 237 | os.makedirs(outdir) |
| 238 | |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 239 | if options.compiler == 'r8': |
| 240 | if 'r8-flags' in values: |
| 241 | args.extend(values['r8-flags'].split(' ')) |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 242 | |
| 243 | if options.compiler_flags: |
| 244 | args.extend(options.compiler_flags.split(' ')) |
| 245 | if options.r8_flags: |
| 246 | args.extend(options.r8_flags.split(' ')) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 247 | |
| 248 | if inputs: |
| 249 | args.extend(inputs) |
| 250 | |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 251 | t0 = time.time() |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 252 | if options.dump_args_file: |
| 253 | with open(options.dump_args_file, 'w') as args_file: |
| 254 | args_file.writelines([arg + os.linesep for arg in args]) |
| 255 | else: |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 256 | with utils.TempDir() as temp: |
| 257 | if options.print_memoryuse and not options.track_memory_to_file: |
| 258 | options.track_memory_to_file = os.path.join(temp, |
| 259 | utils.MEMORY_USE_TMP_FILE) |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 260 | if options.compiler == 'r8' and app_provided_pg_conf: |
| 261 | # Ensure that output of -printmapping and -printseeds go to the output |
| 262 | # location and not where the app Proguard configuration places them. |
| 263 | if outdir.endswith('.zip') or outdir.endswith('.jar'): |
| 264 | pg_outdir = os.path.dirname(outdir) |
| 265 | else: |
| 266 | pg_outdir = outdir |
| 267 | additional_pg_conf = GenerateAdditionalProguardConfiguration( |
| 268 | temp, os.path.abspath(pg_outdir)) |
| 269 | args.extend(['--pg-conf', additional_pg_conf]) |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 270 | build = not options.no_build and not options.golem |
Christoffer Quist Adamsen | 21c6660 | 2018-08-09 16:22:54 +0200 | [diff] [blame] | 271 | exit_code = toolhelper.run(options.compiler, args, |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 272 | build=build, |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 273 | debug=not options.no_debug, |
| 274 | profile=options.profile, |
Mathias Rav | a4042f5 | 2018-05-23 09:58:58 +0200 | [diff] [blame] | 275 | track_memory_file=options.track_memory_to_file) |
Christoffer Quist Adamsen | 21c6660 | 2018-08-09 16:22:54 +0200 | [diff] [blame] | 276 | if exit_code != 0: |
| 277 | return exit_code |
| 278 | |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 279 | if options.print_memoryuse: |
| 280 | print('{}(MemoryUse): {}' |
| 281 | .format(options.print_memoryuse, |
| 282 | utils.grep_memoryuse(options.track_memory_to_file))) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 283 | |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 284 | if options.print_runtimeraw: |
| 285 | print('{}(RunTimeRaw): {} ms' |
| 286 | .format(options.print_runtimeraw, 1000.0 * (time.time() - t0))) |
| 287 | |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 288 | if options.print_dexsegments: |
| 289 | dex_files = glob(os.path.join(outdir, '*.dex')) |
| 290 | utils.print_dexsegments(options.print_dexsegments, dex_files) |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 291 | return 0 |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 292 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 293 | if __name__ == '__main__': |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 294 | sys.exit(main(sys.argv[1:])) |