OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Java in a consistent manner. | 6 # to build Java in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my-package_java', | 10 # 'target_name': 'my-package_java', |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 'javac_includes': [], | 62 'javac_includes': [], |
63 'additional_input_paths': ['>@(additional_R_files)'], | 63 'additional_input_paths': ['>@(additional_R_files)'], |
64 'generated_src_dirs': ['>@(generated_R_dirs)'], | 64 'generated_src_dirs': ['>@(generated_R_dirs)'], |
65 'generated_R_dirs': [], | 65 'generated_R_dirs': [], |
66 'additional_R_files': [], | 66 'additional_R_files': [], |
67 'has_java_resources%': 0, | 67 'has_java_resources%': 0, |
68 }, | 68 }, |
69 'conditions': [ | 69 'conditions': [ |
70 ['has_java_resources == 1', { | 70 ['has_java_resources == 1', { |
71 'variables': { | 71 'variables': { |
| 72 'res_dir': '<(java_in_dir)/res', |
| 73 'crunched_res_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/res', |
72 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', | 74 'R_dir': '<(SHARED_INTERMEDIATE_DIR)/<(package_name)/java_R', |
73 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', | 75 'R_file': '<(R_dir)/<(R_package_relpath)/R.java', |
74 'generated_src_dirs': ['<(R_dir)'], | 76 'generated_src_dirs': ['<(R_dir)'], |
75 'additional_input_paths': ['<(R_file)'], | 77 'additional_input_paths': ['<(R_file)'], |
76 }, | 78 }, |
77 'all_dependent_settings': { | 79 'all_dependent_settings': { |
78 'variables': { | 80 'variables': { |
79 # Dependent jars include this target's R.java file via | 81 # Dependent jars include this target's R.java file via |
80 # generated_R_dirs and additional_R_files. | 82 # generated_R_dirs and additional_R_files. |
81 'generated_R_dirs': ['<(R_dir)'], | 83 'generated_R_dirs': ['<(R_dir)'], |
82 'additional_R_files': ['<(R_file)'], | 84 'additional_R_files': ['<(R_file)'], |
83 | 85 |
84 # Dependent APKs include this target's resources via | 86 # Dependent APKs include this target's resources via |
85 # additional_res_dirs and additional_res_packages. | 87 # additional_res_dirs and additional_res_packages. |
86 'additional_res_dirs': ['<(java_in_dir)/res'], | 88 'additional_res_dirs': ['<(crunched_res_dir)', '<(res_dir)'], |
87 'additional_res_packages': ['<(R_package)'], | 89 'additional_res_packages': ['<(R_package)'], |
88 }, | 90 }, |
89 }, | 91 }, |
90 'actions': [ | 92 'actions': [ |
91 # Generate R.java for the library. This R.java contains non-final | 93 # Generate R.java and crunch image resources. |
92 # constants and is used only while compiling the library jar (e.g. | |
93 # chromium_content.jar). When building an apk, a new R.java file with | |
94 # the correct resource -> ID mappings will be generated by merging the | |
95 # resources from all libraries and the main apk project. | |
96 { | 94 { |
97 'action_name': 'generate_r_java', | 95 'action_name': 'process_resources', |
98 'message': 'generating R.java for <(package_name)', | 96 'message': 'processing resources for <(package_name)', |
99 'inputs': [ | 97 'inputs': [ |
100 '<(android_sdk_tools)/aapt', | 98 '<(DEPTH)/build/android/process_resources.py', |
101 '<(android_sdk)/android.jar', | 99 '<!@(find <(res_dir) -type f)', |
102 '<(DEPTH)/build/android/AndroidManifest.xml', | |
103 '<!@(find <(java_in_dir)/res -type f)', | |
104 ], | 100 ], |
105 'outputs': [ | 101 'outputs': [ |
106 '<(R_file)', | 102 '<(R_file)', |
107 ], | 103 ], |
108 'action': [ | 104 'action': [ |
109 '<(android_sdk_tools)/aapt', | 105 '<(DEPTH)/build/android/process_resources.py', |
110 'package', | 106 '--android-sdk', '<(android_sdk)', |
111 '-m', | 107 '--android-sdk-tools', '<(android_sdk_tools)', |
112 '--non-constant-id', | 108 '--R-package', '<(R_package)', |
113 '--custom-package', '<(R_package)', | 109 '--R-dir', '<(R_dir)', |
114 '-M', '<(DEPTH)/build/android/AndroidManifest.xml', | 110 '--res-dir', '<(res_dir)', |
115 '-S', '<(java_in_dir)/res', | 111 '--crunched-res-dir', '<(crunched_res_dir)', |
116 '-I', '<(android_sdk)/android.jar', | |
117 '-J', '<(R_dir)', | |
118 ], | 112 ], |
119 }, | 113 }, |
120 ], | 114 ], |
121 }], | 115 }], |
122 ], | 116 ], |
123 'actions': [ | 117 'actions': [ |
124 { | 118 { |
125 'action_name': 'ant_<(package_name)', | 119 'action_name': 'ant_<(package_name)', |
126 'message': 'Building <(package_name) java sources.', | 120 'message': 'Building <(package_name) java sources.', |
127 'inputs': [ | 121 'inputs': [ |
(...skipping 22 matching lines...) Expand all Loading... |
150 '-DPACKAGE_NAME=<(package_name)', | 144 '-DPACKAGE_NAME=<(package_name)', |
151 '-DJAVAC_INCLUDES=>(javac_includes)', | 145 '-DJAVAC_INCLUDES=>(javac_includes)', |
152 | 146 |
153 '-Dbasedir=<(java_in_dir)', | 147 '-Dbasedir=<(java_in_dir)', |
154 '-buildfile', | 148 '-buildfile', |
155 '<(DEPTH)/build/android/ant/chromium-jars.xml' | 149 '<(DEPTH)/build/android/ant/chromium-jars.xml' |
156 ] | 150 ] |
157 }, | 151 }, |
158 ], | 152 ], |
159 } | 153 } |
OLD | NEW |