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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 'variables': { | 76 'variables': { |
77 'input_jars_paths': ['<(jar_path)'], | 77 'input_jars_paths': ['<(jar_path)'], |
78 'library_dexed_jars_paths': ['<(dex_path)'], | 78 'library_dexed_jars_paths': ['<(dex_path)'], |
79 }, | 79 }, |
80 }, | 80 }, |
81 'conditions': [ | 81 'conditions': [ |
82 ['has_java_resources == 1', { | 82 ['has_java_resources == 1', { |
83 'variables': { | 83 'variables': { |
84 'res_dir': '<(java_in_dir)/res', | 84 'res_dir': '<(java_in_dir)/res', |
85 'res_crunched_dir': '<(intermediate_dir)/res_crunched', | 85 'res_crunched_dir': '<(intermediate_dir)/res_crunched', |
| 86 'res_v14_dir': '<(intermediate_dir)/res_v14', |
| 87 'res_v14_stamp': '<(intermediate_dir)/res_v14.stamp', |
| 88 'res_v17_dir': '<(intermediate_dir)/res_v17', |
| 89 'res_v17_stamp': '<(intermediate_dir)/res_v17.stamp', |
86 'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'], | 90 'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'], |
87 'resource_input_paths': ['<!@(find <(res_dir) -type f)'], | 91 'resource_input_paths': ['<!@(find <(res_dir) -type f)'], |
88 'R_dir': '<(intermediate_dir)/java_R', | 92 'R_dir': '<(intermediate_dir)/java_R', |
89 'R_text_file': '<(R_dir)/R.txt', | 93 'R_text_file': '<(R_dir)/R.txt', |
90 'R_stamp': '<(intermediate_dir)/resources.stamp', | 94 'R_stamp': '<(intermediate_dir)/resources.stamp', |
91 'generated_src_dirs': ['<(R_dir)'], | 95 'generated_src_dirs': ['<(R_dir)'], |
92 'additional_input_paths': ['<(R_stamp)'], | 96 'additional_input_paths': ['<(R_stamp)', |
| 97 '<(res_v14_stamp)', |
| 98 '<(res_v17_stamp)',], |
93 'additional_res_dirs': [], | 99 'additional_res_dirs': [], |
| 100 'additional_res_input_dirs': [], |
94 'dependencies_res_files': [], | 101 'dependencies_res_files': [], |
95 }, | 102 }, |
96 'all_dependent_settings': { | 103 'all_dependent_settings': { |
97 'variables': { | 104 'variables': { |
98 # Dependent jars include this target's R.java file via | 105 # Dependent jars include this target's R.java file via |
99 # generated_R_dirs and include its resources via | 106 # generated_R_dirs and include its resources via |
100 # dependencies_res_files. | 107 # dependencies_res_files. |
101 'generated_R_dirs': ['<(R_dir)'], | 108 'generated_R_dirs': ['<(R_dir)'], |
102 'additional_input_paths': ['<(R_stamp)'], | 109 'additional_input_paths': ['<(R_stamp)', |
| 110 '<(res_v14_stamp)', |
| 111 '<(res_v17_stamp)',], |
103 'dependencies_res_files': ['<@(resource_input_paths)'], | 112 'dependencies_res_files': ['<@(resource_input_paths)'], |
104 | 113 |
| 114 'dependencies_res_input_dirs': ['<@(res_input_dirs)'], |
| 115 |
105 # Dependent APKs include this target's resources via | 116 # Dependent APKs include this target's resources via |
106 # additional_res_dirs, additional_res_packages, and | 117 # additional_res_dirs, additional_res_packages, and |
107 # additional_R_text_files. | 118 # additional_R_text_files. |
108 'additional_res_dirs': ['<(res_crunched_dir)', '<@(res_input_dirs)'], | 119 'additional_res_dirs': ['<(res_crunched_dir)', |
| 120 '<(res_v14_dir)', |
| 121 '<(res_v17_dir)', |
| 122 '<@(res_input_dirs)'], |
109 'additional_res_packages': ['<(R_package)'], | 123 'additional_res_packages': ['<(R_package)'], |
110 'additional_R_text_files': ['<(R_text_file)'], | 124 'additional_R_text_files': ['<(R_text_file)'], |
111 }, | 125 }, |
112 }, | 126 }, |
113 'conditions': [ | 127 'conditions': [ |
114 ['java_strings_grd != ""', { | 128 ['java_strings_grd != ""', { |
115 'variables': { | 129 'variables': { |
116 'res_grit_dir': '<(intermediate_dir)/res_grit', | 130 'res_grit_dir': '<(intermediate_dir)/res_grit', |
117 'res_input_dirs': ['<(res_grit_dir)'], | 131 'res_input_dirs': ['<(res_grit_dir)'], |
118 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', | 132 'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)', |
(...skipping 15 matching lines...) Expand all Loading... |
134 ], | 148 ], |
135 'actions': [ | 149 'actions': [ |
136 # Generate R.java and crunch image resources. | 150 # Generate R.java and crunch image resources. |
137 { | 151 { |
138 'action_name': 'process_resources', | 152 'action_name': 'process_resources', |
139 'message': 'processing resources for <(_target_name)', | 153 'message': 'processing resources for <(_target_name)', |
140 'variables': { | 154 'variables': { |
141 'android_manifest': '<(DEPTH)/build/android/AndroidManifest.xml', | 155 'android_manifest': '<(DEPTH)/build/android/AndroidManifest.xml', |
142 # Include the dependencies' res dirs so that references to | 156 # Include the dependencies' res dirs so that references to |
143 # resources in dependencies can be resolved. | 157 # resources in dependencies can be resolved. |
144 'all_res_dirs': ['<@(res_input_dirs)', '>@(additional_res_dirs)'], | 158 'all_res_dirs': ['<@(res_input_dirs)', |
| 159 '>@(dependencies_res_input_dirs)',], |
145 }, | 160 }, |
146 'inputs': [ | 161 'inputs': [ |
147 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 162 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
148 '<(DEPTH)/build/android/gyp/process_resources.py', | 163 '<(DEPTH)/build/android/gyp/process_resources.py', |
149 '>@(resource_input_paths)', | 164 '>@(resource_input_paths)', |
150 '>@(dependencies_res_files)', | 165 '>@(dependencies_res_files)', |
151 ], | 166 ], |
152 'outputs': [ | 167 'outputs': [ |
153 '<(R_stamp)', | 168 '<(R_stamp)', |
154 ], | 169 ], |
155 'action': [ | 170 'action': [ |
156 'python', '<(DEPTH)/build/android/gyp/process_resources.py', | 171 'python', '<(DEPTH)/build/android/gyp/process_resources.py', |
157 '--android-sdk', '<(android_sdk)', | 172 '--android-sdk', '<(android_sdk)', |
158 '--android-sdk-tools', '<(android_sdk_tools)', | 173 '--android-sdk-tools', '<(android_sdk_tools)', |
159 '--R-dir', '<(R_dir)', | 174 '--R-dir', '<(R_dir)', |
160 '--res-dirs', '>(all_res_dirs)', | 175 '--res-dirs', '>(all_res_dirs)', |
161 '--crunch-input-dir', '>(res_dir)', | 176 '--crunch-input-dir', '>(res_dir)', |
162 '--crunch-output-dir', '<(res_crunched_dir)', | 177 '--crunch-output-dir', '<(res_crunched_dir)', |
163 '--android-manifest', '<(android_manifest)', | 178 '--android-manifest', '<(android_manifest)', |
164 '--non-constant-id', | 179 '--non-constant-id', |
165 '--custom-package', '<(R_package)', | 180 '--custom-package', '<(R_package)', |
166 '--stamp', '<(R_stamp)', | 181 '--stamp', '<(R_stamp)', |
167 | 182 |
168 # Add hash of inputs to the command line, so if inputs change | 183 # Add hash of inputs to the command line, so if inputs change |
169 # (e.g. if a resource if removed), the command will be re-run. | 184 # (e.g. if a resource if removed), the command will be re-run. |
170 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 185 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
171 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 186 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
172 ], | 187 ], |
173 }, | 188 }, |
| 189 # Copy API 17 resources. |
| 190 { |
| 191 'action_name': 'copy_v17_resources_<(_target_name)', |
| 192 'message': 'Copying Android API 17 resources <(_target_name)', |
| 193 'inputs': [ |
| 194 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 195 '<(DEPTH)/build/android/gyp/copy_v17_resources.py', |
| 196 '>@(resource_input_paths)', |
| 197 ], |
| 198 'outputs': [ |
| 199 '<(res_v17_stamp)', |
| 200 ], |
| 201 'action': [ |
| 202 'python', '<(DEPTH)/build/android/gyp/copy_v17_resources.py', |
| 203 '--res-dir=<(res_dir)', |
| 204 '--res-v17-dir=<(res_v17_dir)', |
| 205 '--stamp', '<(res_v17_stamp)', |
| 206 ] |
| 207 }, |
| 208 # Generate API 14 resources. |
| 209 { |
| 210 'action_name': 'generate_api_14_resources_<(_target_name)', |
| 211 'message': 'Generating Android API 14 resources <(_target_name)', |
| 212 'inputs': [ |
| 213 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
| 214 '<(DEPTH)/build/android/gyp/generate_v14_resources.py', |
| 215 '>@(resource_input_paths)', |
| 216 ], |
| 217 'outputs': [ |
| 218 '<(res_v14_stamp)', |
| 219 ], |
| 220 'action': [ |
| 221 'python', '<(DEPTH)/build/android/gyp/generate_v14_resources.py', |
| 222 '--res-dir=<(res_dir)', |
| 223 '--res-v14-dir=<(res_v14_dir)', |
| 224 '--stamp', '<(res_v14_stamp)', |
| 225 ] |
| 226 }, |
174 ], | 227 ], |
175 }], | 228 }], |
176 ], | 229 ], |
177 'actions': [ | 230 'actions': [ |
178 { | 231 { |
179 'action_name': 'javac_<(_target_name)', | 232 'action_name': 'javac_<(_target_name)', |
180 'message': 'Compiling <(_target_name) java sources', | 233 'message': 'Compiling <(_target_name) java sources', |
181 'variables': { | 234 'variables': { |
182 'all_src_dirs': [ | 235 'all_src_dirs': [ |
183 '>(java_in_dir)/src', | 236 '>(java_in_dir)/src', |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 323 |
271 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. | 324 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja
. |
272 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', | 325 '--ignore=>!(echo \'>(_inputs)\' | md5sum)', |
273 | 326 |
274 '<(jar_path)', | 327 '<(jar_path)', |
275 ] | 328 ] |
276 }, | 329 }, |
277 | 330 |
278 ], | 331 ], |
279 } | 332 } |
OLD | NEW |