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 20 matching lines...) Expand all Loading... |
31 parser = optparse.OptionParser() | 31 parser = optparse.OptionParser() |
32 build_utils.AddDepfileOption(parser) | 32 build_utils.AddDepfileOption(parser) |
33 | 33 |
34 parser.add_option('--android-sdk', help='path to the Android SDK folder') | 34 parser.add_option('--android-sdk', help='path to the Android SDK folder') |
35 parser.add_option('--android-sdk-tools', | 35 parser.add_option('--android-sdk-tools', |
36 help='path to the Android SDK build tools folder') | 36 help='path to the Android SDK build tools folder') |
37 parser.add_option('--non-constant-id', action='store_true') | 37 parser.add_option('--non-constant-id', action='store_true') |
38 | 38 |
39 parser.add_option('--android-manifest', help='AndroidManifest.xml path') | 39 parser.add_option('--android-manifest', help='AndroidManifest.xml path') |
40 parser.add_option('--custom-package', help='Java package for R.java') | 40 parser.add_option('--custom-package', help='Java package for R.java') |
| 41 parser.add_option( |
| 42 '--shared-resources', |
| 43 action='store_true', |
| 44 help='Make a resource package that can be loaded by a different' |
| 45 'application at runtime to access the package\'s resources.') |
41 | 46 |
42 parser.add_option('--resource-dirs', | 47 parser.add_option('--resource-dirs', |
43 help='Directories containing resources of this target.') | 48 help='Directories containing resources of this target.') |
44 parser.add_option('--dependencies-res-zips', | 49 parser.add_option('--dependencies-res-zips', |
45 help='Resources from dependents.') | 50 help='Resources from dependents.') |
46 | 51 |
47 parser.add_option('--resource-zip-out', | 52 parser.add_option('--resource-zip-out', |
48 help='Path for output zipped resources.') | 53 help='Path for output zipped resources.') |
49 | 54 |
50 parser.add_option('--R-dir', | 55 parser.add_option('--R-dir', |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 234 |
230 for d in dep_subdirs: | 235 for d in dep_subdirs: |
231 package_command += ['-S', d] | 236 package_command += ['-S', d] |
232 | 237 |
233 if options.non_constant_id: | 238 if options.non_constant_id: |
234 package_command.append('--non-constant-id') | 239 package_command.append('--non-constant-id') |
235 if options.custom_package: | 240 if options.custom_package: |
236 package_command += ['--custom-package', options.custom_package] | 241 package_command += ['--custom-package', options.custom_package] |
237 if options.proguard_file: | 242 if options.proguard_file: |
238 package_command += ['-G', options.proguard_file] | 243 package_command += ['-G', options.proguard_file] |
| 244 if options.shared_resources: |
| 245 package_command.append('--shared-lib') |
239 build_utils.CheckOutput(package_command, print_stderr=False) | 246 build_utils.CheckOutput(package_command, print_stderr=False) |
240 | 247 |
241 if options.extra_res_packages: | 248 if options.extra_res_packages: |
242 CreateExtraRJavaFiles( | 249 CreateExtraRJavaFiles( |
243 gen_dir, | 250 gen_dir, |
244 build_utils.ParseGypList(options.extra_res_packages)) | 251 build_utils.ParseGypList(options.extra_res_packages)) |
245 | 252 |
246 # This is the list of directories with resources to put in the final .zip | 253 # This is the list of directories with resources to put in the final .zip |
247 # file. The order of these is important so that crunched/v14 resources | 254 # file. The order of these is important so that crunched/v14 resources |
248 # override the normal ones. | 255 # override the normal ones. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 if options.depfile: | 287 if options.depfile: |
281 input_files += build_utils.GetPythonDependencies() | 288 input_files += build_utils.GetPythonDependencies() |
282 build_utils.WriteDepfile(options.depfile, input_files) | 289 build_utils.WriteDepfile(options.depfile, input_files) |
283 | 290 |
284 if options.stamp: | 291 if options.stamp: |
285 build_utils.Touch(options.stamp) | 292 build_utils.Touch(options.stamp) |
286 | 293 |
287 | 294 |
288 if __name__ == '__main__': | 295 if __name__ == '__main__': |
289 main() | 296 main() |
OLD | NEW |