OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 """Process Android resources to generate R.java, and prepare for packaging. | 7 """Process Android resources to generate R.java, and prepare for packaging. |
8 | 8 |
9 This will crunch images and generate v14 compatible resources | 9 This will crunch images and generate v14 compatible resources |
10 (see generate_v14_compatible_resources.py). | 10 (see generate_v14_compatible_resources.py). |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 parser.add_option( | 64 parser.add_option( |
65 '--extra-res-packages', | 65 '--extra-res-packages', |
66 help='Additional package names to generate R.java files for') | 66 help='Additional package names to generate R.java files for') |
67 parser.add_option( | 67 parser.add_option( |
68 '--extra-r-text-files', | 68 '--extra-r-text-files', |
69 help='For each additional package, the R.txt file should contain a ' | 69 help='For each additional package, the R.txt file should contain a ' |
70 'list of resources to be included in the R.java file in the format ' | 70 'list of resources to be included in the R.java file in the format ' |
71 'generated by aapt') | 71 'generated by aapt') |
72 | 72 |
| 73 parser.add_option( |
| 74 '--all-resources-zip-out', |
| 75 help='Path for output of all resources. This includes resources in ' |
| 76 'dependencies.') |
| 77 |
73 parser.add_option('--stamp', help='File to touch on success') | 78 parser.add_option('--stamp', help='File to touch on success') |
74 | 79 |
75 (options, args) = parser.parse_args(args) | 80 (options, args) = parser.parse_args(args) |
76 | 81 |
77 if args: | 82 if args: |
78 parser.error('No positional arguments should be given.') | 83 parser.error('No positional arguments should be given.') |
79 | 84 |
80 # Check that required options have been provided. | 85 # Check that required options have been provided. |
81 required_options = ( | 86 required_options = ( |
82 'android_sdk', | 87 'android_sdk', |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 build_utils.MakeDirectory(crunch_dir) | 240 build_utils.MakeDirectory(crunch_dir) |
236 zip_resource_dirs.append(crunch_dir) | 241 zip_resource_dirs.append(crunch_dir) |
237 aapt_cmd = [aapt, | 242 aapt_cmd = [aapt, |
238 'crunch', | 243 'crunch', |
239 '-C', crunch_dir, | 244 '-C', crunch_dir, |
240 '-S', d] | 245 '-S', d] |
241 build_utils.CheckOutput(aapt_cmd, fail_func=DidCrunchFail) | 246 build_utils.CheckOutput(aapt_cmd, fail_func=DidCrunchFail) |
242 | 247 |
243 ZipResources(zip_resource_dirs, options.resource_zip_out) | 248 ZipResources(zip_resource_dirs, options.resource_zip_out) |
244 | 249 |
| 250 if options.all_resources_zip_out: |
| 251 ZipResources( |
| 252 zip_resource_dirs + dep_subdirs, options.all_resources_zip_out) |
| 253 |
245 if options.R_dir: | 254 if options.R_dir: |
246 build_utils.DeleteDirectory(options.R_dir) | 255 build_utils.DeleteDirectory(options.R_dir) |
247 shutil.copytree(gen_dir, options.R_dir) | 256 shutil.copytree(gen_dir, options.R_dir) |
248 else: | 257 else: |
249 build_utils.ZipDir(options.srcjar_out, gen_dir) | 258 build_utils.ZipDir(options.srcjar_out, gen_dir) |
250 | 259 |
251 if options.depfile: | 260 if options.depfile: |
252 input_files += build_utils.GetPythonDependencies() | 261 input_files += build_utils.GetPythonDependencies() |
253 build_utils.WriteDepfile(options.depfile, input_files) | 262 build_utils.WriteDepfile(options.depfile, input_files) |
254 | 263 |
255 if options.stamp: | 264 if options.stamp: |
256 build_utils.Touch(options.stamp) | 265 build_utils.Touch(options.stamp) |
257 | 266 |
258 | 267 |
259 if __name__ == '__main__': | 268 if __name__ == '__main__': |
260 main() | 269 main() |
OLD | NEW |