Index: build/java.gypi |
diff --git a/build/java.gypi b/build/java.gypi |
index 56af2e1175f9085102b7c5cf92c12d707c513352..accd359bf99b20d538faf0c33db4cafe509d4ceb 100644 |
--- a/build/java.gypi |
+++ b/build/java.gypi |
@@ -34,6 +34,13 @@ |
# included in the 'inputs' list (unlike additional_src_dirs). |
# input_jars_paths - The path to jars to be included in the classpath. This |
# should be filled automatically by depending on the appropriate targets. |
+# has_java_resources - Set to 1 if the java target contains an |
+# Android-compatible resources folder named res. If 1, R_package and |
+# R_package_path_ must also be set. |
+# R_package - The java package in which the R class (which maps resources to |
+# integer IDs) should be generated, e.g. org.chromium.content. |
+# R_package_path_ - Same as R_package, but replace each '.' with '/'. (The |
cjhopman
2012/11/09 22:21:30
Instead of the trailing underscore, you could have
newt (away)
2012/11/09 23:05:35
I considered that... though it could break if some
|
+# trailing underscore prevents gyp's pathname relativization.) |
{ |
'dependencies': [ |
@@ -51,6 +58,7 @@ |
'additional_src_dirs': [], |
'additional_input_paths': [], |
'generated_src_dirs': [], |
+ 'has_java_resources%': 0, |
}, |
'actions': [ |
{ |
@@ -87,4 +95,48 @@ |
] |
}, |
], |
+ 'conditions': [ |
+ ['has_java_resources == 1', { |
+ 'variables': { |
+ 'generated_src_dirs': ['<(INTERMEDIATE_DIR)/R'], |
+ 'additional_input_paths': ['<(INTERMEDIATE_DIR)/R/<(R_package_path_)/R.java'], |
+ }, |
+ 'all_dependent_settings': { |
+ 'variables': { |
+ 'additional_res_dirs': ['<(java_in_dir)/res'], |
+ 'additional_res_packages': ['<(R_package)'], |
+ }, |
+ }, |
+ 'actions': [ |
+ # Generate R.java for the library. 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 generated by merging the |
+ # resources from all libraries and the main apk project. |
+ { |
+ 'action_name': 'generate_r_java', |
+ 'message': 'generating R.java for <(package_name)', |
+ 'inputs': [ |
+ '<(android_sdk_tools)/aapt', |
+ '<(android_sdk)/android.jar', |
+ '<(java_in_dir)/AndroidManifest.xml', |
+ '<!@(find <(java_in_dir)/res -type f)', |
+ ], |
+ 'outputs': [ |
+ '<(INTERMEDIATE_DIR)/R/<(R_package_path_)/R.java', |
+ ], |
+ 'action': [ |
+ '<(android_sdk_tools)/aapt', |
+ 'package', |
+ '-m', |
+ '--non-constant-id', |
+ '-M', '<(java_in_dir)/AndroidManifest.xml', |
+ '-S', '<(java_in_dir)/res', |
+ '-I', '<(android_sdk)/android.jar', |
+ '-J', '<(INTERMEDIATE_DIR)/R', |
+ ], |
+ }, |
+ ], |
+ }], |
+ ], |
} |