| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 # pylint: disable=F0401 | |
| 12 from util import build_utils | 11 from util import build_utils |
| 13 from util import md5_check | 12 from util import md5_check |
| 14 # pylint: enable=F0401 | |
| 15 | 13 |
| 16 | 14 |
| 17 def DoDex(options, paths): | 15 def DoDex(options, paths): |
| 18 dx_binary = os.path.join(options.android_sdk_tools, 'dx') | 16 dx_binary = os.path.join(options.android_sdk_tools, 'dx') |
| 19 # See http://crbug.com/272064 for context on --force-jumbo. | 17 # See http://crbug.com/272064 for context on --force-jumbo. |
| 20 dex_cmd = [dx_binary, '--dex', '--force-jumbo', '--output', options.dex_path] | 18 dex_cmd = [dx_binary, '--dex', '--force-jumbo', '--output', options.dex_path] |
| 21 if options.no_locals != '0': | 19 if options.no_locals != '0': |
| 22 dex_cmd.append('--no-locals') | 20 dex_cmd.append('--no-locals') |
| 23 dex_cmd += paths | 21 dex_cmd += paths |
| 24 | 22 |
| 25 record_path = '%s.md5.stamp' % options.dex_path | 23 record_path = '%s.md5.stamp' % options.dex_path |
| 26 md5_check.CallAndRecordIfStale( | 24 md5_check.CallAndRecordIfStale( |
| 27 lambda: build_utils.CheckOutput(dex_cmd, print_stderr=False), | 25 lambda: build_utils.CheckOutput(dex_cmd, print_stderr=False), |
| 28 record_path=record_path, | 26 record_path=record_path, |
| 29 input_paths=paths, | 27 input_paths=paths, |
| 30 input_strings=dex_cmd) | 28 input_strings=dex_cmd) |
| 31 | 29 |
| 32 build_utils.Touch(options.dex_path) | 30 build_utils.Touch(options.dex_path) |
| 33 | 31 |
| 34 | 32 |
| 35 def main(): | 33 def main(argv): |
| 36 parser = optparse.OptionParser() | 34 parser = optparse.OptionParser() |
| 37 parser.add_option('--android-sdk-tools', | 35 parser.add_option('--android-sdk-tools', |
| 38 help='Android sdk build tools directory.') | 36 help='Android sdk build tools directory.') |
| 39 parser.add_option('--dex-path', help='Dex output path.') | 37 parser.add_option('--dex-path', help='Dex output path.') |
| 40 parser.add_option('--configuration-name', | 38 parser.add_option('--configuration-name', |
| 41 help='The build CONFIGURATION_NAME.') | 39 help='The build CONFIGURATION_NAME.') |
| 42 parser.add_option('--proguard-enabled', | 40 parser.add_option('--proguard-enabled', |
| 43 help='"true" if proguard is enabled.') | 41 help='"true" if proguard is enabled.') |
| 44 parser.add_option('--proguard-enabled-input-path', | 42 parser.add_option('--proguard-enabled-input-path', |
| 45 help=('Path to dex in Release mode when proguard ' | 43 help=('Path to dex in Release mode when proguard ' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 and options.configuration_name == 'Release'): | 55 and options.configuration_name == 'Release'): |
| 58 paths = [options.proguard_enabled_input_path] | 56 paths = [options.proguard_enabled_input_path] |
| 59 | 57 |
| 60 DoDex(options, paths) | 58 DoDex(options, paths) |
| 61 | 59 |
| 62 if options.stamp: | 60 if options.stamp: |
| 63 build_utils.Touch(options.stamp) | 61 build_utils.Touch(options.stamp) |
| 64 | 62 |
| 65 | 63 |
| 66 if __name__ == '__main__': | 64 if __name__ == '__main__': |
| 67 sys.exit(main()) | 65 sys.exit(main(sys.argv)) |
| OLD | NEW |