Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: build/java.gypi

Issue 11363150: Support Java resources within content and chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: provide access to resources of dependencies (take 2) Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/ant/chromium-jars.xml ('k') | build/java_apk.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/java.gypi
diff --git a/build/java.gypi b/build/java.gypi
index 56af2e1175f9085102b7c5cf92c12d707c513352..a961ad8dea5b8130878d543f6ee6b62e347902c8 100644
--- a/build/java.gypi
+++ b/build/java.gypi
@@ -34,6 +34,12 @@
# 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_relpath 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_relpath - Same as R_package, but replace each '.' with '/'.
{
'dependencies': [
@@ -49,8 +55,11 @@
'variables': {
'input_jars_paths': [],
'additional_src_dirs': [],
- 'additional_input_paths': [],
- 'generated_src_dirs': [],
+ 'additional_input_paths': ['>@(additional_R_files)'],
+ 'generated_src_dirs': ['>@(generated_R_dirs)'],
+ 'generated_R_dirs': [],
+ 'additional_R_files': [],
+ 'has_java_resources%': 0,
},
'actions': [
{
@@ -87,4 +96,58 @@
]
},
],
+ 'conditions': [
cjhopman 2012/11/14 00:34:41 I think this block should go before the previous a
newt (away) 2012/11/14 03:28:50 I just noticed that other gyp files tend to put co
cjhopman 2012/11/14 21:16:19 Yeah, I think it would be better to move it up.
+ ['has_java_resources == 1', {
+ 'variables': {
+ 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R',
+ 'R_file': '<(R_dir)/<(R_package_relpath)/R.java',
+ 'generated_src_dirs': ['<(R_dir)'],
+ 'additional_input_paths': ['<(R_file)'],
+ },
+ 'all_dependent_settings': {
+ 'variables': {
+ # Dependent jars include this target's R.java file via
+ # generated_R_dirs and additional_R_files.
+ 'generated_R_dirs': ['<(R_dir)'],
+ 'additional_R_files': ['<(R_file)'],
+
+ # Dependent APKs include this target's resources via
+ # additional_res_dirs and additional_res_packages.
+ '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',
+ '<(DEPTH)/build/android/AndroidManifest.xml',
+ '<!@(find <(java_in_dir)/res -type f)',
+ ],
+ 'outputs': [
+ '<(R_file)',
+ ],
+ 'action': [
+ '<(android_sdk_tools)/aapt',
+ 'package',
+ '-m',
+ '--non-constant-id',
+ '--custom-package', '<(R_package)',
+ '-M', '<(DEPTH)/build/android/AndroidManifest.xml',
+ '-S', '<(java_in_dir)/res',
+ '-I', '<(android_sdk)/android.jar',
+ '-J', '<(R_dir)',
+ ],
+ },
+ ],
+ }],
+ ],
}
« no previous file with comments | « build/android/ant/chromium-jars.xml ('k') | build/java_apk.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698