Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: build/android/gyp/write_build_config.py

Issue 1690983002: Reland of Make instrumentation_test_apk depend on their apk_under_test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dist-jar
Patch Set: fix proguard failure Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 proguard_enabled = options.proguard_enabled 417 proguard_enabled = options.proguard_enabled
418 if options.type == 'android_apk': 418 if options.type == 'android_apk':
419 deps_info['proguard_enabled'] = proguard_enabled 419 deps_info['proguard_enabled'] = proguard_enabled
420 420
421 if proguard_enabled: 421 if proguard_enabled:
422 deps_info['proguard_info'] = options.proguard_info 422 deps_info['proguard_info'] = options.proguard_info
423 config['proguard'] = {} 423 config['proguard'] = {}
424 proguard_config = config['proguard'] 424 proguard_config = config['proguard']
425 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath 425 proguard_config['input_paths'] = [options.jar_path] + java_full_classpath
426 proguard_config['tested_apk_info'] = ''
427 426
428 # An instrumentation test apk should exclude the dex files that are in the apk 427 # An instrumentation test apk should exclude the dex files that are in the apk
429 # under test. 428 # under test.
430 if options.type == 'android_apk' and options.tested_apk_config: 429 if options.type == 'android_apk' and options.tested_apk_config:
431 tested_apk_library_deps = tested_apk_deps.All('java_library') 430 tested_apk_library_deps = tested_apk_deps.All('java_library')
432 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps] 431 tested_apk_deps_dex_files = [c['dex_path'] for c in tested_apk_library_deps]
433 # Include in the classpath classes that are added directly to the apk under 432 # Include in the classpath classes that are added directly to the apk under
434 # test (those that are not a part of a java_library). 433 # test (those that are not a part of a java_library).
435 tested_apk_config = GetDepConfig(options.tested_apk_config) 434 tested_apk_config = GetDepConfig(options.tested_apk_config)
436 javac_classpath.append(tested_apk_config['jar_path']) 435 javac_classpath.append(tested_apk_config['jar_path'])
437 # Exclude dex files from the test apk that exist within the apk under test. 436 # Exclude dex files from the test apk that exist within the apk under test.
438 deps_dex_files = [ 437 deps_dex_files = [
439 p for p in deps_dex_files if not p in tested_apk_deps_dex_files] 438 p for p in deps_dex_files if not p in tested_apk_deps_dex_files]
440 439
441 expected_tested_package = tested_apk_config['package_name'] 440 expected_tested_package = tested_apk_config['package_name']
442 AndroidManifest(options.android_manifest).CheckInstrumentation( 441 AndroidManifest(options.android_manifest).CheckInstrumentation(
443 expected_tested_package) 442 expected_tested_package)
444 if tested_apk_config['proguard_enabled']: 443 if tested_apk_config['proguard_enabled']:
445 assert proguard_enabled, ('proguard must be enabled for instrumentation' 444 assert proguard_enabled, ('proguard must be enabled for instrumentation'
446 ' apks if it\'s enabled for the tested apk') 445 ' apks if it\'s enabled for the tested apk')
447 proguard_config['tested_apk_info'] = tested_apk_config['proguard_info']
jbudorick 2016/02/12 15:33:23 What's the reasoning behind removing this? I can't
agrieve 2016/02/12 15:47:11 It aligns with the change to the proguard rule in
jbudorick 2016/02/12 16:33:28 Makes sense.
448 446
449 # Dependencies for the final dex file of an apk or a 'deps_dex'. 447 # Dependencies for the final dex file of an apk or a 'deps_dex'.
450 if options.type in ['android_apk', 'deps_dex']: 448 if options.type in ['android_apk', 'deps_dex']:
451 config['final_dex'] = {} 449 config['final_dex'] = {}
452 dex_config = config['final_dex'] 450 dex_config = config['final_dex']
453 dex_config['dependency_dex_files'] = deps_dex_files 451 dex_config['dependency_dex_files'] = deps_dex_files
454 452
455 if options.type in ('java_binary', 'java_library', 'android_apk'): 453 if options.type in ('java_binary', 'java_library', 'android_apk'):
456 config['javac']['classpath'] = javac_classpath 454 config['javac']['classpath'] = javac_classpath
457 config['java'] = { 455 config['java'] = {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 build_utils.WriteJson(config, options.build_config, only_if_changed=True) 509 build_utils.WriteJson(config, options.build_config, only_if_changed=True)
512 510
513 if options.depfile: 511 if options.depfile:
514 build_utils.WriteDepfile( 512 build_utils.WriteDepfile(
515 options.depfile, 513 options.depfile,
516 deps.AllConfigPaths() + build_utils.GetPythonDependencies()) 514 deps.AllConfigPaths() + build_utils.GetPythonDependencies())
517 515
518 516
519 if __name__ == '__main__': 517 if __name__ == '__main__':
520 sys.exit(main(sys.argv[1:])) 518 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698