| 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 logging | 7 import logging |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 parser.add_option('--android-sdk-tools', | 42 parser.add_option('--android-sdk-tools', |
| 43 help='Android sdk build tools directory.') | 43 help='Android sdk build tools directory.') |
| 44 parser.add_option('--output-directory', | 44 parser.add_option('--output-directory', |
| 45 default=os.getcwd(), | 45 default=os.getcwd(), |
| 46 help='Path to the output build directory.') | 46 help='Path to the output build directory.') |
| 47 parser.add_option('--dex-path', help='Dex output path.') | 47 parser.add_option('--dex-path', help='Dex output path.') |
| 48 parser.add_option('--configuration-name', | 48 parser.add_option('--configuration-name', |
| 49 help='The build CONFIGURATION_NAME.') | 49 help='The build CONFIGURATION_NAME.') |
| 50 parser.add_option('--proguard-enabled', | 50 parser.add_option('--proguard-enabled', |
| 51 help='"true" if proguard is enabled.') | 51 help='"true" if proguard is enabled.') |
| 52 parser.add_option('--debug-build-proguard-enabled', |
| 53 help='"true" if proguard is enabled for debug build.') |
| 52 parser.add_option('--proguard-enabled-input-path', | 54 parser.add_option('--proguard-enabled-input-path', |
| 53 help=('Path to dex in Release mode when proguard ' | 55 help=('Path to dex in Release mode when proguard ' |
| 54 'is enabled.')) | 56 'is enabled.')) |
| 55 parser.add_option('--no-locals', | 57 parser.add_option('--no-locals', |
| 56 help='Exclude locals list from the dex file.') | 58 help='Exclude locals list from the dex file.') |
| 57 parser.add_option('--multi-dex', default=False, action='store_true', | 59 parser.add_option('--multi-dex', default=False, action='store_true', |
| 58 help='Create multiple dex files.') | 60 help='Create multiple dex files.') |
| 59 parser.add_option('--incremental', | 61 parser.add_option('--incremental', |
| 60 action='store_true', | 62 action='store_true', |
| 61 help='Enable incremental builds when possible.') | 63 help='Enable incremental builds when possible.') |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 139 |
| 138 def _OnStaleMd5(changes, options, dex_cmd, paths): | 140 def _OnStaleMd5(changes, options, dex_cmd, paths): |
| 139 _RunDx(changes, options, dex_cmd, paths) | 141 _RunDx(changes, options, dex_cmd, paths) |
| 140 build_utils.WriteJson( | 142 build_utils.WriteJson( |
| 141 [os.path.relpath(p, options.output_directory) for p in paths], | 143 [os.path.relpath(p, options.output_directory) for p in paths], |
| 142 options.dex_path + '.inputs') | 144 options.dex_path + '.inputs') |
| 143 | 145 |
| 144 | 146 |
| 145 def main(args): | 147 def main(args): |
| 146 options, paths = _ParseArgs(args) | 148 options, paths = _ParseArgs(args) |
| 147 if (options.proguard_enabled == 'true' | 149 if ((options.proguard_enabled == 'true' |
| 148 and options.configuration_name == 'Release'): | 150 and options.configuration_name == 'Release') |
| 151 or (options.debug_build_proguard_enabled == 'true' |
| 152 and options.configuration_name == 'Debug')): |
| 149 paths = [options.proguard_enabled_input_path] | 153 paths = [options.proguard_enabled_input_path] |
| 150 | 154 |
| 151 if options.inputs: | 155 if options.inputs: |
| 152 paths += options.inputs | 156 paths += options.inputs |
| 153 | 157 |
| 154 if options.excluded_paths: | 158 if options.excluded_paths: |
| 155 # Excluded paths are relative to the output directory. | 159 # Excluded paths are relative to the output directory. |
| 156 exclude_paths = options.excluded_paths | 160 exclude_paths = options.excluded_paths |
| 157 paths = [p for p in paths if not | 161 paths = [p for p in paths if not |
| 158 os.path.relpath(p, options.output_directory) in exclude_paths] | 162 os.path.relpath(p, options.output_directory) in exclude_paths] |
| (...skipping 30 matching lines...) Expand all Loading... |
| 189 options, | 193 options, |
| 190 input_paths=input_paths, | 194 input_paths=input_paths, |
| 191 input_strings=dex_cmd, | 195 input_strings=dex_cmd, |
| 192 output_paths=output_paths, | 196 output_paths=output_paths, |
| 193 force=force, | 197 force=force, |
| 194 pass_changes=True) | 198 pass_changes=True) |
| 195 | 199 |
| 196 | 200 |
| 197 if __name__ == '__main__': | 201 if __name__ == '__main__': |
| 198 sys.exit(main(sys.argv[1:])) | 202 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |