| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 c for c in possible_deps_config_paths if not os.path.exists(c)] | 284 c for c in possible_deps_config_paths if not os.path.exists(c)] |
| 285 if unknown_deps and not allow_unknown_deps: | 285 if unknown_deps and not allow_unknown_deps: |
| 286 raise Exception('Unknown deps: ' + str(unknown_deps)) | 286 raise Exception('Unknown deps: ' + str(unknown_deps)) |
| 287 | 287 |
| 288 direct_deps_config_paths = [ | 288 direct_deps_config_paths = [ |
| 289 c for c in possible_deps_config_paths if not c in unknown_deps] | 289 c for c in possible_deps_config_paths if not c in unknown_deps] |
| 290 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, | 290 direct_deps_config_paths = _FilterUnwantedDepsPaths(direct_deps_config_paths, |
| 291 options.type) | 291 options.type) |
| 292 | 292 |
| 293 deps = Deps(direct_deps_config_paths) | 293 deps = Deps(direct_deps_config_paths) |
| 294 all_inputs = deps.AllConfigPaths() + build_utils.GetPythonDependencies() |
| 294 | 295 |
| 295 # Remove other locale resources if there is alternative_locale_resource in | 296 # Remove other locale resources if there is alternative_locale_resource in |
| 296 # direct deps. | 297 # direct deps. |
| 297 if options.has_alternative_locale_resource: | 298 if options.has_alternative_locale_resource: |
| 298 alternative = [r['path'] for r in deps.Direct('android_resources') | 299 alternative = [r['path'] for r in deps.Direct('android_resources') |
| 299 if r.get('is_locale_resource')] | 300 if r.get('is_locale_resource')] |
| 300 # We can only have one locale resources in direct deps. | 301 # We can only have one locale resources in direct deps. |
| 301 if len(alternative) != 1: | 302 if len(alternative) != 1: |
| 302 raise Exception('The number of locale resource in direct deps is wrong %d' | 303 raise Exception('The number of locale resource in direct deps is wrong %d' |
| 303 % len(alternative)) | 304 % len(alternative)) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 recompute_ordered_libraries, | 505 recompute_ordered_libraries, |
| 505 record_path=options.build_config + '.nativelibs.md5.stamp', | 506 record_path=options.build_config + '.nativelibs.md5.stamp', |
| 506 input_paths=libraries, | 507 input_paths=libraries, |
| 507 output_paths=[options.build_config]) | 508 output_paths=[options.build_config]) |
| 508 if not library_paths: | 509 if not library_paths: |
| 509 prev_config = build_utils.ReadJson(options.build_config) | 510 prev_config = build_utils.ReadJson(options.build_config) |
| 510 java_libraries_list_holder[0] = ( | 511 java_libraries_list_holder[0] = ( |
| 511 prev_config['native']['java_libraries_list']) | 512 prev_config['native']['java_libraries_list']) |
| 512 library_paths.extend(prev_config['native']['libraries']) | 513 library_paths.extend(prev_config['native']['libraries']) |
| 513 | 514 |
| 515 all_inputs.extend(library_paths) |
| 514 config['native'] = { | 516 config['native'] = { |
| 515 'libraries': library_paths, | 517 'libraries': library_paths, |
| 516 'java_libraries_list': java_libraries_list_holder[0], | 518 'java_libraries_list': java_libraries_list_holder[0], |
| 517 } | 519 } |
| 518 config['assets'], config['uncompressed_assets'] = ( | 520 config['assets'], config['uncompressed_assets'] = ( |
| 519 _MergeAssets(deps.All('android_assets'))) | 521 _MergeAssets(deps.All('android_assets'))) |
| 520 | 522 |
| 521 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 523 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
| 522 | 524 |
| 523 if options.depfile: | 525 if options.depfile: |
| 524 build_utils.WriteDepfile( | 526 build_utils.WriteDepfile(options.depfile, all_inputs) |
| 525 options.depfile, | |
| 526 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) | |
| 527 | 527 |
| 528 | 528 |
| 529 if __name__ == '__main__': | 529 if __name__ == '__main__': |
| 530 sys.exit(main(sys.argv[1:])) | 530 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |