| 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 library resources to generate R.java and crunched images.""" | 7 """Process Android library resources to generate R.java and crunched images.""" |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 """ | 22 """ |
| 23 parser = optparse.OptionParser() | 23 parser = optparse.OptionParser() |
| 24 parser.add_option('--android-sdk', help='path to the Android SDK folder') | 24 parser.add_option('--android-sdk', help='path to the Android SDK folder') |
| 25 parser.add_option('--android-sdk-tools', | 25 parser.add_option('--android-sdk-tools', |
| 26 help='path to the Android SDK platform tools folder') | 26 help='path to the Android SDK platform tools folder') |
| 27 parser.add_option('--R-package', help='Java package for generated R.java') | 27 parser.add_option('--R-package', help='Java package for generated R.java') |
| 28 parser.add_option('--R-dir', help='directory to hold generated R.java') | 28 parser.add_option('--R-dir', help='directory to hold generated R.java') |
| 29 parser.add_option('--res-dir', help='directory containing resources') | 29 parser.add_option('--res-dir', help='directory containing resources') |
| 30 parser.add_option('--out-res-dir', | 30 parser.add_option('--out-res-dir', |
| 31 help='directory to hold crunched resources') | 31 help='directory to hold crunched resources') |
| 32 # This is part of a temporary fix for crbug.com/177552. |
| 33 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
| 34 parser.add_option('--ignore', help='this argument is ignored') |
| 32 (options, args) = parser.parse_args() | 35 (options, args) = parser.parse_args() |
| 33 | 36 |
| 34 if args: | 37 if args: |
| 35 parser.error('No positional arguments should be given.') | 38 parser.error('No positional arguments should be given.') |
| 36 | 39 |
| 37 # Check that required options have been provided. | 40 # Check that required options have been provided. |
| 38 required_options = ('android_sdk', 'android_sdk_tools', 'R_package', | 41 required_options = ('android_sdk', 'android_sdk_tools', 'R_package', |
| 39 'R_dir', 'res_dir', 'out_res_dir') | 42 'R_dir', 'res_dir', 'out_res_dir') |
| 40 for option_name in required_options: | 43 for option_name in required_options: |
| 41 if getattr(options, option_name) is None: | 44 if getattr(options, option_name) is None: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 # Crunch image resources. This shrinks png files and is necessary for 9-patch | 77 # Crunch image resources. This shrinks png files and is necessary for 9-patch |
| 75 # images to display correctly. | 78 # images to display correctly. |
| 76 subprocess.check_call([aapt, | 79 subprocess.check_call([aapt, |
| 77 'crunch', | 80 'crunch', |
| 78 '-S', options.res_dir, | 81 '-S', options.res_dir, |
| 79 '-C', options.out_res_dir]) | 82 '-C', options.out_res_dir]) |
| 80 | 83 |
| 81 | 84 |
| 82 if __name__ == '__main__': | 85 if __name__ == '__main__': |
| 83 main() | 86 main() |
| OLD | NEW |