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 27 matching lines...) Expand all Loading... |
38 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 38 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
39 parser.add_option('--ignore', help='this argument is ignored') | 39 parser.add_option('--ignore', help='this argument is ignored') |
40 (options, args) = parser.parse_args() | 40 (options, args) = parser.parse_args() |
41 | 41 |
42 if args: | 42 if args: |
43 parser.error('No positional arguments should be given.') | 43 parser.error('No positional arguments should be given.') |
44 | 44 |
45 # Check that required options have been provided. | 45 # Check that required options have been provided. |
46 required_options = ('android_sdk', 'android_sdk_tools', 'R_dir', 'res_dirs', | 46 required_options = ('android_sdk', 'android_sdk_tools', 'R_dir', 'res_dirs', |
47 'crunch_input_dir', 'crunch_output_dir') | 47 'crunch_input_dir', 'crunch_output_dir') |
48 for option_name in required_options: | 48 build_utils.CheckOptions(options, parser, required=required_options) |
49 if not getattr(options, option_name): | |
50 parser.error('--%s is required' % option_name.replace('_', '-')) | |
51 | 49 |
52 return options | 50 return options |
53 | 51 |
54 | 52 |
55 def main(): | 53 def main(): |
56 options = ParseArgs() | 54 options = ParseArgs() |
57 android_jar = os.path.join(options.android_sdk, 'android.jar') | 55 android_jar = os.path.join(options.android_sdk, 'android.jar') |
58 aapt = os.path.join(options.android_sdk_tools, 'aapt') | 56 aapt = os.path.join(options.android_sdk_tools, 'aapt') |
59 | 57 |
60 build_utils.MakeDirectory(options.R_dir) | 58 build_utils.MakeDirectory(options.R_dir) |
(...skipping 29 matching lines...) Expand all Loading... |
90 '-S', options.crunch_input_dir, | 88 '-S', options.crunch_input_dir, |
91 '-C', options.crunch_output_dir] | 89 '-C', options.crunch_output_dir] |
92 build_utils.CheckCallDie(aapt_cmd) | 90 build_utils.CheckCallDie(aapt_cmd) |
93 | 91 |
94 if options.stamp: | 92 if options.stamp: |
95 build_utils.Touch(options.stamp) | 93 build_utils.Touch(options.stamp) |
96 | 94 |
97 | 95 |
98 if __name__ == '__main__': | 96 if __name__ == '__main__': |
99 main() | 97 main() |
OLD | NEW |