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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 '-I', android_jar, | 97 '-I', android_jar, |
98 '--output-text-symbols', options.R_dir, | 98 '--output-text-symbols', options.R_dir, |
99 '-J', options.R_dir] | 99 '-J', options.R_dir] |
100 res_dirs = shlex.split(options.res_dirs) | 100 res_dirs = shlex.split(options.res_dirs) |
101 for res_dir in res_dirs: | 101 for res_dir in res_dirs: |
102 package_command += ['-S', res_dir] | 102 package_command += ['-S', res_dir] |
103 if options.non_constant_id: | 103 if options.non_constant_id: |
104 package_command.append('--non-constant-id') | 104 package_command.append('--non-constant-id') |
105 if options.custom_package: | 105 if options.custom_package: |
106 package_command += ['--custom-package', options.custom_package] | 106 package_command += ['--custom-package', options.custom_package] |
107 build_utils.CheckCallDie(package_command) | 107 build_utils.CheckOutput(package_command) |
108 | 108 |
109 # Crunch image resources. This shrinks png files and is necessary for 9-patch | 109 # Crunch image resources. This shrinks png files and is necessary for 9-patch |
110 # images to display correctly. | 110 # images to display correctly. |
111 build_utils.MakeDirectory(options.crunch_output_dir) | 111 build_utils.MakeDirectory(options.crunch_output_dir) |
112 aapt_cmd = [aapt, | 112 aapt_cmd = [aapt, |
113 'crunch', | 113 'crunch', |
114 '-S', options.crunch_input_dir, | 114 '-S', options.crunch_input_dir, |
115 '-C', options.crunch_output_dir] | 115 '-C', options.crunch_output_dir] |
116 build_utils.CheckCallDie(aapt_cmd, suppress_output=True, fail_if_stderr=True) | 116 build_utils.CheckOutput(aapt_cmd, fail_if_stderr=True) |
117 | 117 |
118 MoveImagesToNonMdpiFolders(options.crunch_output_dir) | 118 MoveImagesToNonMdpiFolders(options.crunch_output_dir) |
119 | 119 |
120 if options.stamp: | 120 if options.stamp: |
121 build_utils.Touch(options.stamp) | 121 build_utils.Touch(options.stamp) |
122 | 122 |
123 | 123 |
124 if __name__ == '__main__': | 124 if __name__ == '__main__': |
125 main() | 125 main() |
OLD | NEW |