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

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

Issue 2633533002: Android: Instrumentation tests in gradle (Closed)
Patch Set: Fix per review. Created 3 years, 11 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 | « build/android/gradle/java.jinja ('k') | no next file » | 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 all_inputs = deps.AllConfigPaths() 373 all_inputs = deps.AllConfigPaths()
374 374
375 direct_library_deps = deps.Direct('java_library') 375 direct_library_deps = deps.Direct('java_library')
376 all_library_deps = deps.All('java_library') 376 all_library_deps = deps.All('java_library')
377 377
378 all_resources_deps = deps.All('android_resources') 378 all_resources_deps = deps.All('android_resources')
379 # Resources should be ordered with the highest-level dependency first so that 379 # Resources should be ordered with the highest-level dependency first so that
380 # overrides are done correctly. 380 # overrides are done correctly.
381 all_resources_deps.reverse() 381 all_resources_deps.reverse()
382 382
383 if options.type == 'android_apk' and options.tested_apk_config:
384 tested_apk_deps = Deps([options.tested_apk_config])
385 tested_apk_resources_deps = tested_apk_deps.All('android_resources')
386 all_resources_deps = [
387 d for d in all_resources_deps if not d in tested_apk_resources_deps]
388
389 # Initialize some common config. 383 # Initialize some common config.
390 # Any value that needs to be queryable by dependents must go within deps_info. 384 # Any value that needs to be queryable by dependents must go within deps_info.
391 config = { 385 config = {
392 'deps_info': { 386 'deps_info': {
393 'name': os.path.basename(options.build_config), 387 'name': os.path.basename(options.build_config),
394 'path': options.build_config, 388 'path': options.build_config,
395 'type': options.type, 389 'type': options.type,
396 'deps_configs': direct_deps_config_paths 390 'deps_configs': direct_deps_config_paths
397 }, 391 },
398 # Info needed only by generate_gradle.py. 392 # Info needed only by generate_gradle.py.
399 'gradle': {} 393 'gradle': {}
400 } 394 }
401 deps_info = config['deps_info'] 395 deps_info = config['deps_info']
402 gradle = config['gradle'] 396 gradle = config['gradle']
403 397
398 if options.type == 'android_apk' and options.tested_apk_config:
399 tested_apk_deps = Deps([options.tested_apk_config])
400 tested_apk_name = tested_apk_deps.Direct()[0]['name']
401 tested_apk_resources_deps = tested_apk_deps.All('android_resources')
402 gradle['apk_under_test'] = tested_apk_name
403 all_resources_deps = [
404 d for d in all_resources_deps if not d in tested_apk_resources_deps]
405
404 # Required for generating gradle files. 406 # Required for generating gradle files.
405 if options.type == 'java_library': 407 if options.type == 'java_library':
406 deps_info['is_prebuilt'] = is_java_prebuilt 408 deps_info['is_prebuilt'] = is_java_prebuilt
407 deps_info['gradle_treat_as_prebuilt'] = options.gradle_treat_as_prebuilt 409 deps_info['gradle_treat_as_prebuilt'] = options.gradle_treat_as_prebuilt
408 410
409 if options.android_manifest: 411 if options.android_manifest:
410 gradle['android_manifest'] = options.android_manifest 412 gradle['android_manifest'] = options.android_manifest
411 if options.type in ('java_binary', 'java_library', 'android_apk'): 413 if options.type in ('java_binary', 'java_library', 'android_apk'):
412 if options.java_sources_file: 414 if options.java_sources_file:
413 gradle['java_sources_file'] = options.java_sources_file 415 gradle['java_sources_file'] = options.java_sources_file
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 deps_info['java_resources_jar'] = options.java_resources_jar_path 704 deps_info['java_resources_jar'] = options.java_resources_jar_path
703 705
704 build_utils.WriteJson(config, options.build_config, only_if_changed=True) 706 build_utils.WriteJson(config, options.build_config, only_if_changed=True)
705 707
706 if options.depfile: 708 if options.depfile:
707 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs) 709 build_utils.WriteDepfile(options.depfile, options.build_config, all_inputs)
708 710
709 711
710 if __name__ == '__main__': 712 if __name__ == '__main__':
711 sys.exit(main(sys.argv[1:])) 713 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/gradle/java.jinja ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698