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

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: rebase 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/findbugs_filter/findbugs_known_bugs.txt ('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 e4342063e9be3977e8d3a0e1776854e56f4db64a..215b562ba5f8d1e94866a49f24708f4ebbc8f64b 100644
--- a/build/java.gypi
+++ b/build/java.gypi
@@ -38,6 +38,12 @@
# empty, which leads to inclusion of all files specified. May include
# wildcard, and supports '**/' for recursive path wildcards, ie.:
# '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'.
+# 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': [
@@ -53,10 +59,67 @@
'variables': {
'input_jars_paths': [],
'additional_src_dirs': [],
- 'additional_input_paths': [],
- 'generated_src_dirs': [],
'javac_includes': [],
+ 'additional_input_paths': ['>@(additional_R_files)'],
+ 'generated_src_dirs': ['>@(generated_R_dirs)'],
+ 'generated_R_dirs': [],
+ 'additional_R_files': [],
+ 'has_java_resources%': 0,
},
+ 'conditions': [
+ ['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)',
+ ],
+ },
+ ],
+ }],
+ ],
'actions': [
{
'action_name': 'ant_<(package_name)',
« no previous file with comments | « build/android/findbugs_filter/findbugs_known_bugs.txt ('k') | build/java_apk.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698