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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
240 if options.package_name: | 241 if options.package_name: |
241 deps_info['package_name'] = options.package_name | 242 deps_info['package_name'] = options.package_name |
| 243 if options.r_text: |
| 244 deps_info['r_text'] = options.r_text |
242 | 245 |
243 if options.type == 'android_resources' or options.type == 'android_apk': | 246 if options.type == 'android_resources' or options.type == 'android_apk': |
244 config['resources'] = {} | 247 config['resources'] = {} |
245 config['resources']['dependency_zips'] = [ | 248 config['resources']['dependency_zips'] = [ |
246 c['resources_zip'] for c in all_resources_deps] | 249 c['resources_zip'] for c in all_resources_deps] |
247 config['resources']['extra_package_names'] = [] | 250 config['resources']['extra_package_names'] = [] |
| 251 config['resources']['extra_r_text_files'] = [] |
248 | 252 |
249 if options.type == 'android_apk': | 253 if options.type == 'android_apk': |
250 config['resources']['extra_package_names'] = [ | 254 config['resources']['extra_package_names'] = [ |
251 c['package_name'] for c in all_resources_deps if 'package_name' in c] | 255 c['package_name'] for c in all_resources_deps if 'package_name' in c] |
| 256 config['resources']['extra_r_text_files'] = [ |
| 257 c['r_text'] for c in all_resources_deps if 'r_text' in c] |
252 | 258 |
253 if options.type in ['android_apk', 'deps_dex']: | 259 if options.type in ['android_apk', 'deps_dex']: |
254 deps_dex_files = [c['dex_path'] for c in all_library_deps] | 260 deps_dex_files = [c['dex_path'] for c in all_library_deps] |
255 | 261 |
256 # An instrumentation test apk should exclude the dex files that are in the apk | 262 # An instrumentation test apk should exclude the dex files that are in the apk |
257 # under test. | 263 # under test. |
258 if options.type == 'android_apk' and options.tested_apk_config: | 264 if options.type == 'android_apk' and options.tested_apk_config: |
259 tested_apk_config_paths = GetAllDepsConfigsInOrder( | 265 tested_apk_config_paths = GetAllDepsConfigsInOrder( |
260 [options.tested_apk_config]) | 266 [options.tested_apk_config]) |
261 tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths] | 267 tested_apk_configs = [GetDepConfig(p) for p in tested_apk_config_paths] |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 build_utils.WriteJson(config, options.build_config, only_if_changed=True) | 320 build_utils.WriteJson(config, options.build_config, only_if_changed=True) |
315 | 321 |
316 if options.depfile: | 322 if options.depfile: |
317 build_utils.WriteDepfile( | 323 build_utils.WriteDepfile( |
318 options.depfile, | 324 options.depfile, |
319 all_deps_config_paths + build_utils.GetPythonDependencies()) | 325 all_deps_config_paths + build_utils.GetPythonDependencies()) |
320 | 326 |
321 | 327 |
322 if __name__ == '__main__': | 328 if __name__ == '__main__': |
323 sys.exit(main(sys.argv[1:])) | 329 sys.exit(main(sys.argv[1:])) |
OLD | NEW |