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

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

Issue 1136653002: Reland: Actually use --extra-r-text-files in process_resources.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits Created 5 years, 7 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 help='Type of this target (e.g. android_library).') 93 help='Type of this target (e.g. android_library).')
94 parser.add_option( 94 parser.add_option(
95 '--possible-deps-configs', 95 '--possible-deps-configs',
96 help='List of paths for dependency\'s build_config files. Some ' 96 help='List of paths for dependency\'s build_config files. Some '
97 'dependencies may not write build_config files. Missing build_config ' 97 'dependencies may not write build_config files. Missing build_config '
98 'files are handled differently based on the type of this target.') 98 'files are handled differently based on the type of this target.')
99 99
100 # android_resources options 100 # android_resources options
101 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.') 101 parser.add_option('--srcjar', help='Path to target\'s resources srcjar.')
102 parser.add_option('--resources-zip', help='Path to target\'s resources zip.') 102 parser.add_option('--resources-zip', help='Path to target\'s resources zip.')
103 parser.add_option('--r-text', help='Path to target\'s R.txt file.')
103 parser.add_option('--package-name', 104 parser.add_option('--package-name',
104 help='Java package name for these resources.') 105 help='Java package name for these resources.')
105 parser.add_option('--android-manifest', help='Path to android manifest.') 106 parser.add_option('--android-manifest', help='Path to android manifest.')
106 107
107 # java library options 108 # java library options
108 parser.add_option('--jar-path', help='Path to target\'s jar output.') 109 parser.add_option('--jar-path', help='Path to target\'s jar output.')
109 parser.add_option('--supports-android', action='store_true', 110 parser.add_option('--supports-android', action='store_true',
110 help='Whether this library supports running on the Android platform.') 111 help='Whether this library supports running on the Android platform.')
111 parser.add_option('--requires-android', action='store_true', 112 parser.add_option('--requires-android', action='store_true',
112 help='Whether this library requires running on the Android platform.') 113 help='Whether this library requires running on the Android platform.')
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 c['srcjar'] for c in direct_resources_deps if 'srcjar' in c] 231 c['srcjar'] for c in direct_resources_deps if 'srcjar' in c]
231 232
232 if options.type == 'android_apk': 233 if options.type == 'android_apk':
233 # Apks will get their resources srcjar explicitly passed to the java step. 234 # Apks will get their resources srcjar explicitly passed to the java step.
234 config['javac']['srcjars'] = [] 235 config['javac']['srcjars'] = []
235 236
236 if options.type == 'android_resources': 237 if options.type == 'android_resources':
237 deps_info['resources_zip'] = options.resources_zip 238 deps_info['resources_zip'] = options.resources_zip
238 if options.srcjar: 239 if options.srcjar:
239 deps_info['srcjar'] = options.srcjar 240 deps_info['srcjar'] = options.srcjar
241 if options.android_manifest:
242 manifest = AndroidManifest(options.android_manifest)
243 deps_info['package_name'] = manifest.GetPackageName()
240 if options.package_name: 244 if options.package_name:
241 deps_info['package_name'] = options.package_name 245 deps_info['package_name'] = options.package_name
246 if options.r_text:
247 deps_info['r_text'] = options.r_text
242 248
243 if options.type == 'android_resources' or options.type == 'android_apk': 249 if options.type == 'android_resources' or options.type == 'android_apk':
244 config['resources'] = {} 250 config['resources'] = {}
245 config['resources']['dependency_zips'] = [ 251 config['resources']['dependency_zips'] = [
246 c['resources_zip'] for c in all_resources_deps] 252 c['resources_zip'] for c in all_resources_deps]
247 config['resources']['extra_package_names'] = [] 253 config['resources']['extra_package_names'] = []
254 config['resources']['extra_r_text_files'] = []
248 255
249 if options.type == 'android_apk': 256 if options.type == 'android_apk':
250 config['resources']['extra_package_names'] = [ 257 config['resources']['extra_package_names'] = [
251 c['package_name'] for c in all_resources_deps if 'package_name' in c] 258 c['package_name'] for c in all_resources_deps if 'package_name' in c]
259 config['resources']['extra_r_text_files'] = [
260 c['r_text'] for c in all_resources_deps if 'r_text' in c]
252 261
253 if options.type in ['android_apk', 'deps_dex']: 262 if options.type in ['android_apk', 'deps_dex']:
254 deps_dex_files = [c['dex_path'] for c in all_library_deps] 263 deps_dex_files = [c['dex_path'] for c in all_library_deps]
255 264
256 # An instrumentation test apk should exclude the dex files that are in the apk 265 # An instrumentation test apk should exclude the dex files that are in the apk
257 # under test. 266 # under test.
258 if options.type == 'android_apk' and options.tested_apk_config: 267 if options.type == 'android_apk' and options.tested_apk_config:
259 tested_apk_config_paths = GetAllDepsConfigsInOrder( 268 tested_apk_config_paths = GetAllDepsConfigsInOrder(
260 [options.tested_apk_config]) 269 [options.tested_apk_config])
261 tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths] 270 tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths]
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 build_utils.WriteJson(config, options.build_config, only_if_changed=True) 323 build_utils.WriteJson(config, options.build_config, only_if_changed=True)
315 324
316 if options.depfile: 325 if options.depfile:
317 build_utils.WriteDepfile( 326 build_utils.WriteDepfile(
318 options.depfile, 327 options.depfile,
319 all_deps_config_paths + build_utils.GetPythonDependencies()) 328 all_deps_config_paths + build_utils.GetPythonDependencies())
320 329
321 330
322 if __name__ == '__main__': 331 if __name__ == '__main__':
323 sys.exit(main(sys.argv[1:])) 332 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698