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 |
Christoffer Quist Adamsen | a2a5877 | 2018-10-03 09:47:46 +0200 | [diff] [blame] | 17 | import nest_data |
Søren Gjesse | cbeae78 | 2019-05-21 14:14:25 +0200 | [diff] [blame] | 18 | from sanitize_libraries import SanitizeLibraries |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 19 | import toolhelper |
Ian Zerny | 877c186 | 2017-07-06 11:12:26 +0200 | [diff] [blame] | 20 | import utils |
| 21 | import youtube_data |
Rico Wind | 86bfc83 | 2018-09-18 07:48:21 +0200 | [diff] [blame] | 22 | import chrome_data |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 23 | import r8_data |
Morten Krogh-Jespersen | cd6712c | 2019-10-09 13:09:47 +0200 | [diff] [blame] | 24 | import iosched_data |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 25 | |
| 26 | TYPES = ['dex', 'deploy', 'proguarded'] |
Morten Krogh-Jespersen | cd6712c | 2019-10-09 13:09:47 +0200 | [diff] [blame] | 27 | APPS = ['gmscore', 'nest', 'youtube', 'gmail', 'chrome', 'r8', 'iosched'] |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 28 | COMPILERS = ['d8', 'r8'] |
| 29 | COMPILER_BUILDS = ['full', 'lib'] |
| 30 | |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 31 | # We use this magic exit code to signal that the program OOM'ed |
| 32 | OOM_EXIT_CODE = 42 |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 33 | # According to Popen.returncode doc: |
| 34 | # A negative value -N indicates that the child was terminated by signal N. |
| 35 | TIMEOUT_KILL_CODE = -9 |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 36 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 37 | # Log file names |
| 38 | FIND_MIN_XMX_FILE = 'find_min_xmx_results' |
| 39 | FIND_MIN_XMX_DIR = 'find_min_xmx' |
| 40 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 41 | def ParseOptions(argv): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 42 | result = optparse.OptionParser() |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 43 | result.add_option('--compiler', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 44 | help='The compiler to use', |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 45 | choices=COMPILERS) |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 46 | result.add_option('--compiler-build', |
| 47 | help='Compiler build to use', |
| 48 | choices=COMPILER_BUILDS, |
| 49 | default='lib') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 50 | result.add_option('--app', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 51 | help='What app to run on', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 52 | choices=APPS) |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 53 | result.add_option('--run-all', |
| 54 | help='Compile all possible combinations', |
| 55 | default=False, |
| 56 | action='store_true') |
Morten Krogh-Jespersen | b7e1a18 | 2019-10-09 13:04:54 +0200 | [diff] [blame] | 57 | result.add_option('--expect-oom', |
| 58 | help='Expect that compilation will fail with an OOM', |
| 59 | default=False, |
| 60 | action='store_true') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 61 | result.add_option('--type', |
Tamas Kenez | 3fdaabd | 2017-06-15 13:05:12 +0200 | [diff] [blame] | 62 | help='Default for R8: deploy, for D8: proguarded', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 63 | choices=TYPES) |
| 64 | result.add_option('--out', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 65 | help='Where to place the output', |
Rico Wind | e9485ba | 2018-10-01 07:04:16 +0200 | [diff] [blame] | 66 | default=utils.BUILD) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 67 | result.add_option('--no-build', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 68 | help='Run without building first', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 69 | default=False, |
| 70 | action='store_true') |
Morten Krogh-Jespersen | 322c2f1 | 2019-10-08 10:41:21 +0200 | [diff] [blame] | 71 | result.add_option('--max-memory', |
| 72 | help='The maximum memory in MB to run with', |
| 73 | type='int') |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 74 | result.add_option('--find-min-xmx', |
| 75 | help='Find the minimum amount of memory we can run in', |
| 76 | default=False, |
| 77 | action='store_true') |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 78 | result.add_option('--find-min-xmx-min-memory', |
| 79 | help='Setting the minimum memory baseline to run in', |
| 80 | type='int') |
| 81 | result.add_option('--find-min-xmx-max-memory', |
| 82 | help='Setting the maximum memory baseline to run in', |
| 83 | type='int') |
| 84 | result.add_option('--find-min-xmx-range-size', |
| 85 | help='Setting the size of the acceptable memory range', |
| 86 | type='int', |
| 87 | default=32) |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 88 | result.add_option('--find-min-xmx-archive', |
| 89 | help='Archive find-min-xmx results on GCS', |
| 90 | default=False, |
| 91 | action='store_true') |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 92 | result.add_option('--timeout', |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 93 | type='int', |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 94 | default=0, |
| 95 | help='Set timeout instead of waiting for OOM.') |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 96 | result.add_option('--golem', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 97 | help='Running on golem, do not build or download', |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 98 | default=False, |
| 99 | action='store_true') |
Rico Wind | 139eece | 2018-09-25 09:42:09 +0200 | [diff] [blame] | 100 | result.add_option('--ignore-java-version', |
| 101 | help='Do not check java version', |
| 102 | default=False, |
| 103 | action='store_true') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 104 | result.add_option('--no-libraries', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 105 | help='Do not pass in libraries, even if they exist in conf', |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 106 | default=False, |
| 107 | action='store_true') |
| 108 | result.add_option('--no-debug', |
| 109 | help='Run without debug asserts.', |
| 110 | default=False, |
| 111 | action='store_true') |
| 112 | result.add_option('--version', |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 113 | help='The version of the app to run') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 114 | result.add_option('-k', |
| 115 | help='Override the default ProGuard keep rules') |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 116 | result.add_option('--compiler-flags', |
| 117 | help='Additional option(s) for the compiler. ' + |
| 118 | 'If passing several options use a quoted string.') |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 119 | result.add_option('--r8-flags', |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 120 | help='Additional option(s) for the compiler. ' + |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 121 | 'Same as --compiler-flags, keeping it for backward' |
| 122 | ' compatibility. ' + |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 123 | 'If passing several options use a quoted string.') |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 124 | # TODO(tamaskenez) remove track-memory-to-file as soon as we updated golem |
| 125 | # to use --print-memoryuse instead |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 126 | result.add_option('--track-memory-to-file', |
| 127 | help='Track how much memory the jvm is using while ' + |
| 128 | ' compiling. Output to the specified file.') |
| 129 | result.add_option('--profile', |
| 130 | help='Profile R8 run.', |
| 131 | default=False, |
| 132 | action='store_true') |
| 133 | result.add_option('--dump-args-file', |
| 134 | help='Dump a file with the arguments for the specified ' + |
| 135 | 'configuration. For use as a @<file> argument to perform ' + |
| 136 | 'the run.') |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 137 | result.add_option('--print-runtimeraw', |
| 138 | metavar='BENCHMARKNAME', |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 139 | help='Print the line \'<BENCHMARKNAME>(RunTimeRaw):' + |
| 140 | ' <elapsed> ms\' at the end where <elapsed> is' + |
| 141 | ' the elapsed time in milliseconds.') |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 142 | result.add_option('--print-memoryuse', |
| 143 | metavar='BENCHMARKNAME', |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 144 | help='Print the line \'<BENCHMARKNAME>(MemoryUse):' + |
| 145 | ' <mem>\' at the end where <mem> is the peak' + |
| 146 | ' peak resident set size (VmHWM) in bytes.') |
| 147 | result.add_option('--print-dexsegments', |
| 148 | metavar='BENCHMARKNAME', |
| 149 | help='Print the sizes of individual dex segments as ' + |
| 150 | '\'<BENCHMARKNAME>-<segment>(CodeSize): <bytes>\'') |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 151 | result.add_option('--track-time-in-memory', |
| 152 | help='Plot the times taken from memory starting point to ' |
| 153 | 'end-point with defined memory increment', |
| 154 | default=False, |
| 155 | action='store_true') |
| 156 | result.add_option('--track-time-in-memory-max', |
| 157 | help='Setting the maximum memory baseline to run in', |
| 158 | type='int') |
| 159 | result.add_option('--track-time-in-memory-min', |
| 160 | help='Setting the minimum memory baseline to run in', |
| 161 | type='int') |
| 162 | result.add_option('--track-time-in-memory-increment', |
| 163 | help='Setting the increment', |
| 164 | type='int', |
| 165 | default=32) |
Morten Krogh-Jespersen | b7e1a18 | 2019-10-09 13:04:54 +0200 | [diff] [blame] | 166 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 167 | return result.parse_args(argv) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 168 | |
Man Cao | 29b9ef1 | 2019-03-25 11:19:35 -0700 | [diff] [blame] | 169 | # Most apps have -printmapping, -printseeds, -printusage and |
| 170 | # -printconfiguration in the Proguard configuration. However we don't |
| 171 | # want to write these files in the locations specified. |
| 172 | # Instead generate an auxiliary Proguard configuration placing these |
| 173 | # output files together with the dex output. |
Søren Gjesse | 3a5aed9 | 2017-06-14 15:36:02 +0200 | [diff] [blame] | 174 | def GenerateAdditionalProguardConfiguration(temp, outdir): |
| 175 | name = "output.config" |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 176 | with open(os.path.join(temp, name), 'w') as f: |
| 177 | f.write('-printmapping ' + os.path.join(outdir, 'proguard.map') + "\n") |
| 178 | f.write('-printseeds ' + os.path.join(outdir, 'proguard.seeds') + "\n") |
Søren Gjesse | 5945958 | 2018-04-06 10:12:45 +0200 | [diff] [blame] | 179 | f.write('-printusage ' + os.path.join(outdir, 'proguard.usage') + "\n") |
Man Cao | 29b9ef1 | 2019-03-25 11:19:35 -0700 | [diff] [blame] | 180 | f.write('-printconfiguration ' + os.path.join(outdir, 'proguard.config') + "\n") |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 181 | return os.path.abspath(f.name) |
Søren Gjesse | 3a5aed9 | 2017-06-14 15:36:02 +0200 | [diff] [blame] | 182 | |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 183 | # Please add bug number for disabled permutations and please explicitly |
| 184 | # do Bug: #BUG in the commit message of disabling to ensure re-enabling |
| 185 | DISABLED_PERMUTATIONS = [ |
Ian Zerny | d459b5f | 2018-10-03 06:46:21 +0200 | [diff] [blame] | 186 | # (app, version, type), e.g., ('gmail', '180826.15', 'deploy'), |
Rico Wind | ed78833 | 2018-12-14 10:39:20 +0100 | [diff] [blame] | 187 | ('youtube', '13.37', 'deploy'), # b/120977564 |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 188 | ] |
| 189 | |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 190 | def get_permutations(): |
| 191 | data_providers = { |
| 192 | 'gmscore': gmscore_data, |
Christoffer Quist Adamsen | a2a5877 | 2018-10-03 09:47:46 +0200 | [diff] [blame] | 193 | 'nest': nest_data, |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 194 | 'youtube': youtube_data, |
| 195 | 'chrome': chrome_data, |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 196 | 'gmail': gmail_data, |
Morten Krogh-Jespersen | cd6712c | 2019-10-09 13:09:47 +0200 | [diff] [blame] | 197 | 'r8': r8_data, |
| 198 | 'iosched': iosched_data, |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 199 | } |
| 200 | # Check to ensure that we add all variants here. |
| 201 | assert len(APPS) == len(data_providers) |
| 202 | for app, data in data_providers.iteritems(): |
| 203 | for version in data.VERSIONS: |
| 204 | for type in data.VERSIONS[version]: |
Rico Wind | 3f9302b | 2018-09-21 08:53:09 +0200 | [diff] [blame] | 205 | if (app, version, type) not in DISABLED_PERMUTATIONS: |
Tamas Kenez | a730a7e | 2018-12-10 15:02:28 +0100 | [diff] [blame] | 206 | for use_r8lib in [False, True]: |
| 207 | yield app, version, type, use_r8lib |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 208 | |
| 209 | def run_all(options, args): |
| 210 | # Args will be destroyed |
| 211 | assert len(args) == 0 |
Tamas Kenez | a730a7e | 2018-12-10 15:02:28 +0100 | [diff] [blame] | 212 | for name, version, type, use_r8lib in get_permutations(): |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 213 | compiler = 'r8' if type == 'deploy' else 'd8' |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 214 | compiler_build = 'lib' if use_r8lib else 'full' |
| 215 | print('Executing %s/%s with %s %s %s' % (compiler, compiler_build, name, |
| 216 | version, type)) |
Tamas Kenez | a730a7e | 2018-12-10 15:02:28 +0100 | [diff] [blame] | 217 | |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 218 | fixed_options = copy.copy(options) |
| 219 | fixed_options.app = name |
| 220 | fixed_options.version = version |
| 221 | fixed_options.compiler = compiler |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 222 | fixed_options.compiler_build = compiler_build |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 223 | fixed_options.type = type |
| 224 | exit_code = run_with_options(fixed_options, []) |
| 225 | if exit_code != 0: |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 226 | print('Failed %s %s %s with %s/%s' % (name, version, type, compiler, |
| 227 | compiler_build)) |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 228 | exit(exit_code) |
| 229 | |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 230 | def find_min_xmx(options, args): |
| 231 | # Args will be destroyed |
| 232 | assert len(args) == 0 |
| 233 | # If we can run in 128 MB then we are good (which we can for small examples |
| 234 | # or D8 on medium sized examples) |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 235 | if options.find_min_xmx_min_memory: |
| 236 | not_working = options.find_min_xmx_min_memory |
| 237 | elif options.compiler == 'd8': |
| 238 | not_working = 128 |
| 239 | else: |
| 240 | not_working = 1024 |
| 241 | if options.find_min_xmx_max_memory: |
| 242 | working = options.find_min_xmx_max_memory |
| 243 | else: |
| 244 | working = 1024 * 8 |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 245 | exit_code = 0 |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 246 | range = options.find_min_xmx_range_size |
| 247 | while working - not_working > range: |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 248 | next_candidate = working - ((working - not_working)/2) |
| 249 | print('working: %s, non_working: %s, next_candidate: %s' % |
| 250 | (working, not_working, next_candidate)) |
| 251 | extra_args = ['-Xmx%sM' % next_candidate] |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 252 | t0 = time.time() |
| 253 | exit_code = run_with_options(options, [], extra_args) |
| 254 | t1 = time.time() |
| 255 | print('Running took: %s ms' % (1000.0 * (t1 - t0))) |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 256 | if exit_code != 0: |
| 257 | if exit_code not in [OOM_EXIT_CODE, TIMEOUT_KILL_CODE]: |
| 258 | print('Non OOM/Timeout error executing, exiting') |
| 259 | return 2 |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 260 | if exit_code == 0: |
| 261 | working = next_candidate |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 262 | elif exit_code == TIMEOUT_KILL_CODE: |
| 263 | print('Timeout. Continue to the next candidate.') |
| 264 | not_working = next_candidate |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 265 | else: |
| 266 | assert exit_code == OOM_EXIT_CODE |
| 267 | not_working = next_candidate |
| 268 | |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 269 | assert working - not_working <= range |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 270 | found_range = 'Found range: %s - %s' % (not_working, working) |
| 271 | print(found_range) |
| 272 | |
| 273 | if options.find_min_xmx_archive: |
| 274 | sha = utils.get_HEAD_sha1() |
| 275 | (version, _) = get_version_and_data(options) |
| 276 | destination = os.path.join( |
| 277 | utils.R8_TEST_RESULTS_BUCKET, |
| 278 | FIND_MIN_XMX_DIR, |
| 279 | sha, |
| 280 | options.compiler, |
| 281 | options.compiler_build, |
| 282 | options.app, |
| 283 | version, |
| 284 | get_type(options)) |
| 285 | gs_destination = 'gs://%s' % destination |
| 286 | utils.archive_value(FIND_MIN_XMX_FILE, gs_destination, found_range + '\n') |
| 287 | |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 288 | return 0 |
| 289 | |
Morten Krogh-Jespersen | f241230 | 2019-10-22 10:18:04 +0200 | [diff] [blame] | 290 | def print_min_xmx_ranges_for_hash(hash, compiler, compiler_build): |
| 291 | app_directory = os.path.join( |
| 292 | utils.R8_TEST_RESULTS_BUCKET, |
| 293 | FIND_MIN_XMX_DIR, |
| 294 | hash, |
| 295 | compiler, |
| 296 | compiler_build) |
| 297 | gs_base = 'gs://%s' % app_directory |
| 298 | for app in utils.ls_files_on_cloud_storage(gs_base).strip().split('\n'): |
| 299 | for version in utils.ls_files_on_cloud_storage(app).strip().split('\n'): |
| 300 | for type in utils.ls_files_on_cloud_storage(version).strip().split('\n'): |
| 301 | gs_location = '%s%s' % (type, FIND_MIN_XMX_FILE) |
| 302 | value = utils.cat_file_on_cloud_storage(gs_location, ignore_errors=True) |
| 303 | print('%s\n' % value) |
| 304 | |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 305 | def track_time_in_memory(options, args): |
| 306 | # Args will be destroyed |
| 307 | assert len(args) == 0 |
| 308 | if not options.track_time_in_memory_min: |
| 309 | raise Exception( |
| 310 | 'You have to specify --track_time_in_memory_min when running with ' |
| 311 | '--track-time-in-memory') |
| 312 | if not options.track_time_in_memory_max: |
| 313 | raise Exception( |
| 314 | 'You have to specify --track_time_in_memory_max when running with ' |
| 315 | '--track-time-in-memory') |
| 316 | if not options.track_time_in_memory_increment: |
| 317 | raise Exception( |
| 318 | 'You have to specify --track_time_in_memory_increment when running ' |
| 319 | 'with --track-time-in-memory') |
| 320 | current = options.track_time_in_memory_min |
| 321 | print('Memory (KB)\tTime (ms)') |
| 322 | with utils.TempDir() as temp: |
| 323 | stdout = os.path.join(temp, 'stdout') |
| 324 | stdout_fd = open(stdout, 'w') |
| 325 | while current <= options.track_time_in_memory_max: |
| 326 | extra_args = ['-Xmx%sM' % current] |
| 327 | t0 = time.time() |
| 328 | exit_code = run_with_options(options, [], extra_args, stdout_fd, quiet=True) |
| 329 | t1 = time.time() |
| 330 | total = (1000.0 * (t1 - t0)) if exit_code == 0 else -1 |
| 331 | print('%s\t%s' % (current, total)) |
| 332 | current += options.track_time_in_memory_increment |
| 333 | |
| 334 | return 0 |
| 335 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 336 | def main(argv): |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 337 | (options, args) = ParseOptions(argv) |
Morten Krogh-Jespersen | b7e1a18 | 2019-10-09 13:04:54 +0200 | [diff] [blame] | 338 | if options.expect_oom and not options.max_memory: |
| 339 | raise Exception( |
| 340 | 'You should only use --expect-oom if also specifying --max-memory') |
| 341 | if options.expect_oom and options.timeout: |
| 342 | raise Exception( |
| 343 | 'You should not use --timeout when also specifying --expect-oom') |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 344 | if options.find_min_xmx and options.track_time_in_memory: |
| 345 | raise Exception( |
| 346 | 'You cannot both find the min xmx and track time at the same time') |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 347 | if options.run_all: |
| 348 | return run_all(options, args) |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 349 | if options.find_min_xmx: |
| 350 | return find_min_xmx(options, args) |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 351 | if options.track_time_in_memory: |
| 352 | return track_time_in_memory(options, args) |
Morten Krogh-Jespersen | b7e1a18 | 2019-10-09 13:04:54 +0200 | [diff] [blame] | 353 | exit_code = run_with_options(options, args) |
| 354 | if options.expect_oom: |
| 355 | exit_code = 0 if exit_code == OOM_EXIT_CODE else 1 |
| 356 | return exit_code |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 357 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 358 | def get_version_and_data(options): |
| 359 | if options.app == 'gmscore': |
| 360 | version = options.version or 'v9' |
| 361 | data = gmscore_data |
| 362 | elif options.app == 'nest': |
| 363 | version = options.version or '20180926' |
| 364 | data = nest_data |
| 365 | elif options.app == 'youtube': |
| 366 | version = options.version or '12.22' |
| 367 | data = youtube_data |
| 368 | elif options.app == 'chrome': |
| 369 | version = options.version or '180917' |
| 370 | data = chrome_data |
| 371 | elif options.app == 'gmail': |
| 372 | version = options.version or '170604.16' |
| 373 | data = gmail_data |
| 374 | elif options.app == 'r8': |
| 375 | version = options.version or 'cf' |
| 376 | data = r8_data |
Morten Krogh-Jespersen | cd6712c | 2019-10-09 13:09:47 +0200 | [diff] [blame] | 377 | elif options.app == 'iosched': |
| 378 | version = options.version or '2019' |
| 379 | data = iosched_data |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 380 | else: |
| 381 | raise Exception("You need to specify '--app={}'".format('|'.join(APPS))) |
| 382 | return version, data |
| 383 | |
| 384 | def get_type(options): |
| 385 | if not options.type: |
| 386 | return 'deploy' if options.compiler == 'r8' else 'proguarded' |
| 387 | return options.type |
| 388 | |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 389 | def run_with_options(options, args, extra_args=None, stdout=None, quiet=False): |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 390 | if extra_args is None: |
| 391 | extra_args = [] |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 392 | app_provided_pg_conf = False; |
Rico Wind | add0813 | 2018-12-14 14:17:15 +0100 | [diff] [blame] | 393 | # todo(121018500): remove when memory is under control |
Rico Wind | 20602b7 | 2019-01-09 09:17:13 +0100 | [diff] [blame] | 394 | if not any('-Xmx' in arg for arg in extra_args): |
Morten Krogh-Jespersen | 322c2f1 | 2019-10-08 10:41:21 +0200 | [diff] [blame] | 395 | if options.max_memory: |
| 396 | extra_args.append('-Xmx%sM' % options.max_memory) |
| 397 | else: |
| 398 | extra_args.append('-Xmx8G') |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 399 | if options.golem: |
| 400 | golem.link_third_party() |
Rico Wind | 9bd3f5f | 2018-10-01 10:53:18 +0200 | [diff] [blame] | 401 | options.out = os.getcwd() |
Rico Wind | afdbbfd | 2019-02-22 09:32:07 +0100 | [diff] [blame] | 402 | if not options.ignore_java_version: |
| 403 | utils.check_java_version() |
| 404 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 405 | outdir = options.out |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 406 | (version_id, data) = get_version_and_data(options) |
| 407 | |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 408 | if options.compiler not in COMPILERS: |
| 409 | raise Exception("You need to specify '--compiler={}'" |
| 410 | .format('|'.join(COMPILERS))) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 411 | |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 412 | if options.compiler_build not in COMPILER_BUILDS: |
| 413 | raise Exception("You need to specify '--compiler-build={}'" |
| 414 | .format('|'.join(COMPILER_BUILDS))) |
| 415 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 416 | if not version_id in data.VERSIONS.keys(): |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 417 | print('No version {} for application {}' |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 418 | .format(version_id, options.app)) |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 419 | print('Valid versions are {}'.format(data.VERSIONS.keys())) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 420 | return 1 |
| 421 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 422 | version = data.VERSIONS[version_id] |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 423 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 424 | type = get_type(options) |
Tamas Kenez | 3fdaabd | 2017-06-15 13:05:12 +0200 | [diff] [blame] | 425 | |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 426 | if type not in version: |
| 427 | print('No type {} for version {}'.format(type, version)) |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 428 | print('Valid types are {}'.format(version.keys())) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 429 | return 1 |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 430 | values = version[type] |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 431 | inputs = None |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 432 | # For R8 'deploy' the JAR is located using the Proguard configuration |
Christoffer Quist Adamsen | a2a5877 | 2018-10-03 09:47:46 +0200 | [diff] [blame] | 433 | # -injars option. For chrome and nest we don't have the injars in the |
| 434 | # proguard files. |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 435 | if 'inputs' in values and (options.compiler != 'r8' |
Morten Krogh-Jespersen | 0981b72 | 2019-10-09 10:00:33 +0200 | [diff] [blame] | 436 | or type != 'deploy' |
Christoffer Quist Adamsen | a2a5877 | 2018-10-03 09:47:46 +0200 | [diff] [blame] | 437 | or options.app == 'chrome' |
Morten Krogh-Jespersen | 04c7c30 | 2019-10-01 15:04:33 +0200 | [diff] [blame] | 438 | or options.app == 'nest' |
Morten Krogh-Jespersen | cd6712c | 2019-10-09 13:09:47 +0200 | [diff] [blame] | 439 | or options.app == 'r8' |
| 440 | or options.app == 'iosched'): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 441 | inputs = values['inputs'] |
| 442 | |
| 443 | args.extend(['--output', outdir]) |
Ian Zerny | 877c186 | 2017-07-06 11:12:26 +0200 | [diff] [blame] | 444 | if 'min-api' in values: |
| 445 | args.extend(['--min-api', values['min-api']]) |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 446 | |
Søren Gjesse | 8ae55eb | 2018-09-28 11:11:36 +0200 | [diff] [blame] | 447 | if 'main-dex-list' in values: |
| 448 | args.extend(['--main-dex-list', values['main-dex-list']]) |
| 449 | |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 450 | if options.compiler == 'r8': |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 451 | if 'pgconf' in values and not options.k: |
Søren Gjesse | cbeae78 | 2019-05-21 14:14:25 +0200 | [diff] [blame] | 452 | sanitized_lib_path = os.path.join( |
| 453 | os.path.abspath(outdir), 'sanitized_lib.jar') |
| 454 | sanitized_pgconf_path = os.path.join( |
| 455 | os.path.abspath(outdir), 'sanitized.config') |
| 456 | SanitizeLibraries( |
| 457 | sanitized_lib_path, sanitized_pgconf_path, values['pgconf']) |
| 458 | args.extend(['--pg-conf', sanitized_pgconf_path]) |
| 459 | app_provided_pg_conf = True |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 460 | if options.k: |
| 461 | args.extend(['--pg-conf', options.k]) |
Søren Gjesse | c801ecc | 2017-08-03 13:40:06 +0200 | [diff] [blame] | 462 | if 'maindexrules' in values: |
| 463 | for rules in values['maindexrules']: |
| 464 | args.extend(['--main-dex-rules', rules]) |
Rico Wind | 79e4eb5 | 2018-12-13 13:00:49 +0100 | [diff] [blame] | 465 | if 'allow-type-errors' in values: |
| 466 | extra_args.append('-Dcom.android.tools.r8.allowTypeErrors=1') |
Christoffer Quist Adamsen | 955fa63 | 2019-06-03 14:55:49 +0200 | [diff] [blame] | 467 | if 'proto-shrinking' in values: |
Christoffer Quist Adamsen | d79b6a7 | 2019-09-16 17:03:05 +0200 | [diff] [blame] | 468 | extra_args.append('-Dcom.android.tools.r8.fieldBitAccessAnalysis=1') |
Christoffer Quist Adamsen | 955fa63 | 2019-06-03 14:55:49 +0200 | [diff] [blame] | 469 | extra_args.append('-Dcom.android.tools.r8.generatedExtensionRegistryShrinking=1') |
Christoffer Quist Adamsen | e32e391 | 2019-08-23 15:11:38 +0200 | [diff] [blame] | 470 | extra_args.append('-Dcom.android.tools.r8.generatedMessageLiteShrinking=1') |
Christoffer Quist Adamsen | d79b6a7 | 2019-09-16 17:03:05 +0200 | [diff] [blame] | 471 | extra_args.append('-Dcom.android.tools.r8.stringSwitchConversion=1') |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 472 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 473 | if not options.no_libraries and 'libraries' in values: |
| 474 | for lib in values['libraries']: |
| 475 | args.extend(['--lib', lib]) |
| 476 | |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 477 | if not outdir.endswith('.zip') and not outdir.endswith('.jar') \ |
| 478 | and not os.path.exists(outdir): |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 479 | os.makedirs(outdir) |
| 480 | |
Søren Gjesse | 8ae55eb | 2018-09-28 11:11:36 +0200 | [diff] [blame] | 481 | # Additional flags for the compiler from the configuration file. |
| 482 | if 'flags' in values: |
| 483 | args.extend(values['flags'].split(' ')) |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 484 | if options.compiler == 'r8': |
Søren Gjesse | 932881f | 2017-06-13 10:43:36 +0200 | [diff] [blame] | 485 | if 'r8-flags' in values: |
| 486 | args.extend(values['r8-flags'].split(' ')) |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 487 | |
Søren Gjesse | 8ae55eb | 2018-09-28 11:11:36 +0200 | [diff] [blame] | 488 | # Additional flags for the compiler from the command line. |
Tamas Kenez | 139acc1 | 2017-06-14 17:14:58 +0200 | [diff] [blame] | 489 | if options.compiler_flags: |
| 490 | args.extend(options.compiler_flags.split(' ')) |
| 491 | if options.r8_flags: |
| 492 | args.extend(options.r8_flags.split(' ')) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 493 | |
| 494 | if inputs: |
| 495 | args.extend(inputs) |
| 496 | |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 497 | t0 = time.time() |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 498 | if options.dump_args_file: |
| 499 | with open(options.dump_args_file, 'w') as args_file: |
| 500 | args_file.writelines([arg + os.linesep for arg in args]) |
| 501 | else: |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 502 | with utils.TempDir() as temp: |
| 503 | if options.print_memoryuse and not options.track_memory_to_file: |
| 504 | options.track_memory_to_file = os.path.join(temp, |
| 505 | utils.MEMORY_USE_TMP_FILE) |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 506 | if options.compiler == 'r8' and app_provided_pg_conf: |
Mathias Rav | dd6a6de | 2018-05-18 10:18:33 +0200 | [diff] [blame] | 507 | # Ensure that output of -printmapping and -printseeds go to the output |
| 508 | # location and not where the app Proguard configuration places them. |
| 509 | if outdir.endswith('.zip') or outdir.endswith('.jar'): |
| 510 | pg_outdir = os.path.dirname(outdir) |
| 511 | else: |
| 512 | pg_outdir = outdir |
| 513 | additional_pg_conf = GenerateAdditionalProguardConfiguration( |
| 514 | temp, os.path.abspath(pg_outdir)) |
| 515 | args.extend(['--pg-conf', additional_pg_conf]) |
Rico Wind | 1f4172c | 2018-09-06 16:29:03 +0200 | [diff] [blame] | 516 | build = not options.no_build and not options.golem |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 517 | stderr_path = os.path.join(temp, 'stderr') |
| 518 | with open(stderr_path, 'w') as stderr: |
Tamas Kenez | 63a51d0 | 2019-01-07 15:53:02 +0100 | [diff] [blame] | 519 | if options.compiler_build == 'full': |
| 520 | tool = options.compiler |
| 521 | else: |
| 522 | assert(options.compiler_build == 'lib') |
| 523 | tool = 'r8lib-' + options.compiler |
| 524 | exit_code = toolhelper.run(tool, args, |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 525 | build=build, |
| 526 | debug=not options.no_debug, |
| 527 | profile=options.profile, |
| 528 | track_memory_file=options.track_memory_to_file, |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 529 | extra_args=extra_args, |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 530 | stdout=stdout, |
Jinseong Jeon | 158a3f1 | 2019-02-08 01:40:59 -0800 | [diff] [blame] | 531 | stderr=stderr, |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 532 | timeout=options.timeout, |
| 533 | quiet=quiet) |
Christoffer Quist Adamsen | 21c6660 | 2018-08-09 16:22:54 +0200 | [diff] [blame] | 534 | if exit_code != 0: |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 535 | with open(stderr_path) as stderr: |
| 536 | stderr_text = stderr.read() |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 537 | if not quiet: |
| 538 | print(stderr_text) |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 539 | if 'java.lang.OutOfMemoryError' in stderr_text: |
Morten Krogh-Jespersen | ae9557c | 2019-10-23 15:14:02 +0200 | [diff] [blame] | 540 | if not quiet: |
| 541 | print('Failure was OOM') |
Rico Wind | 5fdec15 | 2018-12-17 09:16:14 +0100 | [diff] [blame] | 542 | return OOM_EXIT_CODE |
| 543 | return exit_code |
Christoffer Quist Adamsen | 21c6660 | 2018-08-09 16:22:54 +0200 | [diff] [blame] | 544 | |
Tamas Kenez | fc34cd8 | 2017-07-13 12:43:57 +0200 | [diff] [blame] | 545 | if options.print_memoryuse: |
| 546 | print('{}(MemoryUse): {}' |
| 547 | .format(options.print_memoryuse, |
| 548 | utils.grep_memoryuse(options.track_memory_to_file))) |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 549 | |
Tamas Kenez | f2ee2a3 | 2017-06-21 10:30:20 +0200 | [diff] [blame] | 550 | if options.print_runtimeraw: |
| 551 | print('{}(RunTimeRaw): {} ms' |
| 552 | .format(options.print_runtimeraw, 1000.0 * (time.time() - t0))) |
| 553 | |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 554 | if options.print_dexsegments: |
| 555 | dex_files = glob(os.path.join(outdir, '*.dex')) |
| 556 | utils.print_dexsegments(options.print_dexsegments, dex_files) |
Rico Wind | b57bbc1 | 2018-09-20 19:23:32 +0200 | [diff] [blame] | 557 | return 0 |
Tamas Kenez | 02bff03 | 2017-07-18 12:13:58 +0200 | [diff] [blame] | 558 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 559 | if __name__ == '__main__': |
Tamas Kenez | 5b1c585 | 2017-07-21 13:38:33 +0200 | [diff] [blame] | 560 | sys.exit(main(sys.argv[1:])) |