Index: build/java.gypi |
diff --git a/build/java.gypi b/build/java.gypi |
index 2758cd17256b7567e418c86aa1a595f2dcd70082..b5e0bab3beffc04019fd19c602d7febb99757317 100644 |
--- a/build/java.gypi |
+++ b/build/java.gypi |
@@ -41,6 +41,9 @@ |
# R_package_relpath - Same as R_package, but replace each '.' with '/'. |
# java_strings_grd - The name of the grd file from which to generate localized |
# strings.xml files, if any. |
+# res_extra_dirs - A list of extra directories containing Android resources. |
+# These directories may be generated at build time. |
+# res_extra_files - A list of the files in res_extra_dirs. |
{ |
'dependencies': [ |
@@ -59,6 +62,9 @@ |
'additional_R_files': [], |
'has_java_resources%': 0, |
'java_strings_grd%': '', |
+ 'res_grit_files': [], |
+ 'res_extra_dirs': [], |
+ 'res_extra_files': [], |
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)', |
'classes_dir': '<(intermediate_dir)/classes', |
'compile_stamp': '<(intermediate_dir)/compile.stamp', |
@@ -74,14 +80,13 @@ |
['has_java_resources == 1', { |
'variables': { |
'res_dir': '<(java_in_dir)/res', |
- 'out_res_dir': '<(intermediate_dir)/res', |
+ 'res_crunched_dir': '<(intermediate_dir)/res_crunched', |
+ 'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'], |
'R_dir': '<(intermediate_dir)/java_R', |
'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
'R_text_file': '<(R_dir)/R.txt', |
'generated_src_dirs': ['<(R_dir)'], |
'additional_input_paths': ['<(R_file)'], |
- # grit_grd_file is used by grit_action.gypi, included below. |
- 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
}, |
'all_dependent_settings': { |
'variables': { |
@@ -93,17 +98,24 @@ |
# Dependent APKs include this target's resources via |
# additional_res_dirs and additional_res_packages. |
- 'additional_res_dirs': ['<(out_res_dir)', '<(res_dir)'], |
+ 'additional_res_dirs': ['<(res_crunched_dir)', '<@(res_input_dirs)'], |
'additional_res_packages': ['<(R_package)'], |
}, |
}, |
'conditions': [ |
['java_strings_grd != ""', { |
+ 'variables': { |
+ 'res_grit_dir': '<(intermediate_dir)/res_grit', |
+ 'res_input_dirs': ['<(res_grit_dir)'], |
+ 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
+ 'res_grit_files': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'], |
+ }, |
'actions': [ |
{ |
'action_name': 'generate_localized_strings_xml', |
'variables': { |
- 'grit_out_dir': '<(out_res_dir)', |
+ 'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'], |
+ 'grit_out_dir': '<(res_grit_dir)', |
# resource_ids is unneeded since we don't generate .h headers. |
'grit_resource_ids': '', |
}, |
@@ -117,19 +129,11 @@ |
{ |
'action_name': 'process_resources', |
'message': 'processing resources for <(_target_name)', |
- 'conditions': [ |
- ['java_strings_grd != ""', { |
- 'inputs': [ |
- # TODO(newt): replace this with .../values/strings.xml once |
- # the English strings.xml is generated as well? That would be |
- # simpler and faster and should be equivalent. |
- '<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(out_res_dir)" <(grit_grd_file))', |
- ], |
- }], |
- ], |
'inputs': [ |
'<(DEPTH)/build/android/process_resources.py', |
'<!@(find <(res_dir) -type f)', |
+ '<@(res_grit_files)', |
+ '<@(res_extra_files)', |
], |
'outputs': [ |
'<(R_file)', |
@@ -140,13 +144,13 @@ |
'--android-sdk-tools', '<(android_sdk_tools)', |
'--R-package', '<(R_package)', |
'--R-dir', '<(R_dir)', |
- '--res-dir', '<(res_dir)', |
- '--out-res-dir', '<(out_res_dir)', |
+ '--res-input-dirs', '<(res_input_dirs)', |
+ '--res-crunched-dir', '<(res_crunched_dir)', |
- # Add list of inputs to the command line, so if inputs change |
+ # Add hash of inputs to the command line, so if inputs change |
# (e.g. if a resource if removed), the command will be re-run. |
# TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
- '--ignore', '>(_inputs)', |
+ '--ignore', '>!(echo >(_inputs) | md5sum)', |
], |
}, |
], |