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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 209 |
210 # android library options | 210 # android library options |
211 parser.add_option('--dex-path', help='Path to target\'s dex output.') | 211 parser.add_option('--dex-path', help='Path to target\'s dex output.') |
212 | 212 |
213 # native library options | 213 # native library options |
214 parser.add_option('--native-libs', help='List of top-level native libs.') | 214 parser.add_option('--native-libs', help='List of top-level native libs.') |
215 parser.add_option('--readelf-path', help='Path to toolchain\'s readelf.') | 215 parser.add_option('--readelf-path', help='Path to toolchain\'s readelf.') |
216 | 216 |
217 # apk options | 217 # apk options |
218 parser.add_option('--apk-path', help='Path to the target\'s apk output.') | 218 parser.add_option('--apk-path', help='Path to the target\'s apk output.') |
219 parser.add_option('--incremental-apk-path', | |
220 help='Path to the target\'s incremental apk output.') | |
jbudorick
2016/02/09 23:32:32
nit: use double quotes around strings containing a
agrieve
2016/02/10 01:56:56
Done.
| |
221 parser.add_option('--incremental-install-script-path', | |
222 help='Path to the target\'s generated incremental install ' | |
jbudorick
2016/02/09 23:32:32
nit: same
agrieve
2016/02/10 01:56:56
Done.
| |
223 'script.') | |
219 | 224 |
220 parser.add_option('--tested-apk-config', | 225 parser.add_option('--tested-apk-config', |
221 help='Path to the build config of the tested apk (for an instrumentation ' | 226 help='Path to the build config of the tested apk (for an instrumentation ' |
222 'test apk).') | 227 'test apk).') |
223 parser.add_option('--proguard-enabled', action='store_true', | 228 parser.add_option('--proguard-enabled', action='store_true', |
224 help='Whether proguard is enabled for this apk.') | 229 help='Whether proguard is enabled for this apk.') |
225 parser.add_option('--proguard-info', | 230 parser.add_option('--proguard-info', |
226 help='Path to the proguard .info output for this apk.') | 231 help='Path to the proguard .info output for this apk.') |
227 parser.add_option('--has-alternative-locale-resource', action='store_true', | 232 parser.add_option('--has-alternative-locale-resource', action='store_true', |
228 help='Whether there is alternative-locale-resource in direct deps') | 233 help='Whether there is alternative-locale-resource in direct deps') |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 | 341 |
337 if options.type in ('java_binary', 'java_library', 'android_apk'): | 342 if options.type in ('java_binary', 'java_library', 'android_apk'): |
338 javac_classpath = [c['jar_path'] for c in direct_library_deps] | 343 javac_classpath = [c['jar_path'] for c in direct_library_deps] |
339 java_full_classpath = [c['jar_path'] for c in all_library_deps] | 344 java_full_classpath = [c['jar_path'] for c in all_library_deps] |
340 deps_info['resources_deps'] = [c['path'] for c in all_resources_deps] | 345 deps_info['resources_deps'] = [c['path'] for c in all_resources_deps] |
341 deps_info['jar_path'] = options.jar_path | 346 deps_info['jar_path'] = options.jar_path |
342 if options.type == 'android_apk' or options.supports_android: | 347 if options.type == 'android_apk' or options.supports_android: |
343 deps_info['dex_path'] = options.dex_path | 348 deps_info['dex_path'] = options.dex_path |
344 if options.type == 'android_apk': | 349 if options.type == 'android_apk': |
345 deps_info['apk_path'] = options.apk_path | 350 deps_info['apk_path'] = options.apk_path |
351 deps_info['incremental_apk_path'] = options.incremental_apk_path | |
352 deps_info['incremental_install_script_path'] = ( | |
353 options.incremental_install_script_path) | |
346 | 354 |
347 # Classpath values filled in below (after applying tested_apk_config). | 355 # Classpath values filled in below (after applying tested_apk_config). |
348 config['javac'] = {} | 356 config['javac'] = {} |
349 | 357 |
350 if options.type in ('java_binary', 'java_library'): | 358 if options.type in ('java_binary', 'java_library'): |
351 # Only resources might have srcjars (normal srcjar targets are listed in | 359 # Only resources might have srcjars (normal srcjar targets are listed in |
352 # srcjar_deps). A resource's srcjar contains the R.java file for those | 360 # srcjar_deps). A resource's srcjar contains the R.java file for those |
353 # resources, and (like Android's default build system) we allow a library to | 361 # resources, and (like Android's default build system) we allow a library to |
354 # refer to the resources in any of its dependents. | 362 # refer to the resources in any of its dependents. |
355 config['javac']['srcjars'] = [ | 363 config['javac']['srcjars'] = [ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] | 439 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] |
432 | 440 |
433 expected_tested_package = tested_apk_config['package_name'] | 441 expected_tested_package = tested_apk_config['package_name'] |
434 AndroidManifest(options.android_manifest).CheckInstrumentation( | 442 AndroidManifest(options.android_manifest).CheckInstrumentation( |
435 expected_tested_package) | 443 expected_tested_package) |
436 if tested_apk_config['proguard_enabled']: | 444 if tested_apk_config['proguard_enabled']: |
437 assert proguard_enabled, ('proguard must be enabled for instrumentation' | 445 assert proguard_enabled, ('proguard must be enabled for instrumentation' |
438 ' apks if it\'s enabled for the tested apk') | 446 ' apks if it\'s enabled for the tested apk') |
439 proguard_config['tested_apk_info'] = tested_apk_config['proguard_info'] | 447 proguard_config['tested_apk_info'] = tested_apk_config['proguard_info'] |
440 | 448 |
441 deps_info['tested_apk_path'] = tested_apk_config['apk_path'] | |
442 | |
443 # Dependencies for the final dex file of an apk or a 'deps_dex'. | 449 # Dependencies for the final dex file of an apk or a 'deps_dex'. |
444 if options.type in ['android_apk', 'deps_dex']: | 450 if options.type in ['android_apk', 'deps_dex']: |
445 config['final_dex'] = {} | 451 config['final_dex'] = {} |
446 dex_config = config['final_dex'] | 452 dex_config = config['final_dex'] |
447 dex_config['dependency_dex_files'] = deps_dex_files | 453 dex_config['dependency_dex_files'] = deps_dex_files |
448 | 454 |
449 if options.type in ('java_binary', 'java_library', 'android_apk'): | 455 if options.type in ('java_binary', 'java_library', 'android_apk'): |
450 config['javac']['classpath'] = javac_classpath | 456 config['javac']['classpath'] = javac_classpath |
451 config['java'] = { | 457 config['java'] = { |
452 'full_classpath': java_full_classpath | 458 'full_classpath': java_full_classpath |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 511 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
506 | 512 |
507 if options.depfile: | 513 if options.depfile: |
508 build_utils.WriteDepfile( | 514 build_utils.WriteDepfile( |
509 options.depfile, | 515 options.depfile, |
510 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) | 516 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) |
511 | 517 |
512 | 518 |
513 if __name__ == '__main__': | 519 if __name__ == '__main__': |
514 sys.exit(main(sys.argv[1:])) | 520 sys.exit(main(sys.argv[1:])) |
OLD | NEW |