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

Side by Side Diff: build/config/android/internal_rules.gni

Issue 766573003: gn format //build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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 unified diff | Download patch
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 6
7 assert(is_android) 7 assert(is_android)
8 8
9
10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir)
11 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir)
12 rebased_android_sdk_build_tools = rebase_path(android_sdk_build_tools, root_buil d_dir) 11 rebased_android_sdk_build_tools =
12 rebase_path(android_sdk_build_tools, root_build_dir)
13 13
14 android_sdk_jar = "$android_sdk/android.jar" 14 android_sdk_jar = "$android_sdk/android.jar"
15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) 15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
16 16
17 template("android_lint") { 17 template("android_lint") {
18 if (defined(invoker.testonly)) { testonly = invoker.testonly } 18 if (defined(invoker.testonly)) {
19 testonly = invoker.testonly
20 }
19 21
20 jar_path = invoker.jar_path 22 jar_path = invoker.jar_path
21 android_manifest = invoker.android_manifest 23 android_manifest = invoker.android_manifest
22 java_files = invoker.java_files 24 java_files = invoker.java_files
23 base_path = "$target_gen_dir/$target_name" 25 base_path = "$target_gen_dir/$target_name"
24 26
25 action(target_name) { 27 action(target_name) {
26 script = "//build/android/gyp/lint.py" 28 script = "//build/android/gyp/lint.py"
27 result_path = base_path + "/result.xml" 29 result_path = base_path + "/result.xml"
28 config_path = base_path + "/config.xml" 30 config_path = base_path + "/config.xml"
29 suppressions_file = "//build/android/lint/suppressions.xml" 31 suppressions_file = "//build/android/lint/suppressions.xml"
30 inputs = [ 32 inputs = [
31 suppressions_file, 33 suppressions_file,
32 android_manifest, 34 android_manifest,
33 jar_path, 35 jar_path,
34 ] + java_files 36 ] + java_files
35 37
36 outputs = [ 38 outputs = [
37 config_path, 39 config_path,
38 result_path 40 result_path,
39 ] 41 ]
40 42
41 rebased_java_files = rebase_path(java_files, root_build_dir) 43 rebased_java_files = rebase_path(java_files, root_build_dir)
42 44
43 args = [ 45 args = [
44 "--lint-path=$rebased_android_sdk_root/tools/lint", 46 "--lint-path=$rebased_android_sdk_root/tools/lint",
45 "--config-path", rebase_path(suppressions_file, root_build_dir), 47 "--config-path",
46 "--manifest-path", rebase_path(android_manifest, root_build_dir), 48 rebase_path(suppressions_file, root_build_dir),
49 "--manifest-path",
50 rebase_path(android_manifest, root_build_dir),
47 "--product-dir=.", 51 "--product-dir=.",
48 "--jar-path", rebase_path(jar_path, root_build_dir), 52 "--jar-path",
49 "--processed-config-path", rebase_path(config_path, root_build_dir), 53 rebase_path(jar_path, root_build_dir),
50 "--result-path", rebase_path(result_path, root_build_dir), 54 "--processed-config-path",
55 rebase_path(config_path, root_build_dir),
56 "--result-path",
57 rebase_path(result_path, root_build_dir),
51 "--java-files=$rebased_java_files", 58 "--java-files=$rebased_java_files",
52 "--enable", 59 "--enable",
53 ] 60 ]
54 } 61 }
55 } 62 }
56 63
57
58 template("dex") { 64 template("dex") {
59 if (defined(invoker.testonly)) { testonly = invoker.testonly } 65 if (defined(invoker.testonly)) {
66 testonly = invoker.testonly
67 }
60 68
61 assert(defined(invoker.sources)) 69 assert(defined(invoker.sources))
62 assert(defined(invoker.output)) 70 assert(defined(invoker.output))
63 action(target_name) { 71 action(target_name) {
64 script = "//build/android/gyp/dex.py" 72 script = "//build/android/gyp/dex.py"
65 depfile = "$target_gen_dir/$target_name.d" 73 depfile = "$target_gen_dir/$target_name.d"
66 sources = invoker.sources 74 sources = invoker.sources
67 outputs = [depfile, invoker.output] 75 outputs = [
76 depfile,
77 invoker.output,
78 ]
68 if (defined(invoker.inputs)) { 79 if (defined(invoker.inputs)) {
69 inputs = invoker.inputs 80 inputs = invoker.inputs
70 } 81 }
71 82
72 if (defined(invoker.deps)) { 83 if (defined(invoker.deps)) {
73 deps = invoker.deps 84 deps = invoker.deps
74 } 85 }
75 86
76 rebased_output = rebase_path(invoker.output, root_build_dir) 87 rebased_output = rebase_path(invoker.output, root_build_dir)
77 88
78 args = [ 89 args = [
79 "--depfile", rebase_path(depfile, root_build_dir), 90 "--depfile",
80 "--android-sdk-tools", rebased_android_sdk_build_tools, 91 rebase_path(depfile, root_build_dir),
81 "--dex-path", rebased_output, 92 "--android-sdk-tools",
93 rebased_android_sdk_build_tools,
94 "--dex-path",
95 rebased_output,
82 ] 96 ]
83 97
84 if (defined(invoker.no_locals) && invoker.no_locals) { 98 if (defined(invoker.no_locals) && invoker.no_locals) {
85 args += [ 99 args += [ "--no-locals=1" ]
86 "--no-locals=1"
87 ]
88 } 100 }
89 101
90 if (defined(invoker.args)) { 102 if (defined(invoker.args)) {
91 args += invoker.args 103 args += invoker.args
92 } 104 }
93 105
94 args += rebase_path(invoker.sources, root_build_dir) 106 args += rebase_path(invoker.sources, root_build_dir)
95 } 107 }
96 } 108 }
97 109
98
99 # Creates a zip archive of the inputs. 110 # Creates a zip archive of the inputs.
100 # If base_dir is provided, the archive paths will be relative to it. 111 # If base_dir is provided, the archive paths will be relative to it.
101 template("zip") { 112 template("zip") {
102 if (defined(invoker.testonly)) { testonly = invoker.testonly } 113 if (defined(invoker.testonly)) {
114 testonly = invoker.testonly
115 }
103 116
104 assert(defined(invoker.inputs)) 117 assert(defined(invoker.inputs))
105 assert(defined(invoker.output)) 118 assert(defined(invoker.output))
106 119
107 rebase_inputs = rebase_path(invoker.inputs, root_build_dir) 120 rebase_inputs = rebase_path(invoker.inputs, root_build_dir)
108 rebase_output = rebase_path(invoker.output, root_build_dir) 121 rebase_output = rebase_path(invoker.output, root_build_dir)
109 action(target_name) { 122 action(target_name) {
110 script = "//build/android/gn/zip.py" 123 script = "//build/android/gn/zip.py"
111 depfile = "$target_gen_dir/$target_name.d" 124 depfile = "$target_gen_dir/$target_name.d"
112 inputs = invoker.inputs 125 inputs = invoker.inputs
113 outputs = [ 126 outputs = [
114 depfile, 127 depfile,
115 invoker.output 128 invoker.output,
116 ] 129 ]
117 args = [ 130 args = [
118 "--depfile", rebase_path(depfile, root_build_dir), 131 "--depfile",
132 rebase_path(depfile, root_build_dir),
119 "--inputs=$rebase_inputs", 133 "--inputs=$rebase_inputs",
120 "--output=$rebase_output", 134 "--output=$rebase_output",
121 ] 135 ]
122 if (defined(invoker.base_dir)) { 136 if (defined(invoker.base_dir)) {
123 args += [ 137 args += [
124 "--base-dir", rebase_path(invoker.base_dir, root_build_dir) 138 "--base-dir",
139 rebase_path(invoker.base_dir, root_build_dir),
125 ] 140 ]
126 } 141 }
127 } 142 }
128 } 143 }
129 144
130
131 # Write the target's .build_config file. This is a json file that contains a 145 # Write the target's .build_config file. This is a json file that contains a
132 # dictionary of information about how to build this target (things that 146 # dictionary of information about how to build this target (things that
133 # require knowledge about this target's dependencies and cannot be calculated 147 # require knowledge about this target's dependencies and cannot be calculated
134 # at gn-time). There is a special syntax to add a value in that dictionary to 148 # at gn-time). There is a special syntax to add a value in that dictionary to
135 # an action/action_foreachs args: 149 # an action/action_foreachs args:
136 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) 150 # --python-arg=@FileArg($rebased_build_config_path:key0:key1)
137 # At runtime, such an arg will be replaced by the value in the build_config. 151 # At runtime, such an arg will be replaced by the value in the build_config.
138 # See build/android/gyp/write_build_config.py and 152 # See build/android/gyp/write_build_config.py and
139 # build/android/gyp/util/build_utils.py:ExpandFileArgs 153 # build/android/gyp/util/build_utils.py:ExpandFileArgs
140 template("write_build_config") { 154 template("write_build_config") {
141 if (defined(invoker.testonly)) { testonly = invoker.testonly } 155 if (defined(invoker.testonly)) {
156 testonly = invoker.testonly
157 }
142 158
143 assert(defined(invoker.type)) 159 assert(defined(invoker.type))
144 assert(defined(invoker.build_config)) 160 assert(defined(invoker.build_config))
145 161
146 type = invoker.type 162 type = invoker.type
147 build_config = invoker.build_config 163 build_config = invoker.build_config
148 164
149 assert(type == "android_apk" || type == "java_library" || type == "android_res ources") 165 assert(type == "android_apk" || type == "java_library" ||
166 type == "android_resources")
150 167
151 action(target_name) { 168 action(target_name) {
152 script = "//build/android/gyp/write_build_config.py" 169 script = "//build/android/gyp/write_build_config.py"
153 depfile = "$target_gen_dir/$target_name.d" 170 depfile = "$target_gen_dir/$target_name.d"
154 inputs = [] 171 inputs = []
155 172
156 deps = [] 173 deps = []
157 if (defined(invoker.deps)) { 174 if (defined(invoker.deps)) {
158 deps += invoker.deps 175 deps += invoker.deps
159 } 176 }
160 177
161 possible_deps_configs = [] 178 possible_deps_configs = []
162 foreach(d, deps) { 179 foreach(d, deps) {
163 dep_gen_dir = get_label_info(d, "target_gen_dir") 180 dep_gen_dir = get_label_info(d, "target_gen_dir")
164 dep_name = get_label_info(d, "name") 181 dep_name = get_label_info(d, "name")
165 possible_deps_configs += [ "$dep_gen_dir/$dep_name.build_config" ] 182 possible_deps_configs += [ "$dep_gen_dir/$dep_name.build_config" ]
166 } 183 }
167 rebase_possible_deps_configs = rebase_path(possible_deps_configs) 184 rebase_possible_deps_configs = rebase_path(possible_deps_configs)
168 185
169 outputs = [ 186 outputs = [
170 depfile, 187 depfile,
171 build_config 188 build_config,
172 ] 189 ]
173 190
174 args = [ 191 args = [
175 "--type", type, 192 "--type",
176 "--depfile", rebase_path(depfile, root_build_dir), 193 type,
194 "--depfile",
195 rebase_path(depfile, root_build_dir),
177 "--possible-deps-configs=$rebase_possible_deps_configs", 196 "--possible-deps-configs=$rebase_possible_deps_configs",
178 "--build-config", rebase_path(build_config, root_build_dir), 197 "--build-config",
198 rebase_path(build_config, root_build_dir),
179 ] 199 ]
180 200
181 is_java_library = type == "java_library" 201 is_java_library = type == "java_library"
182 is_apk = type == "android_apk" 202 is_apk = type == "android_apk"
183 is_android_resources = type == "android_resources" 203 is_android_resources = type == "android_resources"
184 204
185 supports_android = (is_apk || is_android_resources || 205 supports_android = is_apk || is_android_resources ||
186 (is_java_library && defined(invoker.supports_android) && 206 (is_java_library && defined(invoker.supports_android) &&
187 invoker.supports_android)) 207 invoker.supports_android)
188 requires_android = (is_apk || is_android_resources || 208 requires_android = is_apk || is_android_resources ||
189 (is_java_library && defined(invoker.requires_android) && 209 (is_java_library && defined(invoker.requires_android) &&
190 invoker.requires_android)) 210 invoker.requires_android)
191 211
192 assert(!requires_android || supports_android, "requires_android requires" + 212 assert(!requires_android || supports_android,
193 " supports_android") 213 "requires_android requires" + " supports_android")
214
194 # Mark these variables as used. 215 # Mark these variables as used.
195 assert(is_java_library || true) 216 assert(is_java_library || true)
196 assert(is_apk || true) 217 assert(is_apk || true)
197 assert(is_android_resources || true) 218 assert(is_android_resources || true)
198 219
199 if (is_java_library || is_apk) { 220 if (is_java_library || is_apk) {
200 args += [ 221 args += [
201 "--jar-path", rebase_path(invoker.jar_path, root_build_dir), 222 "--jar-path",
223 rebase_path(invoker.jar_path, root_build_dir),
202 ] 224 ]
203 } 225 }
204 226
205 if (is_apk || (is_java_library && supports_android)) { 227 if (is_apk || (is_java_library && supports_android)) {
206 args += [ 228 args += [
207 "--dex-path", rebase_path(invoker.dex_path, root_build_dir), 229 "--dex-path",
230 rebase_path(invoker.dex_path, root_build_dir),
208 ] 231 ]
209 } 232 }
210 if (supports_android) { 233 if (supports_android) {
211 args += [ "--supports-android" ] 234 args += [ "--supports-android" ]
212 } 235 }
213 if (requires_android) { 236 if (requires_android) {
214 args += [ "--requires-android" ] 237 args += [ "--requires-android" ]
215 } 238 }
216 if (defined(invoker.bypass_platform_checks) && 239 if (defined(invoker.bypass_platform_checks) &&
217 invoker.bypass_platform_checks) { 240 invoker.bypass_platform_checks) {
218 args += [ "--bypass-platform-checks" ] 241 args += [ "--bypass-platform-checks" ]
219 } 242 }
220 243
221 if (is_android_resources || is_apk) { 244 if (is_android_resources || is_apk) {
222 assert(defined(invoker.resources_zip)) 245 assert(defined(invoker.resources_zip))
223 args += [ 246 args += [
224 "--resources-zip", rebase_path(invoker.resources_zip, root_build_dir), 247 "--resources-zip",
248 rebase_path(invoker.resources_zip, root_build_dir),
225 ] 249 ]
226 if (defined(invoker.android_manifest)) { 250 if (defined(invoker.android_manifest)) {
227 inputs += [ 251 inputs += [ invoker.android_manifest ]
228 invoker.android_manifest
229 ]
230 args += [ 252 args += [
231 "--android-manifest", rebase_path(invoker.android_manifest, root_build _dir), 253 "--android-manifest",
254 rebase_path(invoker.android_manifest, root_build_dir),
232 ] 255 ]
233 } 256 }
234 if (defined(invoker.custom_package)) { 257 if (defined(invoker.custom_package)) {
235 args += [ 258 args += [
236 "--package-name", invoker.custom_package 259 "--package-name",
260 invoker.custom_package,
237 ] 261 ]
238 } 262 }
239 } 263 }
240 264
241 if (is_apk) { 265 if (is_apk) {
242 if (defined(invoker.native_libs)) { 266 if (defined(invoker.native_libs)) {
243 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) 267 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir)
244 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) 268 rebased_android_readelf = rebase_path(android_readelf, root_build_dir)
245 args += [ 269 args += [
246 "--native-libs=$rebased_native_libs", 270 "--native-libs=$rebased_native_libs",
247 "--readelf-path=$rebased_android_readelf", 271 "--readelf-path=$rebased_android_readelf",
248 ] 272 ]
249 } 273 }
250 } 274 }
251 275
252 if (defined(invoker.srcjar)) { 276 if (defined(invoker.srcjar)) {
253 args += [ 277 args += [
254 "--srcjar", rebase_path(invoker.srcjar, root_build_dir) 278 "--srcjar",
279 rebase_path(invoker.srcjar, root_build_dir),
255 ] 280 ]
256 } 281 }
257 } 282 }
258 } 283 }
259 284
260
261 template("process_java_prebuilt") { 285 template("process_java_prebuilt") {
262 if (defined(invoker.testonly)) { testonly = invoker.testonly } 286 if (defined(invoker.testonly)) {
287 testonly = invoker.testonly
288 }
263 289
264 _input_jar_path = invoker.input_jar_path 290 _input_jar_path = invoker.input_jar_path
265 _output_jar_path = invoker.output_jar_path 291 _output_jar_path = invoker.output_jar_path
266 _jar_toc_path = _output_jar_path + ".TOC" 292 _jar_toc_path = _output_jar_path + ".TOC"
267 293
268 assert(invoker.build_config != "") 294 assert(invoker.build_config != "")
269 295
270 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 296 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
271 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar" 297 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar"
272 _proguard_config_path = invoker.proguard_config 298 _proguard_config_path = invoker.proguard_config
273 _build_config = invoker.build_config 299 _build_config = invoker.build_config
274 _rebased_build_config = rebase_path(_build_config, root_build_dir) 300 _rebased_build_config = rebase_path(_build_config, root_build_dir)
275 action("${target_name}__proguard_process") { 301 action("${target_name}__proguard_process") {
276 script = "//build/android/gyp/proguard.py" 302 script = "//build/android/gyp/proguard.py"
277 inputs = [ 303 inputs = [
278 android_sdk_jar, 304 android_sdk_jar,
279 _proguard_jar_path, 305 _proguard_jar_path,
280 _build_config, 306 _build_config,
281 _input_jar_path, 307 _input_jar_path,
282 _proguard_config_path, 308 _proguard_config_path,
283 ] 309 ]
284 depfile = "${target_gen_dir}/${target_name}.d" 310 depfile = "${target_gen_dir}/${target_name}.d"
285 outputs = [ 311 outputs = [
286 depfile, 312 depfile,
287 _output_jar_path, 313 _output_jar_path,
288 ] 314 ]
289 args = [ 315 args = [
290 "--depfile", rebase_path(depfile, root_build_dir), 316 "--depfile",
291 "--proguard-path", rebase_path(_proguard_jar_path, root_build_dir), 317 rebase_path(depfile, root_build_dir),
292 "--input-path", rebase_path(_input_jar_path, root_build_dir), 318 "--proguard-path",
293 "--output-path", rebase_path(_output_jar_path, root_build_dir), 319 rebase_path(_proguard_jar_path, root_build_dir),
294 "--proguard-config", rebase_path(_proguard_config_path, root_build_dir), 320 "--input-path",
295 "--classpath", rebased_android_sdk_jar, 321 rebase_path(_input_jar_path, root_build_dir),
322 "--output-path",
323 rebase_path(_output_jar_path, root_build_dir),
324 "--proguard-config",
325 rebase_path(_proguard_config_path, root_build_dir),
326 "--classpath",
327 rebased_android_sdk_jar,
296 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", 328 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
297 ] 329 ]
298 } 330 }
299 } else { 331 } else {
300 copy("${target_name}__copy_jar") { 332 copy("${target_name}__copy_jar") {
301 sources = [_input_jar_path] 333 sources = [
302 outputs = [_output_jar_path] 334 _input_jar_path,
335 ]
336 outputs = [ _output_jar_path ]
303 } 337 }
304 } 338 }
305 339
306 action("${target_name}__jar_toc") { 340 action("${target_name}__jar_toc") {
307 script = "//build/android/gyp/jar_toc.py" 341 script = "//build/android/gyp/jar_toc.py"
308 depfile = "$target_gen_dir/$target_name.d" 342 depfile = "$target_gen_dir/$target_name.d"
309 outputs = [ 343 outputs = [
310 depfile, 344 depfile,
311 _jar_toc_path, 345 _jar_toc_path,
312 _jar_toc_path + ".md5.stamp" 346 _jar_toc_path + ".md5.stamp",
313 ] 347 ]
314 inputs = [ _output_jar_path ] 348 inputs = [
349 _output_jar_path,
350 ]
315 args = [ 351 args = [
316 "--depfile", rebase_path(depfile, root_build_dir), 352 "--depfile",
317 "--jar-path", rebase_path(_output_jar_path, root_build_dir), 353 rebase_path(depfile, root_build_dir),
318 "--toc-path", rebase_path(_jar_toc_path, root_build_dir), 354 "--jar-path",
355 rebase_path(_output_jar_path, root_build_dir),
356 "--toc-path",
357 rebase_path(_jar_toc_path, root_build_dir),
319 ] 358 ]
320 } 359 }
321 360
322 group(target_name) { 361 group(target_name) {
323 deps = [ 362 deps = [
324 ":${target_name}__jar_toc" 363 ":${target_name}__jar_toc",
325 ] 364 ]
326 } 365 }
327 } 366 }
328 367
329
330 # Packages resources, assets, dex, and native libraries into an apk. Signs and 368 # Packages resources, assets, dex, and native libraries into an apk. Signs and
331 # zipaligns the apk. 369 # zipaligns the apk.
332 template("create_apk") { 370 template("create_apk") {
333 if (defined(invoker.testonly)) { testonly = invoker.testonly } 371 if (defined(invoker.testonly)) {
372 testonly = invoker.testonly
373 }
334 374
335 _android_manifest = invoker.android_manifest 375 _android_manifest = invoker.android_manifest
336 _base_path = invoker.base_path 376 _base_path = invoker.base_path
337 _final_apk_path = invoker.apk_path 377 _final_apk_path = invoker.apk_path
338 _resources_zip = invoker.resources_zip 378 _resources_zip = invoker.resources_zip
339 _dex_path = invoker.dex_path 379 _dex_path = invoker.dex_path
340 _keystore_path = invoker.keystore_path 380 _keystore_path = invoker.keystore_path
341 _keystore_name = invoker.keystore_name 381 _keystore_name = invoker.keystore_name
342 _keystore_password = invoker.keystore_password 382 _keystore_password = invoker.keystore_password
343 _load_library_from_apk = invoker.load_library_from_apk 383 _load_library_from_apk = invoker.load_library_from_apk
344 384
345 _deps = [] 385 _deps = []
346 if (defined(invoker.deps)) { 386 if (defined(invoker.deps)) {
347 _deps = invoker.deps 387 _deps = invoker.deps
348 } 388 }
349 389
350 _native_libs_dir = "//build/android/empty/res" 390 _native_libs_dir = "//build/android/empty/res"
351 if (defined(invoker.native_libs_dir)) { 391 if (defined(invoker.native_libs_dir)) {
352 _native_libs_dir = invoker.native_libs_dir 392 _native_libs_dir = invoker.native_libs_dir
353 } 393 }
354 394
355 _asset_location = "//build/android/empty/res" 395 _asset_location = "//build/android/empty/res"
356 if (defined(invoker.asset_location)) { 396 if (defined(invoker.asset_location)) {
357 _asset_location = invoker.asset_location 397 _asset_location = invoker.asset_location
358 } 398 }
359 399
360 _version_code = invoker.version_code 400 _version_code = invoker.version_code
361 _version_name = invoker.version_name 401 _version_name = invoker.version_name
362 402
363 _base_apk_path = _base_path + ".apk_intermediates" 403 _base_apk_path = _base_path + ".apk_intermediates"
364 404
365 _resource_packaged_apk_path = _base_apk_path + ".ap_" 405 _resource_packaged_apk_path = _base_apk_path + ".ap_"
366 _packaged_apk_path = _base_apk_path + ".unfinished.apk" 406 _packaged_apk_path = _base_apk_path + ".unfinished.apk"
367 _shared_resources = defined(invoker.shared_resources) && invoker.shared_resour ces 407 _shared_resources =
368 408 defined(invoker.shared_resources) && invoker.shared_resources
369 409
370 _configuration_name = "Release" 410 _configuration_name = "Release"
371 if (is_debug) { 411 if (is_debug) {
372 _configuration_name = "Debug" 412 _configuration_name = "Debug"
373 } 413 }
374 414
375 action("${target_name}__package_resources") { 415 action("${target_name}__package_resources") {
376 deps = _deps 416 deps = _deps
377 417
378 script = "//build/android/gyp/package_resources.py" 418 script = "//build/android/gyp/package_resources.py"
379 depfile = "${target_gen_dir}/${target_name}.d" 419 depfile = "${target_gen_dir}/${target_name}.d"
380 inputs = [ 420 inputs = [
381 _android_manifest, 421 _android_manifest,
382 _resources_zip, 422 _resources_zip,
383 ] 423 ]
384 outputs = [depfile, _resource_packaged_apk_path] 424 outputs = [
425 depfile,
426 _resource_packaged_apk_path,
427 ]
385 428
386 _rebased_resources_zips = [rebase_path(_resources_zip, root_build_dir)] 429 _rebased_resources_zips = [ rebase_path(_resources_zip, root_build_dir) ]
387 args = [ 430 args = [
388 "--depfile", rebase_path(depfile, root_build_dir), 431 "--depfile",
389 "--android-sdk", rebased_android_sdk, 432 rebase_path(depfile, root_build_dir),
390 "--android-sdk-tools", rebased_android_sdk_build_tools, 433 "--android-sdk",
391 434 rebased_android_sdk,
392 "--configuration-name=$_configuration_name", 435 "--android-sdk-tools",
393 436 rebased_android_sdk_build_tools,
394 "--android-manifest", rebase_path(_android_manifest, root_build_dir), 437 "--configuration-name=$_configuration_name",
395 "--version-code", _version_code, 438 "--android-manifest",
396 "--version-name", _version_name, 439 rebase_path(_android_manifest, root_build_dir),
397 440 "--version-code",
398 "--asset-dir", rebase_path(_asset_location, root_build_dir), 441 _version_code,
399 "--resource-zips=$_rebased_resources_zips", 442 "--version-name",
400 443 _version_name,
401 "--apk-path", rebase_path(_resource_packaged_apk_path, root_build_dir), 444 "--asset-dir",
402 ] 445 rebase_path(_asset_location, root_build_dir),
446 "--resource-zips=$_rebased_resources_zips",
447 "--apk-path",
448 rebase_path(_resource_packaged_apk_path, root_build_dir),
449 ]
403 450
404 if (_shared_resources) { 451 if (_shared_resources) {
405 args += ["--shared-resources"] 452 args += [ "--shared-resources" ]
406 } 453 }
407 } 454 }
408 455
409 action("${target_name}__package") { 456 action("${target_name}__package") {
410 script = "//build/android/gyp/ant.py" 457 script = "//build/android/gyp/ant.py"
411 _ant_script = "//build/android/ant/apk-package.xml" 458 _ant_script = "//build/android/ant/apk-package.xml"
412 459
413 depfile = "$target_gen_dir/$target_name.d" 460 depfile = "$target_gen_dir/$target_name.d"
414 461
415 inputs = [ 462 inputs = [
416 _dex_path, 463 _dex_path,
417 _resource_packaged_apk_path, 464 _resource_packaged_apk_path,
418 _ant_script 465 _ant_script,
419 ] 466 ]
420 467
421 outputs = [ 468 outputs = [
422 depfile, 469 depfile,
423 _packaged_apk_path, 470 _packaged_apk_path,
424 ] 471 ]
425 472
426 _rebased_emma_jar = "" 473 _rebased_emma_jar = ""
427 _rebased_resource_packaged_apk_path = rebase_path( 474 _rebased_resource_packaged_apk_path =
428 _resource_packaged_apk_path, root_build_dir) 475 rebase_path(_resource_packaged_apk_path, root_build_dir)
429 _rebased_packaged_apk_path = rebase_path(_packaged_apk_path, root_build_dir) 476 _rebased_packaged_apk_path = rebase_path(_packaged_apk_path, root_build_dir)
430 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir) 477 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir)
431 _rebased_dex_path = rebase_path(_dex_path, root_build_dir) 478 _rebased_dex_path = rebase_path(_dex_path, root_build_dir)
432 args = [ 479 args = [
433 "--depfile", rebase_path(depfile, root_build_dir), 480 "--depfile",
481 rebase_path(depfile, root_build_dir),
434 "--", 482 "--",
435 "-quiet", 483 "-quiet",
436 "-DANDROID_SDK_ROOT=$rebased_android_sdk_root", 484 "-DANDROID_SDK_ROOT=$rebased_android_sdk_root",
437 "-DANDROID_SDK_TOOLS=$rebased_android_sdk_build_tools", 485 "-DANDROID_SDK_TOOLS=$rebased_android_sdk_build_tools",
438 "-DRESOURCE_PACKAGED_APK_NAME=$_rebased_resource_packaged_apk_path", 486 "-DRESOURCE_PACKAGED_APK_NAME=$_rebased_resource_packaged_apk_path",
439 "-DCONFIGURATION_NAME=$_configuration_name", 487 "-DCONFIGURATION_NAME=$_configuration_name",
440 "-DNATIVE_LIBS_DIR=$_rebased_native_libs_dir", 488 "-DNATIVE_LIBS_DIR=$_rebased_native_libs_dir",
441 "-DOUT_DIR=", 489 "-DOUT_DIR=",
442 "-DUNSIGNED_APK_PATH=$_rebased_packaged_apk_path", 490 "-DUNSIGNED_APK_PATH=$_rebased_packaged_apk_path",
443 "-DEMMA_INSTRUMENT=0", 491 "-DEMMA_INSTRUMENT=0",
444 "-DEMMA_DEVICE_JAR=$_rebased_emma_jar", 492 "-DEMMA_DEVICE_JAR=$_rebased_emma_jar",
445 "-DDEX_FILE_PATH=$_rebased_dex_path", 493 "-DDEX_FILE_PATH=$_rebased_dex_path",
446
447 "-Dbasedir=.", 494 "-Dbasedir=.",
448 "-buildfile", rebase_path(_ant_script, root_build_dir) 495 "-buildfile",
496 rebase_path(_ant_script, root_build_dir),
449 ] 497 ]
450 } 498 }
451 499
452 action("${target_name}__finalize") { 500 action("${target_name}__finalize") {
453 script = "//build/android/gyp/finalize_apk.py" 501 script = "//build/android/gyp/finalize_apk.py"
454 depfile = "$target_gen_dir/$target_name.d" 502 depfile = "$target_gen_dir/$target_name.d"
455 503
456 sources = [_packaged_apk_path] 504 sources = [
457 inputs = [_keystore_path] 505 _packaged_apk_path,
458 outputs = [depfile, _final_apk_path] 506 ]
507 inputs = [
508 _keystore_path,
509 ]
510 outputs = [
511 depfile,
512 _final_apk_path,
513 ]
459 514
460 args = [ 515 args = [
461 "--depfile", rebase_path(depfile, root_build_dir), 516 "--depfile",
462 "--zipalign-path", rebase_path(zipalign_path, root_build_dir), 517 rebase_path(depfile, root_build_dir),
463 "--unsigned-apk-path", rebase_path(_packaged_apk_path, root_build_dir), 518 "--zipalign-path",
464 "--final-apk-path", rebase_path(_final_apk_path, root_build_dir), 519 rebase_path(zipalign_path, root_build_dir),
465 "--key-path", rebase_path(_keystore_path, root_build_dir), 520 "--unsigned-apk-path",
466 "--key-name", _keystore_name, 521 rebase_path(_packaged_apk_path, root_build_dir),
467 "--key-passwd", _keystore_password, 522 "--final-apk-path",
523 rebase_path(_final_apk_path, root_build_dir),
524 "--key-path",
525 rebase_path(_keystore_path, root_build_dir),
526 "--key-name",
527 _keystore_name,
528 "--key-passwd",
529 _keystore_password,
468 ] 530 ]
469 if (_load_library_from_apk) { 531 if (_load_library_from_apk) {
470 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar" 532 _rezip_jar_path = "$root_build_dir/lib.java/rezip_apk.jar"
471 inputs += [ 533 inputs += [ _rezip_jar_path ]
472 _rezip_jar_path
473 ]
474 args += [ 534 args += [
475 "--load-library-from-zip-file=1", 535 "--load-library-from-zip-file=1",
476 "--rezip-apk-jar-path", rebase_path(_rezip_jar_path, root_build_dir) 536 "--rezip-apk-jar-path",
537 rebase_path(_rezip_jar_path, root_build_dir),
477 ] 538 ]
478 } 539 }
479 } 540 }
480 541
481 group(target_name) { 542 group(target_name) {
482 deps = [":${target_name}__finalize"] 543 deps = [
544 ":${target_name}__finalize",
545 ]
483 } 546 }
484 } 547 }
485 548
486 template("java_prebuilt_impl") { 549 template("java_prebuilt_impl") {
487 if (defined(invoker.testonly)) { testonly = invoker.testonly } 550 if (defined(invoker.testonly)) {
488 _supports_android = ( 551 testonly = invoker.testonly
489 defined(invoker.supports_android) && invoker.supports_android) 552 }
553 _supports_android =
554 defined(invoker.supports_android) && invoker.supports_android
490 555
491 assert(defined(invoker.jar_path)) 556 assert(defined(invoker.jar_path))
492 _base_path = "${target_gen_dir}/$target_name" 557 _base_path = "${target_gen_dir}/$target_name"
493 _jar_path = _base_path + ".jar" 558 _jar_path = _base_path + ".jar"
494 _build_config = _base_path + ".build_config" 559 _build_config = _base_path + ".build_config"
495 560
496 if (_supports_android) { 561 if (_supports_android) {
497 _dex_path = _base_path + ".dex.jar" 562 _dex_path = _base_path + ".dex.jar"
498 } 563 }
499 564
500 _final_deps = [] 565 _final_deps = []
501 _template_name = target_name 566 _template_name = target_name
502 567
503
504 _final_deps += [ ":${_template_name}__build_config" ] 568 _final_deps += [ ":${_template_name}__build_config" ]
505 write_build_config("${_template_name}__build_config") { 569 write_build_config("${_template_name}__build_config") {
506 type = "java_library" 570 type = "java_library"
507 supports_android = _supports_android 571 supports_android = _supports_android
508 requires_android = (defined(invoker.requires_android) && 572 requires_android =
509 invoker.requires_android) 573 defined(invoker.requires_android) && invoker.requires_android
510 574
511 deps = [] 575 deps = []
512 if (defined(invoker.deps)) { 576 if (defined(invoker.deps)) {
513 deps += invoker.deps 577 deps += invoker.deps
514 } 578 }
515 build_config = _build_config 579 build_config = _build_config
516 jar_path = _jar_path 580 jar_path = _jar_path
517 if (_supports_android) { 581 if (_supports_android) {
518 dex_path = _dex_path 582 dex_path = _dex_path
519 } 583 }
520 } 584 }
521 585
522 _final_deps += [ ":${_template_name}__process_jar" ] 586 _final_deps += [ ":${_template_name}__process_jar" ]
523 process_java_prebuilt("${_template_name}__process_jar") { 587 process_java_prebuilt("${_template_name}__process_jar") {
524 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 588 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
525 proguard_preprocess = true 589 proguard_preprocess = true
526 proguard_config = invoker.proguard_config 590 proguard_config = invoker.proguard_config
527 } 591 }
528 592
529 build_config = _build_config 593 build_config = _build_config
530 input_jar_path = invoker.jar_path 594 input_jar_path = invoker.jar_path
531 output_jar_path = _jar_path 595 output_jar_path = _jar_path
532 } 596 }
533 597
534 if (_supports_android) { 598 if (_supports_android) {
535 _final_deps += [ ":${_template_name}__dex" ] 599 _final_deps += [ ":${_template_name}__dex" ]
536 dex("${_template_name}__dex") { 600 dex("${_template_name}__dex") {
537 sources = [_jar_path] 601 sources = [
602 _jar_path,
603 ]
538 output = _dex_path 604 output = _dex_path
539 } 605 }
540 } 606 }
541 607
542 group(target_name) { 608 group(target_name) {
543 deps = _final_deps 609 deps = _final_deps
544 } 610 }
545 } 611 }
546 612
547
548 # Compiles and jars a set of java files. 613 # Compiles and jars a set of java files.
549 # 614 #
550 # Outputs: 615 # Outputs:
551 # $jar_path.jar 616 # $jar_path.jar
552 # $jar_path.jar.TOC 617 # $jar_path.jar.TOC
553 # 618 #
554 # Variables 619 # Variables
555 # java_files: List of .java files to compile. 620 # java_files: List of .java files to compile.
556 # java_deps: List of java dependencies. These should all have a .jar output 621 # java_deps: List of java dependencies. These should all have a .jar output
557 # at "${target_gen_dir}/${target_name}.jar. 622 # at "${target_gen_dir}/${target_name}.jar.
558 # chromium_code: If true, enable extra warnings. 623 # chromium_code: If true, enable extra warnings.
559 # srcjar_deps: List of srcjar dependencies. The .java files contained in the 624 # srcjar_deps: List of srcjar dependencies. The .java files contained in the
560 # dependencies srcjar outputs will be compiled and added to the output jar. 625 # dependencies srcjar outputs will be compiled and added to the output jar.
561 # jar_path: Use this to explicitly set the output jar path. Defaults to 626 # jar_path: Use this to explicitly set the output jar path. Defaults to
562 # "${target_gen_dir}/${target_name}.jar. 627 # "${target_gen_dir}/${target_name}.jar.
563 template("compile_java") { 628 template("compile_java") {
564 if (defined(invoker.testonly)) { testonly = invoker.testonly } 629 if (defined(invoker.testonly)) {
630 testonly = invoker.testonly
631 }
565 632
566 assert(defined(invoker.java_files)) 633 assert(defined(invoker.java_files))
567 assert(defined(invoker.build_config)) 634 assert(defined(invoker.build_config))
568 assert(defined(invoker.jar_path)) 635 assert(defined(invoker.jar_path))
569 636
570 _java_files = invoker.java_files 637 _java_files = invoker.java_files
571 _final_jar_path = invoker.jar_path 638 _final_jar_path = invoker.jar_path
572 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar" 639 _intermediate_jar_path = "$target_gen_dir/$target_name.initial.jar"
573 640
574 _build_config = invoker.build_config 641 _build_config = invoker.build_config
(...skipping 15 matching lines...) Expand all
590 657
591 _java_srcjars = [] 658 _java_srcjars = []
592 if (defined(invoker.srcjars)) { 659 if (defined(invoker.srcjars)) {
593 _java_srcjars = invoker.srcjars 660 _java_srcjars = invoker.srcjars
594 } 661 }
595 foreach(dep, _srcjar_deps) { 662 foreach(dep, _srcjar_deps) {
596 _dep_gen_dir = get_label_info(dep, "target_gen_dir") 663 _dep_gen_dir = get_label_info(dep, "target_gen_dir")
597 _dep_name = get_label_info(dep, "name") 664 _dep_name = get_label_info(dep, "name")
598 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ] 665 _java_srcjars += [ "$_dep_gen_dir/$_dep_name.srcjar" ]
599 } 666 }
667
600 # Mark srcjar_deps as used. 668 # Mark srcjar_deps as used.
601 assert(_srcjar_deps == [] || true) 669 assert(_srcjar_deps == [] || true)
602 670
603 _system_jars = [] 671 _system_jars = []
604 if (defined(invoker.android) && invoker.android) { 672 if (defined(invoker.android) && invoker.android) {
605 _system_jars += [ android_sdk_jar ] 673 _system_jars += [ android_sdk_jar ]
606 } 674 }
607 675
608 _rebased_build_config = rebase_path(_build_config, root_build_dir) 676 _rebased_build_config = rebase_path(_build_config, root_build_dir)
609 _rebased_jar_path = rebase_path(_intermediate_jar_path, root_build_dir) 677 _rebased_jar_path = rebase_path(_intermediate_jar_path, root_build_dir)
610 678
611 _template_name = target_name 679 _template_name = target_name
612 _final_deps = [ ":${_template_name}__javac" ] 680 _final_deps = [ ":${_template_name}__javac" ]
613 action("${_template_name}__javac") { 681 action("${_template_name}__javac") {
614 script = "//build/android/gyp/javac.py" 682 script = "//build/android/gyp/javac.py"
615 depfile = "$target_gen_dir/$target_name.d" 683 depfile = "$target_gen_dir/$target_name.d"
616 deps = [] 684 deps = []
617 outputs = [ 685 outputs = [
618 depfile, 686 depfile,
619 _intermediate_jar_path, 687 _intermediate_jar_path,
620 _intermediate_jar_path + ".md5.stamp" 688 _intermediate_jar_path + ".md5.stamp",
621 ] 689 ]
622 sources = _java_files + _java_srcjars 690 sources = _java_files + _java_srcjars
623 inputs = _system_jars + [ _build_config ] 691 inputs = _system_jars + [ _build_config ]
624 692
625 _rebased_system_jars = rebase_path(_system_jars, root_build_dir) 693 _rebased_system_jars = rebase_path(_system_jars, root_build_dir)
626 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) 694 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir)
627 _rebased_depfile = rebase_path(depfile, root_build_dir) 695 _rebased_depfile = rebase_path(depfile, root_build_dir)
628 args = [ 696 args = [
629 "--depfile=$_rebased_depfile", 697 "--depfile=$_rebased_depfile",
630 "--classpath=$_rebased_system_jars", 698 "--classpath=$_rebased_system_jars",
(...skipping 19 matching lines...) Expand all
650 proguard_preprocess = invoker.proguard_preprocess 718 proguard_preprocess = invoker.proguard_preprocess
651 proguard_config = invoker.proguard_config 719 proguard_config = invoker.proguard_config
652 } 720 }
653 } 721 }
654 722
655 group(target_name) { 723 group(target_name) {
656 deps = _final_deps 724 deps = _final_deps
657 } 725 }
658 } 726 }
659 727
728 template("java_library_impl") {
729 if (defined(invoker.testonly)) {
730 testonly = invoker.testonly
731 }
660 732
661 template("java_library_impl") { 733 assert(
662 if (defined(invoker.testonly)) { testonly = invoker.testonly } 734 defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir) ||
663 735 defined(invoker.srcjars) || defined(invoker.srcjar_deps))
664 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)
665 || defined(invoker.srcjars) || defined(invoker.srcjar_deps))
666 _base_path = "$target_gen_dir/$target_name" 736 _base_path = "$target_gen_dir/$target_name"
667 _jar_path = _base_path + ".jar" 737 _jar_path = _base_path + ".jar"
668 if (defined(invoker.jar_path)) { 738 if (defined(invoker.jar_path)) {
669 _jar_path = invoker.jar_path 739 _jar_path = invoker.jar_path
670 } 740 }
671 _template_name = target_name 741 _template_name = target_name
672 742
673 _final_deps = [] 743 _final_deps = []
674 _final_datadeps = [] 744 _final_datadeps = []
675 if (defined(invoker.datadeps)) { 745 if (defined(invoker.datadeps)) {
676 _final_datadeps = invoker.datadeps 746 _final_datadeps = invoker.datadeps
677 } 747 }
678 748
679 _supports_android = (defined(invoker.supports_android) && 749 _supports_android =
680 invoker.supports_android) 750 defined(invoker.supports_android) && invoker.supports_android
681 _requires_android = (defined(invoker.requires_android) && 751 _requires_android =
682 invoker.requires_android) 752 defined(invoker.requires_android) && invoker.requires_android
683 753
684 if (_supports_android) { 754 if (_supports_android) {
685 _dex_path = _base_path + ".dex.jar" 755 _dex_path = _base_path + ".dex.jar"
686 if (defined(invoker.dex_path)) { 756 if (defined(invoker.dex_path)) {
687 _dex_path = invoker.dex_path 757 _dex_path = invoker.dex_path
688 } 758 }
689 } 759 }
690 760
691 if (defined(invoker.override_build_config)) { 761 if (defined(invoker.override_build_config)) {
692 _build_config = invoker.override_build_config 762 _build_config = invoker.override_build_config
693 } else { 763 } else {
694 _build_config = _base_path + ".build_config" 764 _build_config = _base_path + ".build_config"
695 _final_deps += [ ":${_template_name}__build_config" ] 765 _final_deps += [ ":${_template_name}__build_config" ]
696 write_build_config("${_template_name}__build_config") { 766 write_build_config("${_template_name}__build_config") {
697 type = "java_library" 767 type = "java_library"
698 supports_android = _supports_android 768 supports_android = _supports_android
699 requires_android = _requires_android 769 requires_android = _requires_android
700 bypass_platform_checks = (defined(invoker.bypass_platform_checks) && 770 bypass_platform_checks = defined(invoker.bypass_platform_checks) &&
701 invoker.bypass_platform_checks) 771 invoker.bypass_platform_checks
702 772
703 deps = [] 773 deps = []
704 if (defined(invoker.deps)) { 774 if (defined(invoker.deps)) {
705 deps += invoker.deps 775 deps += invoker.deps
706 } 776 }
707 777
708 build_config = _build_config 778 build_config = _build_config
709 jar_path = _jar_path 779 jar_path = _jar_path
710 if (_supports_android) { 780 if (_supports_android) {
711 dex_path = _dex_path 781 dex_path = _dex_path
(...skipping 15 matching lines...) Expand all
727 if (defined(invoker.srcjars)) { 797 if (defined(invoker.srcjars)) {
728 _srcjars = invoker.srcjars 798 _srcjars = invoker.srcjars
729 } 799 }
730 800
731 _java_files = [] 801 _java_files = []
732 if (defined(invoker.java_files)) { 802 if (defined(invoker.java_files)) {
733 _java_files = invoker.java_files 803 _java_files = invoker.java_files
734 } else if (defined(invoker.DEPRECATED_java_in_dir)) { 804 } else if (defined(invoker.DEPRECATED_java_in_dir)) {
735 _src_dir = invoker.DEPRECATED_java_in_dir + "/src" 805 _src_dir = invoker.DEPRECATED_java_in_dir + "/src"
736 _src_dir_exists = exec_script("//build/dir_exists.py", 806 _src_dir_exists = exec_script("//build/dir_exists.py",
737 [ rebase_path(_src_dir, root_build_dir) ], 807 [ rebase_path(_src_dir, root_build_dir) ],
738 "string") 808 "string")
739 assert(_src_dir_exists == "False", 809 assert(_src_dir_exists == "False",
740 "In GN, java_in_dir should be the fully specified java directory " + 810 "In GN, java_in_dir should be the fully specified java directory " +
741 "(i.e. including the trailing \"/src\")") 811 "(i.e. including the trailing \"/src\")")
742 812
743 _java_files_build_rel = exec_script( 813 _java_files_build_rel = exec_script(
744 "//build/android/gyp/find.py", 814 "//build/android/gyp/find.py",
745 [ 815 [
746 "--pattern", 816 "--pattern",
747 "*.java", 817 "*.java",
748 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir) 818 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir),
749 ], 819 ],
750 "list lines" 820 "list lines")
751 )
752 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) 821 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir)
753 } 822 }
754 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != []) 823 assert(_java_files != [] || _srcjar_deps != [] || _srcjars != [])
755 824
756 _final_deps += [ ":${_template_name}__compile_java" ] 825 _final_deps += [ ":${_template_name}__compile_java" ]
757 compile_java("${_template_name}__compile_java") { 826 compile_java("${_template_name}__compile_java") {
758 jar_path = _jar_path 827 jar_path = _jar_path
759 build_config = _build_config 828 build_config = _build_config
760 java_files = _java_files 829 java_files = _java_files
761 srcjar_deps = _srcjar_deps 830 srcjar_deps = _srcjar_deps
762 srcjars = _srcjars 831 srcjars = _srcjars
763 chromium_code = _chromium_code 832 chromium_code = _chromium_code
764 android = _requires_android 833 android = _requires_android
765 834
766 if (defined(invoker.jar_excluded_patterns)) { jar_excluded_patterns = invoke r.jar_excluded_patterns } 835 if (defined(invoker.jar_excluded_patterns)) {
767 if (defined(invoker.proguard_preprocess)) { proguard_preprocess = invoker.pr oguard_preprocess } 836 jar_excluded_patterns = invoker.jar_excluded_patterns
768 if (defined(invoker.proguard_config)) { proguard_config = invoker.proguard_c onfig } 837 }
769 if (defined(invoker.dist_jar_path)) { dist_jar_path = invoker.dist_jar_path } 838 if (defined(invoker.proguard_preprocess)) {
839 proguard_preprocess = invoker.proguard_preprocess
840 }
841 if (defined(invoker.proguard_config)) {
842 proguard_config = invoker.proguard_config
843 }
844 if (defined(invoker.dist_jar_path)) {
845 dist_jar_path = invoker.dist_jar_path
846 }
770 } 847 }
771 848
772 if (defined(invoker.main_class)) { 849 if (defined(invoker.main_class)) {
773 _final_deps += [ ":${_template_name}__binary_script" ] 850 _final_deps += [ ":${_template_name}__binary_script" ]
774 action("${_template_name}__binary_script") { 851 action("${_template_name}__binary_script") {
775 script = "//build/android/gyp/create_java_binary_script.py" 852 script = "//build/android/gyp/create_java_binary_script.py"
776 depfile = "$target_gen_dir/$target_name.d" 853 depfile = "$target_gen_dir/$target_name.d"
777 java_script = "$root_build_dir/bin/$_template_name" 854 java_script = "$root_build_dir/bin/$_template_name"
778 inputs = [ _build_config ] 855 inputs = [
856 _build_config,
857 ]
779 outputs = [ 858 outputs = [
780 depfile, 859 depfile,
781 java_script, 860 java_script,
782 ] 861 ]
783 _rebased_build_config = rebase_path(_build_config, root_build_dir) 862 _rebased_build_config = rebase_path(_build_config, root_build_dir)
784 args = [ 863 args = [
785 "--depfile", rebase_path(depfile, root_build_dir), 864 "--depfile",
786 "--output", rebase_path(java_script, root_build_dir), 865 rebase_path(depfile, root_build_dir),
866 "--output",
867 rebase_path(java_script, root_build_dir),
787 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)", 868 "--classpath=@FileArg($_rebased_build_config:java:full_classpath)",
788 "--jar-path", rebase_path(_jar_path, root_build_dir), 869 "--jar-path",
789 "--main-class", invoker.main_class, 870 rebase_path(_jar_path, root_build_dir),
871 "--main-class",
872 invoker.main_class,
790 ] 873 ]
791 } 874 }
792 } 875 }
793 876
794 if (_supports_android) { 877 if (_supports_android) {
795 if (defined(invoker.chromium_code) && invoker.chromium_code) { 878 if (defined(invoker.chromium_code) && invoker.chromium_code) {
796 _android_manifest = "//build/android/AndroidManifest.xml" 879 _android_manifest = "//build/android/AndroidManifest.xml"
797 if (defined(invoker.android_manifest)) { 880 if (defined(invoker.android_manifest)) {
798 _android_manifest = invoker.android_manifest 881 _android_manifest = invoker.android_manifest
799 } 882 }
800 883
801 _final_datadeps += [ ":${_template_name}__lint" ] 884 _final_datadeps += [ ":${_template_name}__lint" ]
802 android_lint("${_template_name}__lint") { 885 android_lint("${_template_name}__lint") {
803 android_manifest = _android_manifest 886 android_manifest = _android_manifest
804 jar_path = _jar_path 887 jar_path = _jar_path
805 java_files = _java_files 888 java_files = _java_files
806 } 889 }
807 } 890 }
808 891
809 _final_deps += [ ":${_template_name}__dex" ] 892 _final_deps += [ ":${_template_name}__dex" ]
810 dex("${_template_name}__dex") { 893 dex("${_template_name}__dex") {
811 sources = [_jar_path] 894 sources = [
895 _jar_path,
896 ]
812 output = _dex_path 897 output = _dex_path
813 } 898 }
814 } 899 }
815 900
816 group(target_name) { 901 group(target_name) {
817 if (defined(invoker.visibility)) { 902 if (defined(invoker.visibility)) {
818 visibility = invoker.visibility 903 visibility = invoker.visibility
819 } 904 }
820 deps = _final_deps 905 deps = _final_deps
821 datadeps = _final_datadeps 906 datadeps = _final_datadeps
822 } 907 }
823 } 908 }
824 909
825
826 # Runs process_resources.py 910 # Runs process_resources.py
827 template("process_resources") { 911 template("process_resources") {
828 if (defined(invoker.testonly)) { testonly = invoker.testonly } 912 if (defined(invoker.testonly)) {
913 testonly = invoker.testonly
914 }
829 915
830 zip_path = invoker.zip_path 916 zip_path = invoker.zip_path
831 srcjar_path = invoker.srcjar_path 917 srcjar_path = invoker.srcjar_path
832 build_config = invoker.build_config 918 build_config = invoker.build_config
833 resource_dirs = invoker.resource_dirs 919 resource_dirs = invoker.resource_dirs
834 android_manifest = invoker.android_manifest 920 android_manifest = invoker.android_manifest
835 921
836 non_constant_id = true 922 non_constant_id = true
837 if (defined(invoker.generate_constant_ids) && invoker.generate_constant_ids) { 923 if (defined(invoker.generate_constant_ids) && invoker.generate_constant_ids) {
838 non_constant_id = false 924 non_constant_id = false
839 } 925 }
840 926
841 action(target_name) { 927 action(target_name) {
842 script = "//build/android/gyp/process_resources.py" 928 script = "//build/android/gyp/process_resources.py"
843 929
844 depfile = "$target_gen_dir/$target_name.d" 930 depfile = "$target_gen_dir/$target_name.d"
845 outputs = [ 931 outputs = [
846 depfile, 932 depfile,
847 zip_path, 933 zip_path,
848 srcjar_path, 934 srcjar_path,
849 ] 935 ]
850 936
851 sources_build_rel = exec_script( 937 sources_build_rel = exec_script("//build/android/gyp/find.py",
852 "//build/android/gyp/find.py", 938 rebase_path(resource_dirs, root_build_dir),
853 rebase_path(resource_dirs, root_build_dir), 939 "list lines")
854 "list lines"
855 )
856 sources = rebase_path(sources_build_rel, ".", root_build_dir) 940 sources = rebase_path(sources_build_rel, ".", root_build_dir)
857 941
858 inputs = [ 942 inputs = [
859 build_config, 943 build_config,
860 android_manifest, 944 android_manifest,
861 ] 945 ]
862 946
863 rebase_resource_dirs = rebase_path(resource_dirs, root_build_dir) 947 rebase_resource_dirs = rebase_path(resource_dirs, root_build_dir)
864 rebase_build_config = rebase_path(build_config, root_build_dir) 948 rebase_build_config = rebase_path(build_config, root_build_dir)
865 args = [ 949 args = [
866 "--depfile", rebase_path(depfile, root_build_dir), 950 "--depfile",
867 "--android-sdk", rebase_path(android_sdk, root_build_dir), 951 rebase_path(depfile, root_build_dir),
868 "--android-sdk-tools", rebase_path(android_sdk_build_tools, root_build_dir ), 952 "--android-sdk",
869 "--android-manifest", rebase_path(android_manifest, root_build_dir), 953 rebase_path(android_sdk, root_build_dir),
870 954 "--android-sdk-tools",
955 rebase_path(android_sdk_build_tools, root_build_dir),
956 "--android-manifest",
957 rebase_path(android_manifest, root_build_dir),
871 "--resource-dirs=$rebase_resource_dirs", 958 "--resource-dirs=$rebase_resource_dirs",
872 "--srcjar-out", rebase_path(srcjar_path, root_build_dir), 959 "--srcjar-out",
873 "--resource-zip-out", rebase_path(zip_path, root_build_dir), 960 rebase_path(srcjar_path, root_build_dir),
874 961 "--resource-zip-out",
962 rebase_path(zip_path, root_build_dir),
875 "--dependencies-res-zips=@FileArg($rebase_build_config:resources:dependenc y_zips)", 963 "--dependencies-res-zips=@FileArg($rebase_build_config:resources:dependenc y_zips)",
876 "--extra-res-packages=@FileArg($rebase_build_config:resources:extra_packag e_names)", 964 "--extra-res-packages=@FileArg($rebase_build_config:resources:extra_packag e_names)",
877 ] 965 ]
878 966
879 if (non_constant_id) { 967 if (non_constant_id) {
880 args += [ "--non-constant-id" ] 968 args += [ "--non-constant-id" ]
881 } 969 }
882 970
883 if (defined(invoker.custom_package)) { 971 if (defined(invoker.custom_package)) {
884 args += [ 972 args += [
885 "--custom-package", invoker.custom_package, 973 "--custom-package",
974 invoker.custom_package,
886 ] 975 ]
887 } 976 }
888 977
889 if (defined(invoker.v14_verify_only) && invoker.v14_verify_only) { 978 if (defined(invoker.v14_verify_only) && invoker.v14_verify_only) {
890 args += ["--v14-verify-only"] 979 args += [ "--v14-verify-only" ]
891 } 980 }
892 981
893 if (defined(invoker.shared_resources) && 982 if (defined(invoker.shared_resources) && invoker.shared_resources) {
894 invoker.shared_resources) { 983 args += [ "--shared-resources" ]
895 args += ["--shared-resources"]
896 } 984 }
897 985
898 if (defined(invoker.all_resources_zip_path)) { 986 if (defined(invoker.all_resources_zip_path)) {
899 all_resources_zip = invoker.all_resources_zip_path 987 all_resources_zip = invoker.all_resources_zip_path
900 outputs += [ all_resources_zip ] 988 outputs += [ all_resources_zip ]
901 args += [ 989 args += [
902 "--all-resources-zip-out", rebase_path(all_resources_zip, root_build_dir ) 990 "--all-resources-zip-out",
991 rebase_path(all_resources_zip, root_build_dir),
903 ] 992 ]
904 } 993 }
905 994
906 if (defined(invoker.args)) { 995 if (defined(invoker.args)) {
907 args += invoker.args 996 args += invoker.args
908 } 997 }
909 } 998 }
910 } 999 }
911 1000
912 template("copy_ex") { 1001 template("copy_ex") {
913 if (defined(invoker.testonly)) { testonly = invoker.testonly } 1002 if (defined(invoker.testonly)) {
1003 testonly = invoker.testonly
1004 }
914 1005
915 action(target_name) { 1006 action(target_name) {
916 script = "//build/android/gyp/copy_ex.py" 1007 script = "//build/android/gyp/copy_ex.py"
917 1008
918 if (defined(invoker.deps)) { deps = invoker.deps } 1009 if (defined(invoker.deps)) {
1010 deps = invoker.deps
1011 }
919 1012
920 sources = [] 1013 sources = []
921 if (defined(invoker.sources)) { 1014 if (defined(invoker.sources)) {
922 sources += invoker.sources 1015 sources += invoker.sources
923 } 1016 }
924 1017
925 inputs = [] 1018 inputs = []
926 if (defined(invoker.inputs)) { 1019 if (defined(invoker.inputs)) {
927 inputs += invoker.inputs 1020 inputs += invoker.inputs
928 } 1021 }
929 1022
930 depfile = "$target_gen_dir/$target_name.d" 1023 depfile = "$target_gen_dir/$target_name.d"
931 outputs = [ 1024 outputs = [ depfile ]
932 depfile,
933 ]
934 1025
935 args = [ 1026 args = [
936 "--depfile", rebase_path(depfile, root_build_dir), 1027 "--depfile",
937 "--dest", rebase_path(invoker.dest, root_build_dir), 1028 rebase_path(depfile, root_build_dir),
1029 "--dest",
1030 rebase_path(invoker.dest, root_build_dir),
938 ] 1031 ]
939 rebased_sources = rebase_path(sources, root_build_dir) 1032 rebased_sources = rebase_path(sources, root_build_dir)
940 args += [ "--files=$rebased_sources" ] 1033 args += [ "--files=$rebased_sources" ]
941 1034
942 if (defined(invoker.clear_dir) && invoker.clear_dir) { 1035 if (defined(invoker.clear_dir) && invoker.clear_dir) {
943 args += ["--clear"] 1036 args += [ "--clear" ]
944 } 1037 }
945 1038
946 if (defined(invoker.args)) { 1039 if (defined(invoker.args)) {
947 args += invoker.args 1040 args += invoker.args
948 } 1041 }
949 } 1042 }
950 } 1043 }
OLDNEW
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698