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 json | 7 import json |
8 import logging | 8 import logging |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 action='store_true', | 53 action='store_true', |
54 help='Enable incremental builds when possible.') | 54 help='Enable incremental builds when possible.') |
55 parser.add_option('--inputs', help='A list of additional input paths.') | 55 parser.add_option('--inputs', help='A list of additional input paths.') |
56 parser.add_option('--excluded-paths', | 56 parser.add_option('--excluded-paths', |
57 help='A list of paths to exclude from the dex file.') | 57 help='A list of paths to exclude from the dex file.') |
58 parser.add_option('--main-dex-list-path', | 58 parser.add_option('--main-dex-list-path', |
59 help='A file containing a list of the classes to ' | 59 help='A file containing a list of the classes to ' |
60 'include in the main dex.') | 60 'include in the main dex.') |
61 parser.add_option('--multidex-configuration-path', | 61 parser.add_option('--multidex-configuration-path', |
62 help='A JSON file containing multidex build configuration.') | 62 help='A JSON file containing multidex build configuration.') |
| 63 parser.add_option('--multi-dex', default=False, action='store_true', |
| 64 help='Generate multiple dex files.') |
63 | 65 |
64 options, paths = parser.parse_args(args) | 66 options, paths = parser.parse_args(args) |
65 | 67 |
66 required_options = ('android_sdk_tools',) | 68 required_options = ('android_sdk_tools',) |
67 build_utils.CheckOptions(options, parser, required=required_options) | 69 build_utils.CheckOptions(options, parser, required=required_options) |
68 | 70 |
69 options.multi_dex = False | |
70 if options.multidex_configuration_path: | 71 if options.multidex_configuration_path: |
71 with open(options.multidex_configuration_path) as multidex_config_file: | 72 with open(options.multidex_configuration_path) as multidex_config_file: |
72 multidex_config = json.loads(multidex_config_file.read()) | 73 multidex_config = json.loads(multidex_config_file.read()) |
73 options.multi_dex = multidex_config.get('enabled', False) | 74 options.multi_dex = multidex_config.get('enabled', False) |
74 | 75 |
75 if options.multi_dex and not options.main_dex_list_path: | 76 if options.multi_dex and not options.main_dex_list_path: |
76 logging.warning('multidex cannot be enabled without --main-dex-list-path') | 77 logging.warning('multidex cannot be enabled without --main-dex-list-path') |
77 options.multi_dex = False | 78 options.multi_dex = False |
78 elif options.main_dex_list_path and not options.multi_dex: | 79 elif options.main_dex_list_path and not options.multi_dex: |
79 logging.warning('--main-dex-list-path is unused if multidex is not enabled') | 80 logging.warning('--main-dex-list-path is unused if multidex is not enabled') |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 options, | 186 options, |
186 input_paths=input_paths, | 187 input_paths=input_paths, |
187 input_strings=dex_cmd, | 188 input_strings=dex_cmd, |
188 output_paths=output_paths, | 189 output_paths=output_paths, |
189 force=force, | 190 force=force, |
190 pass_changes=True) | 191 pass_changes=True) |
191 | 192 |
192 | 193 |
193 if __name__ == '__main__': | 194 if __name__ == '__main__': |
194 sys.exit(main(sys.argv[1:])) | 195 sys.exit(main(sys.argv[1:])) |
OLD | NEW |