Index: build/android/process_resources.py |
diff --git a/build/android/process_resources.py b/build/android/process_resources.py |
index a5e28787658b8dd10da73d39b68c6e2b2ed91d52..24390f619685f4cdd21dc01a730bc60134769196 100755 |
--- a/build/android/process_resources.py |
+++ b/build/android/process_resources.py |
@@ -8,6 +8,7 @@ |
import optparse |
import os |
+import shlex |
import subprocess |
@@ -26,8 +27,9 @@ def ParseArgs(): |
help='path to the Android SDK platform tools folder') |
parser.add_option('--R-package', help='Java package for generated R.java') |
parser.add_option('--R-dir', help='directory to hold generated R.java') |
- parser.add_option('--res-dir', help='directory containing resources') |
- parser.add_option('--out-res-dir', |
+ parser.add_option('--res-input-dirs', |
+ help='list of directories containing resources') |
+ parser.add_option('--res-crunched-dir', |
help='directory to hold crunched resources') |
# This is part of a temporary fix for crbug.com/177552. |
# TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
@@ -39,9 +41,9 @@ def ParseArgs(): |
# Check that required options have been provided. |
required_options = ('android_sdk', 'android_sdk_tools', 'R_package', |
- 'R_dir', 'res_dir', 'out_res_dir') |
+ 'R_dir', 'res_input_dirs', 'res_crunched_dir') |
for option_name in required_options: |
- if getattr(options, option_name) is None: |
+ if not getattr(options, option_name): |
parser.error('--%s is required' % option_name.replace('_', '-')) |
return options |
@@ -53,6 +55,11 @@ def main(): |
aapt = os.path.join(options.android_sdk_tools, 'aapt') |
dummy_manifest = os.path.join(BUILD_ANDROID_DIR, 'AndroidManifest.xml') |
+ res_dirs = shlex.split(options.res_input_dirs) |
+ res_dirs_args = [] |
+ for res_dir in res_dirs: |
+ res_dirs_args += ['-S', res_dir] |
+ |
# Generate R.java. This R.java contains non-final constants and is used only |
# while compiling the library jar (e.g. chromium_content.jar). When building |
# an apk, a new R.java file with the correct resource -> ID mappings will be |
@@ -64,22 +71,18 @@ def main(): |
'--non-constant-id', |
'--custom-package', options.R_package, |
'-M', dummy_manifest, |
- '-S', options.res_dir, |
'--auto-add-overlay', |
'-I', android_jar, |
'--output-text-symbols', options.R_dir, |
- '-J', options.R_dir] |
- # If strings.xml was generated from a grd file, it will be in out_res_dir. |
- if os.path.isdir(options.out_res_dir): |
- package_command += ['-S', options.out_res_dir] |
+ '-J', options.R_dir] + res_dirs_args |
cjhopman
2013/03/19 20:27:37
Maybe break before the + like below
|
subprocess.check_call(package_command) |
# Crunch image resources. This shrinks png files and is necessary for 9-patch |
# images to display correctly. |
subprocess.check_call([aapt, |
'crunch', |
- '-S', options.res_dir, |
- '-C', options.out_res_dir]) |
+ '-C', options.res_crunched_dir] |
+ + res_dirs_args) |
if __name__ == '__main__': |