| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 help='directory to hold generated R.java.') | 62 help='directory to hold generated R.java.') |
| 63 parser.add_option('--srcjar-out', | 63 parser.add_option('--srcjar-out', |
| 64 help='Path to srcjar to contain generated R.java.') | 64 help='Path to srcjar to contain generated R.java.') |
| 65 parser.add_option('--r-text-out', | 65 parser.add_option('--r-text-out', |
| 66 help='Path to store the R.txt file generated by appt.') | 66 help='Path to store the R.txt file generated by appt.') |
| 67 | 67 |
| 68 parser.add_option('--proguard-file', | 68 parser.add_option('--proguard-file', |
| 69 help='Path to proguard.txt generated file') | 69 help='Path to proguard.txt generated file') |
| 70 | 70 |
| 71 parser.add_option( | 71 parser.add_option( |
| 72 '--v14-verify-only', | |
| 73 action='store_true', | |
| 74 help='Do not generate v14 resources. Instead, just verify that the ' | |
| 75 'resources are already compatible with v14, i.e. they don\'t use ' | |
| 76 'attributes that cause crashes on certain devices.') | |
| 77 parser.add_option( | |
| 78 '--v14-skip', | 72 '--v14-skip', |
| 79 action="store_true", | 73 action="store_true", |
| 80 help='Do not generate nor verify v14 resources') | 74 help='Do not generate nor verify v14 resources') |
| 81 | 75 |
| 82 parser.add_option( | 76 parser.add_option( |
| 83 '--extra-res-packages', | 77 '--extra-res-packages', |
| 84 help='Additional package names to generate R.java files for') | 78 help='Additional package names to generate R.java files for') |
| 85 parser.add_option( | 79 parser.add_option( |
| 86 '--extra-r-text-files', | 80 '--extra-r-text-files', |
| 87 help='For each additional package, the R.txt file should contain a ' | 81 help='For each additional package, the R.txt file should contain a ' |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 315 |
| 322 gen_dir = os.path.join(temp_dir, 'gen') | 316 gen_dir = os.path.join(temp_dir, 'gen') |
| 323 build_utils.MakeDirectory(gen_dir) | 317 build_utils.MakeDirectory(gen_dir) |
| 324 | 318 |
| 325 input_resource_dirs = build_utils.ParseGypList(options.resource_dirs) | 319 input_resource_dirs = build_utils.ParseGypList(options.resource_dirs) |
| 326 | 320 |
| 327 if not options.v14_skip: | 321 if not options.v14_skip: |
| 328 for resource_dir in input_resource_dirs: | 322 for resource_dir in input_resource_dirs: |
| 329 generate_v14_compatible_resources.GenerateV14Resources( | 323 generate_v14_compatible_resources.GenerateV14Resources( |
| 330 resource_dir, | 324 resource_dir, |
| 331 v14_dir, | 325 v14_dir) |
| 332 options.v14_verify_only) | |
| 333 | 326 |
| 334 dep_zips = build_utils.ParseGypList(options.dependencies_res_zips) | 327 dep_zips = build_utils.ParseGypList(options.dependencies_res_zips) |
| 335 input_files += dep_zips | 328 input_files += dep_zips |
| 336 dep_subdirs = [] | 329 dep_subdirs = [] |
| 337 for z in dep_zips: | 330 for z in dep_zips: |
| 338 subdir = os.path.join(deps_dir, os.path.basename(z)) | 331 subdir = os.path.join(deps_dir, os.path.basename(z)) |
| 339 if os.path.exists(subdir): | 332 if os.path.exists(subdir): |
| 340 raise Exception('Resource zip name conflict: ' + os.path.basename(z)) | 333 raise Exception('Resource zip name conflict: ' + os.path.basename(z)) |
| 341 build_utils.ExtractAll(z, path=subdir) | 334 build_utils.ExtractAll(z, path=subdir) |
| 342 dep_subdirs.append(subdir) | 335 dep_subdirs.append(subdir) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if options.depfile: | 411 if options.depfile: |
| 419 input_files += build_utils.GetPythonDependencies() | 412 input_files += build_utils.GetPythonDependencies() |
| 420 build_utils.WriteDepfile(options.depfile, input_files) | 413 build_utils.WriteDepfile(options.depfile, input_files) |
| 421 | 414 |
| 422 if options.stamp: | 415 if options.stamp: |
| 423 build_utils.Touch(options.stamp) | 416 build_utils.Touch(options.stamp) |
| 424 | 417 |
| 425 | 418 |
| 426 if __name__ == '__main__': | 419 if __name__ == '__main__': |
| 427 main() | 420 main() |
| OLD | NEW |