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 '--deps-configs', | 203 '--possible-deps-configs', |
204 help='List of paths for dependency\'s build_config files. ') | 204 help='List of paths for dependency\'s build_config files. Some ' |
| 205 'dependencies may not write build_config files. Missing build_config ' |
| 206 'files are handled differently based on the type of this target.') |
205 | 207 |
206 # android_resources options | 208 # android_resources options |
207 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.') | 209 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.') |
208 parser.add_option('--resources-zip', help='Path to target\'s resources zip.') | 210 parser.add_option('--resources-zip', help='Path to target\'s resources zip.') |
209 parser.add_option('--r-text', help='Path to target\'s R.txt file.') | 211 parser.add_option('--r-text', help='Path to target\'s R.txt file.') |
210 parser.add_option('--package-name', | 212 parser.add_option('--package-name', |
211 help='Java package name for these resources.') | 213 help='Java package name for these resources.') |
212 parser.add_option('--android-manifest', help='Path to android manifest.') | 214 parser.add_option('--android-manifest', help='Path to android manifest.') |
213 parser.add_option('--is-locale-resource', action='store_true', | 215 parser.add_option('--is-locale-resource', action='store_true', |
214 help='Whether it is locale resource.') | 216 help='Whether it is locale resource.') |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 build_utils.CheckOptions(options, parser, required_options) | 283 build_utils.CheckOptions(options, parser, required_options) |
282 | 284 |
283 if options.type == 'java_library': | 285 if options.type == 'java_library': |
284 if options.supports_android and not options.dex_path: | 286 if options.supports_android and not options.dex_path: |
285 raise Exception('java_library that supports Android requires a dex path.') | 287 raise Exception('java_library that supports Android requires a dex path.') |
286 | 288 |
287 if options.requires_android and not options.supports_android: | 289 if options.requires_android and not options.supports_android: |
288 raise Exception( | 290 raise Exception( |
289 '--supports-android is required when using --requires-android') | 291 '--supports-android is required when using --requires-android') |
290 | 292 |
291 direct_deps_config_paths = build_utils.ParseGypList(options.deps_configs) | 293 possible_deps_config_paths = build_utils.ParseGypList( |
| 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] |
292 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, | 301 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, |
293 options.type) | 302 options.type) |
294 | 303 |
295 deps = Deps(direct_deps_config_paths) | 304 deps = Deps(direct_deps_config_paths) |
296 all_inputs = deps.AllConfigPaths() + build_utils.GetPythonDependencies() | 305 all_inputs = deps.AllConfigPaths() + build_utils.GetPythonDependencies() |
297 | 306 |
298 # Remove other locale resources if there is alternative_locale_resource in | 307 # Remove other locale resources if there is alternative_locale_resource in |
299 # direct deps. | 308 # direct deps. |
300 if options.has_alternative_locale_resource: | 309 if options.has_alternative_locale_resource: |
301 alternative = [r['path'] for r in deps.Direct('android_resources') | 310 alternative = [r['path'] for r in deps.Direct('android_resources') |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 _MergeAssets(deps.All('android_assets'))) | 560 _MergeAssets(deps.All('android_assets'))) |
552 | 561 |
553 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 562 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
554 | 563 |
555 if options.depfile: | 564 if options.depfile: |
556 build_utils.WriteDepfile(options.depfile, all_inputs) | 565 build_utils.WriteDepfile(options.depfile, all_inputs) |
557 | 566 |
558 | 567 |
559 if __name__ == '__main__': | 568 if __name__ == '__main__': |
560 sys.exit(main(sys.argv[1:])) | 569 sys.exit(main(sys.argv[1:])) |
OLD | NEW |