| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 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 """Writes a build_config file. | 7 """Writes a build_config file. |
| 8 | 8 |
| 9 The build_config file for a target is a json file containing information about | 9 The build_config file for a target is a json file containing information about |
| 10 how to build that target based on the target's dependencies. This includes | 10 how to build that target based on the target's dependencies. This includes |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 | 194 |
| 195 def main(argv): | 195 def main(argv): |
| 196 parser = optparse.OptionParser() | 196 parser = optparse.OptionParser() |
| 197 build_utils.AddDepfileOption(parser) | 197 build_utils.AddDepfileOption(parser) |
| 198 parser.add_option('--build-config', help='Path to build_config output.') | 198 parser.add_option('--build-config', help='Path to build_config output.') |
| 199 parser.add_option( | 199 parser.add_option( |
| 200 '--type', | 200 '--type', |
| 201 help='Type of this target (e.g. android_library).') | 201 help='Type of this target (e.g. android_library).') |
| 202 parser.add_option( | 202 parser.add_option( |
| 203 '--possible-deps-configs', | 203 '--deps-configs', |
| 204 help='List of paths for dependency\'s build_config files. Some ' | 204 help='List of paths for dependency\'s build_config files. ') |
| 205 'dependencies may not write build_config files. Missing build_config ' | |
| 206 'files are handled differently based on the type of this target.') | |
| 207 | 205 |
| 208 # android_resources options | 206 # android_resources options |
| 209 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.') | 207 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.') |
| 210 parser.add_option('--resources-zip', help='Path to target\'s resources zip.') | 208 parser.add_option('--resources-zip', help='Path to target\'s resources zip.') |
| 211 parser.add_option('--r-text', help='Path to target\'s R.txt file.') | 209 parser.add_option('--r-text', help='Path to target\'s R.txt file.') |
| 212 parser.add_option('--package-name', | 210 parser.add_option('--package-name', |
| 213 help='Java package name for these resources.') | 211 help='Java package name for these resources.') |
| 214 parser.add_option('--android-manifest', help='Path to android manifest.') | 212 parser.add_option('--android-manifest', help='Path to android manifest.') |
| 215 parser.add_option('--is-locale-resource', action='store_true', | 213 parser.add_option('--is-locale-resource', action='store_true', |
| 216 help='Whether it is locale resource.') | 214 help='Whether it is locale resource.') |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 build_utils.CheckOptions(options, parser, required_options) | 281 build_utils.CheckOptions(options, parser, required_options) |
| 284 | 282 |
| 285 if options.type == 'java_library': | 283 if options.type == 'java_library': |
| 286 if options.supports_android and not options.dex_path: | 284 if options.supports_android and not options.dex_path: |
| 287 raise Exception('java_library that supports Android requires a dex path.') | 285 raise Exception('java_library that supports Android requires a dex path.') |
| 288 | 286 |
| 289 if options.requires_android and not options.supports_android: | 287 if options.requires_android and not options.supports_android: |
| 290 raise Exception( | 288 raise Exception( |
| 291 '--supports-android is required when using --requires-android') | 289 '--supports-android is required when using --requires-android') |
| 292 | 290 |
| 293 possible_deps_config_paths = build_utils.ParseGypList( | 291 direct_deps_config_paths = build_utils.ParseGypList(options.deps_configs) |
| 294 options.possible_deps_configs) | |
| 295 | |
| 296 unknown_deps = [ | |
| 297 c for c in possible_deps_config_paths if not os.path.exists(c)] | |
| 298 | |
| 299 direct_deps_config_paths = [ | |
| 300 c for c in possible_deps_config_paths if not c in unknown_deps] | |
| 301 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, | 292 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, |
| 302 options.type) | 293 options.type) |
| 303 | 294 |
| 304 deps = Deps(direct_deps_config_paths) | 295 deps = Deps(direct_deps_config_paths) |
| 305 all_inputs = deps.AllConfigPaths() + build_utils.GetPythonDependencies() | 296 all_inputs = deps.AllConfigPaths() + build_utils.GetPythonDependencies() |
| 306 | 297 |
| 307 # Remove other locale resources if there is alternative_locale_resource in | 298 # Remove other locale resources if there is alternative_locale_resource in |
| 308 # direct deps. | 299 # direct deps. |
| 309 if options.has_alternative_locale_resource: | 300 if options.has_alternative_locale_resource: |
| 310 alternative = [r['path'] for r in deps.Direct('android_resources') | 301 alternative = [r['path'] for r in deps.Direct('android_resources') |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 _MergeAssets(deps.All('android_assets'))) | 551 _MergeAssets(deps.All('android_assets'))) |
| 561 | 552 |
| 562 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 553 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 563 | 554 |
| 564 if options.depfile: | 555 if options.depfile: |
| 565 build_utils.WriteDepfile(options.depfile, all_inputs) | 556 build_utils.WriteDepfile(options.depfile, all_inputs) |
| 566 | 557 |
| 567 | 558 |
| 568 if __name__ == '__main__': | 559 if __name__ == '__main__': |
| 569 sys.exit(main(sys.argv[1:])) | 560 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |