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

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

Issue 1310613002: GN: Refactor android rules to use forward_variables_from() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months 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/internal_rules.gni ('k') | no next file » | 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("//base/android/linker/config.gni") 5 import("//base/android/linker/config.gni")
6 import("//build/config/android/config.gni") 6 import("//build/config/android/config.gni")
7 import("//build/config/android/internal_rules.gni") 7 import("//build/config/android/internal_rules.gni")
8 import("//build/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 import("//third_party/android_platform/config.gni") 9 import("//third_party/android_platform/config.gni")
10 import("//tools/grit/grit_rule.gni") 10 import("//tools/grit/grit_rule.gni")
(...skipping 14 matching lines...) Expand all
25 # Example 25 # Example
26 # generate_jni("foo_jni") { 26 # generate_jni("foo_jni") {
27 # sources = [ 27 # sources = [
28 # "android/java/src/org/chromium/foo/Foo.java", 28 # "android/java/src/org/chromium/foo/Foo.java",
29 # "android/java/src/org/chromium/foo/FooUtil.java", 29 # "android/java/src/org/chromium/foo/FooUtil.java",
30 # ] 30 # ]
31 # jni_package = "foo" 31 # jni_package = "foo"
32 # } 32 # }
33 template("generate_jni") { 33 template("generate_jni") {
34 set_sources_assignment_filter([]) 34 set_sources_assignment_filter([])
35 if (defined(invoker.testonly)) { 35 forward_variables_from(invoker, [ "testonly" ])
36 testonly = invoker.testonly
37 }
38 36
39 assert(defined(invoker.sources)) 37 assert(defined(invoker.sources))
40 assert(defined(invoker.jni_package)) 38 assert(defined(invoker.jni_package))
41 jni_package = invoker.jni_package 39 jni_package = invoker.jni_package
42 base_output_dir = "${target_gen_dir}/${target_name}" 40 base_output_dir = "${target_gen_dir}/${target_name}"
43 package_output_dir = "${base_output_dir}/${jni_package}" 41 package_output_dir = "${base_output_dir}/${jni_package}"
44 jni_output_dir = "${package_output_dir}/jni" 42 jni_output_dir = "${package_output_dir}/jni"
45 43
46 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" 44 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h"
47 45
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 # TODO(cjhopman): #includes should probably all be relative to 77 # TODO(cjhopman): #includes should probably all be relative to
80 # base_output_dir. Remove that from this config once the includes are 78 # base_output_dir. Remove that from this config once the includes are
81 # updated. 79 # updated.
82 include_dirs = [ 80 include_dirs = [
83 base_output_dir, 81 base_output_dir,
84 package_output_dir, 82 package_output_dir,
85 ] 83 ]
86 } 84 }
87 85
88 group(target_name) { 86 group(target_name) {
89 deps = [ 87 deps = []
90 ":$foreach_target_name", 88 forward_variables_from(invoker,
91 ] 89 [
90 "deps",
91 "public_deps",
92 "visibility",
93 ])
94 deps += [ ":$foreach_target_name" ]
92 public_configs = [ ":jni_includes_${target_name}" ] 95 public_configs = [ ":jni_includes_${target_name}" ]
93
94 if (defined(invoker.deps)) {
95 deps += invoker.deps
96 }
97 if (defined(invoker.public_deps)) {
98 public_deps = invoker.public_deps
99 }
100
101 if (defined(invoker.visibility)) {
102 visibility = invoker.visibility
103 }
104 } 96 }
105 } 97 }
106 98
107 # Declare a jni target for a prebuilt jar 99 # Declare a jni target for a prebuilt jar
108 # 100 #
109 # This target generates the native jni bindings for a set of classes in a .jar. 101 # This target generates the native jni bindings for a set of classes in a .jar.
110 # 102 #
111 # See base/android/jni_generator/jni_generator.py for more info about the 103 # See base/android/jni_generator/jni_generator.py for more info about the
112 # format of generating JNI bindings. 104 # format of generating JNI bindings.
113 # 105 #
114 # Variables 106 # Variables
115 # classes: list of .class files in the jar to generate jni for. These should 107 # classes: list of .class files in the jar to generate jni for. These should
116 # include the full path to the .class file. 108 # include the full path to the .class file.
117 # jni_package: subdirectory path for generated bindings 109 # jni_package: subdirectory path for generated bindings
118 # jar_file: the path to the .jar. If not provided, will default to the sdk's 110 # jar_file: the path to the .jar. If not provided, will default to the sdk's
119 # android.jar 111 # android.jar
120 # 112 #
121 # deps, public_deps: As normal 113 # deps, public_deps: As normal
122 # 114 #
123 # Example 115 # Example
124 # generate_jar_jni("foo_jni") { 116 # generate_jar_jni("foo_jni") {
125 # classes = [ 117 # classes = [
126 # "android/view/Foo.class", 118 # "android/view/Foo.class",
127 # ] 119 # ]
128 # jni_package = "foo" 120 # jni_package = "foo"
129 # } 121 # }
130 template("generate_jar_jni") { 122 template("generate_jar_jni") {
131 set_sources_assignment_filter([]) 123 set_sources_assignment_filter([])
132 if (defined(invoker.testonly)) { 124 forward_variables_from(invoker, [ "testonly" ])
133 testonly = invoker.testonly
134 }
135 125
136 assert(defined(invoker.classes)) 126 assert(defined(invoker.classes))
137 assert(defined(invoker.jni_package)) 127 assert(defined(invoker.jni_package))
138 128
139 if (defined(invoker.jar_file)) { 129 if (defined(invoker.jar_file)) {
140 jar_file = invoker.jar_file 130 jar_file = invoker.jar_file
141 } else { 131 } else {
142 jar_file = android_sdk_jar 132 jar_file = android_sdk_jar
143 } 133 }
144 134
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 "--native_exports_optional", 176 "--native_exports_optional",
187 ] 177 ]
188 } 178 }
189 } 179 }
190 180
191 config("jni_includes_${target_name}") { 181 config("jni_includes_${target_name}") {
192 include_dirs = [ base_output_dir ] 182 include_dirs = [ base_output_dir ]
193 } 183 }
194 184
195 group(target_name) { 185 group(target_name) {
196 deps = jni_actions 186 deps = []
197 if (defined(invoker.deps)) { 187 forward_variables_from(invoker,
198 deps += invoker.deps 188 [
199 } 189 "deps",
200 if (defined(invoker.public_deps)) { 190 "public_deps",
201 public_deps = invoker.public_deps 191 "visibility",
202 } 192 ])
193 deps += jni_actions
203 public_configs = [ ":jni_includes_${target_name}" ] 194 public_configs = [ ":jni_includes_${target_name}" ]
204 } 195 }
205 } 196 }
206 197
207 # Declare a target for c-preprocessor-generated java files 198 # Declare a target for c-preprocessor-generated java files
208 # 199 #
209 # NOTE: For generating Java conterparts to enums prefer using the java_cpp_enum 200 # NOTE: For generating Java conterparts to enums prefer using the java_cpp_enum
210 # rule instead. 201 # rule instead.
211 # 202 #
212 # This target generates java files using the host C pre-processor. Each file in 203 # This target generates java files using the host C pre-processor. Each file in
(...skipping 21 matching lines...) Expand all
234 # ] 225 # ]
235 # inputs = [ 226 # inputs = [
236 # "android/java/templates/native_foo_header.h", 227 # "android/java/templates/native_foo_header.h",
237 # ] 228 # ]
238 # 229 #
239 # package_name = "org/chromium/base/library_loader" 230 # package_name = "org/chromium/base/library_loader"
240 # include_path = "android/java/templates" 231 # include_path = "android/java/templates"
241 # } 232 # }
242 template("java_cpp_template") { 233 template("java_cpp_template") {
243 set_sources_assignment_filter([]) 234 set_sources_assignment_filter([])
244 if (defined(invoker.testonly)) { 235 forward_variables_from(invoker, [ "testonly" ])
245 testonly = invoker.testonly
246 }
247 236
248 assert(defined(invoker.sources)) 237 assert(defined(invoker.sources))
249 package_name = invoker.package_name + "" 238 package_name = invoker.package_name + ""
250 239
251 if (defined(invoker.include_path)) { 240 if (defined(invoker.include_path)) {
252 include_path = invoker.include_path + "" 241 include_path = invoker.include_path + ""
253 } else { 242 } else {
254 include_path = "//" 243 include_path = "//"
255 } 244 }
256 245
257 apply_gcc_target_name = "${target_name}__apply_gcc" 246 apply_gcc_target_name = "${target_name}__apply_gcc"
258 zip_srcjar_target_name = "${target_name}__zip_srcjar" 247 zip_srcjar_target_name = "${target_name}__zip_srcjar"
259 final_target_name = target_name 248 final_target_name = target_name
260 249
261 action_foreach(apply_gcc_target_name) { 250 action_foreach(apply_gcc_target_name) {
251 forward_variables_from(invoker,
252 [
253 "deps",
254 "public_deps",
255 "data_deps",
256 ])
262 visibility = [ ":$zip_srcjar_target_name" ] 257 visibility = [ ":$zip_srcjar_target_name" ]
263 script = "//build/android/gyp/gcc_preprocess.py" 258 script = "//build/android/gyp/gcc_preprocess.py"
264 if (defined(invoker.inputs)) { 259 if (defined(invoker.inputs)) {
265 inputs = invoker.inputs + [] 260 inputs = invoker.inputs + []
266 } 261 }
267 depfile = "${target_gen_dir}/${target_name}_{{source_name_part}}.d" 262 depfile = "${target_gen_dir}/${target_name}_{{source_name_part}}.d"
268 263
269 sources = invoker.sources 264 sources = invoker.sources
270 265
271 if (defined(invoker.deps)) {
272 deps = invoker.deps
273 }
274 if (defined(invoker.public_deps)) {
275 public_deps = invoker.public_deps
276 }
277 if (defined(invoker.data_deps)) {
278 data_deps = invoker.data_deps
279 }
280
281 gen_dir = 266 gen_dir =
282 "${target_gen_dir}/${target_name}/java_cpp_template/${package_name}" 267 "${target_gen_dir}/${target_name}/java_cpp_template/${package_name}"
283 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java" 268 gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java"
284 269
285 outputs = [ 270 outputs = [
286 depfile, 271 depfile,
287 gcc_template_output_pattern, 272 gcc_template_output_pattern,
288 ] 273 ]
289 274
290 args = [ 275 args = [
(...skipping 24 matching lines...) Expand all
315 visibility = [ ":$final_target_name" ] 300 visibility = [ ":$final_target_name" ]
316 inputs = apply_gcc_outputs 301 inputs = apply_gcc_outputs
317 output = srcjar_path 302 output = srcjar_path
318 base_dir = base_gen_dir 303 base_dir = base_gen_dir
319 deps = [ 304 deps = [
320 ":$apply_gcc_target_name", 305 ":$apply_gcc_target_name",
321 ] 306 ]
322 } 307 }
323 308
324 group(final_target_name) { 309 group(final_target_name) {
325 if (defined(invoker.visibility)) { 310 forward_variables_from(invoker, [ "visibility" ])
326 visibility = invoker.visibility
327 }
328 deps = [ 311 deps = [
329 ":$zip_srcjar_target_name", 312 ":$zip_srcjar_target_name",
330 ] 313 ]
331 } 314 }
332 } 315 }
333 316
334 # Declare a target for generating Java classes from C++ enums. 317 # Declare a target for generating Java classes from C++ enums.
335 # 318 #
336 # This target generates Java files from C++ enums using a script. 319 # This target generates Java files from C++ enums using a script.
337 # 320 #
(...skipping 15 matching lines...) Expand all
353 # java_cpp_enum("foo_generated_enum") { 336 # java_cpp_enum("foo_generated_enum") {
354 # sources = [ 337 # sources = [
355 # "src/native_foo_header.h", 338 # "src/native_foo_header.h",
356 # ] 339 # ]
357 # outputs = [ 340 # outputs = [
358 # "org/chromium/FooEnum.java", 341 # "org/chromium/FooEnum.java",
359 # ] 342 # ]
360 # } 343 # }
361 template("java_cpp_enum") { 344 template("java_cpp_enum") {
362 set_sources_assignment_filter([]) 345 set_sources_assignment_filter([])
363 if (defined(invoker.testonly)) { 346 forward_variables_from(invoker, [ "testonly" ])
364 testonly = invoker.testonly
365 }
366 347
367 assert(defined(invoker.sources)) 348 assert(defined(invoker.sources))
368 assert(defined(invoker.outputs)) 349 assert(defined(invoker.outputs))
369 350
370 generate_enum_target_name = "${target_name}__generate_enum" 351 generate_enum_target_name = "${target_name}__generate_enum"
371 zip_srcjar_target_name = "${target_name}__zip_srcjar" 352 zip_srcjar_target_name = "${target_name}__zip_srcjar"
372 final_target_name = target_name 353 final_target_name = target_name
373 354
374 action(generate_enum_target_name) { 355 action(generate_enum_target_name) {
375 visibility = [ ":$zip_srcjar_target_name" ] 356 visibility = [ ":$zip_srcjar_target_name" ]
(...skipping 26 matching lines...) Expand all
402 visibility = [ ":$final_target_name" ] 383 visibility = [ ":$final_target_name" ]
403 inputs = generate_enum_outputs 384 inputs = generate_enum_outputs
404 output = srcjar_path 385 output = srcjar_path
405 base_dir = base_gen_dir 386 base_dir = base_gen_dir
406 deps = [ 387 deps = [
407 ":$generate_enum_target_name", 388 ":$generate_enum_target_name",
408 ] 389 ]
409 } 390 }
410 391
411 group(final_target_name) { 392 group(final_target_name) {
412 if (defined(invoker.visibility)) { 393 forward_variables_from(invoker, [ "visibility" ])
413 visibility = invoker.visibility
414 }
415 deps = [ 394 deps = [
416 ":$zip_srcjar_target_name", 395 ":$zip_srcjar_target_name",
417 ] 396 ]
418 } 397 }
419 } 398 }
420 399
421 # Declare a target for processing a Jinja template. 400 # Declare a target for processing a Jinja template.
422 # 401 #
423 # Variables 402 # Variables
424 # input: The template file to be processed. 403 # input: The template file to be processed.
425 # output: Where to save the result. 404 # output: Where to save the result.
426 # variables: (Optional) A list of variables to make available to the template 405 # variables: (Optional) A list of variables to make available to the template
427 # processing environment, e.g. ["name=foo", "color=red"]. 406 # processing environment, e.g. ["name=foo", "color=red"].
428 # 407 #
429 # Example 408 # Example
430 # jinja_template("chrome_shell_manifest") { 409 # jinja_template("chrome_shell_manifest") {
431 # input = "shell/java/AndroidManifest.xml" 410 # input = "shell/java/AndroidManifest.xml"
432 # output = "$target_gen_dir/AndroidManifest.xml" 411 # output = "$target_gen_dir/AndroidManifest.xml"
433 # } 412 # }
434 template("jinja_template") { 413 template("jinja_template") {
435 set_sources_assignment_filter([]) 414 set_sources_assignment_filter([])
436 if (defined(invoker.testonly)) { 415 forward_variables_from(invoker, [ "testonly" ])
437 testonly = invoker.testonly
438 }
439 416
440 assert(defined(invoker.input)) 417 assert(defined(invoker.input))
441 assert(defined(invoker.output)) 418 assert(defined(invoker.output))
442 419
443 action(target_name) { 420 action(target_name) {
444 if (defined(invoker.visibility)) { 421 forward_variables_from(invoker, [ "visibility" ])
445 visibility = invoker.visibility
446 }
447 422
448 sources = [ 423 sources = [
449 invoker.input, 424 invoker.input,
450 ] 425 ]
451 script = "//build/android/gyp/jinja_template.py" 426 script = "//build/android/gyp/jinja_template.py"
452 depfile = "$target_gen_dir/$target_name.d" 427 depfile = "$target_gen_dir/$target_name.d"
453 428
454 outputs = [ 429 outputs = [
455 depfile, 430 depfile,
456 invoker.output, 431 invoker.output,
(...skipping 30 matching lines...) Expand all
487 # processing environment, e.g. ["name=foo", "color=red"]. 462 # processing environment, e.g. ["name=foo", "color=red"].
488 # 463 #
489 # Example 464 # Example
490 # jinja_template_resources("chrome_shell_template_resources") { 465 # jinja_template_resources("chrome_shell_template_resources") {
491 # res_dir = "shell/res_template" 466 # res_dir = "shell/res_template"
492 # resources = ["shell/res_template/xml/syncable.xml"] 467 # resources = ["shell/res_template/xml/syncable.xml"]
493 # variables = ["color=red"] 468 # variables = ["color=red"]
494 # } 469 # }
495 template("jinja_template_resources") { 470 template("jinja_template_resources") {
496 set_sources_assignment_filter([]) 471 set_sources_assignment_filter([])
497 if (defined(invoker.testonly)) { 472 forward_variables_from(invoker, [ "testonly" ])
498 testonly = invoker.testonly
499 }
500 473
501 assert(defined(invoker.resources)) 474 assert(defined(invoker.resources))
502 assert(defined(invoker.res_dir)) 475 assert(defined(invoker.res_dir))
503 476
504 _base_path = "$target_gen_dir/$target_name" 477 _base_path = "$target_gen_dir/$target_name"
505 _resources_zip = _base_path + ".resources.zip" 478 _resources_zip = _base_path + ".resources.zip"
506 _build_config = _base_path + ".build_config" 479 _build_config = _base_path + ".build_config"
507 480
508 write_build_config("${target_name}__build_config") { 481 write_build_config("${target_name}__build_config") {
509 build_config = _build_config 482 build_config = _build_config
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 _resources_zip = _base_path + ".resources.zip" 543 _resources_zip = _base_path + ".resources.zip"
571 _build_config = _base_path + ".build_config" 544 _build_config = _base_path + ".build_config"
572 545
573 write_build_config("${target_name}__build_config") { 546 write_build_config("${target_name}__build_config") {
574 build_config = _build_config 547 build_config = _build_config
575 resources_zip = _resources_zip 548 resources_zip = _resources_zip
576 type = "android_resources" 549 type = "android_resources"
577 } 550 }
578 551
579 action("${target_name}__create_resources_zip") { 552 action("${target_name}__create_resources_zip") {
580 sources = invoker.sources 553 forward_variables_from(invoker,
554 [
555 "deps",
556 "sources",
557 ])
581 script = "//build/android/gyp/locale_pak_resources.py" 558 script = "//build/android/gyp/locale_pak_resources.py"
582 depfile = "$target_gen_dir/$target_name.d" 559 depfile = "$target_gen_dir/$target_name.d"
583 560
584 outputs = [ 561 outputs = [
585 depfile, 562 depfile,
586 _resources_zip, 563 _resources_zip,
587 ] 564 ]
588 565
589 _rebased_sources = rebase_path(invoker.sources, root_build_dir) 566 _rebased_sources = rebase_path(sources, root_build_dir)
590 args = [ 567 args = [
591 "--locale-paks=${_rebased_sources}", 568 "--locale-paks=${_rebased_sources}",
592 "--resources-zip", 569 "--resources-zip",
593 rebase_path(_resources_zip, root_build_dir), 570 rebase_path(_resources_zip, root_build_dir),
594 "--depfile", 571 "--depfile",
595 rebase_path(depfile, root_build_dir), 572 rebase_path(depfile, root_build_dir),
596 ] 573 ]
597
598 if (defined(invoker.deps)) {
599 deps = invoker.deps
600 }
601 } 574 }
602 575
603 group(target_name) { 576 group(target_name) {
604 deps = [ 577 deps = [
605 ":${target_name}__build_config", 578 ":${target_name}__build_config",
606 ":${target_name}__create_resources_zip", 579 ":${target_name}__create_resources_zip",
607 ] 580 ]
608 } 581 }
609 } 582 }
610 583
(...skipping 22 matching lines...) Expand all
633 # 606 #
634 607
635 # Example 608 # Example
636 # android_resources("foo_resources") { 609 # android_resources("foo_resources") {
637 # deps = [":foo_strings_grd"] 610 # deps = [":foo_strings_grd"]
638 # resource_dirs = ["res"] 611 # resource_dirs = ["res"]
639 # custom_package = "org.chromium.foo" 612 # custom_package = "org.chromium.foo"
640 # } 613 # }
641 template("android_resources") { 614 template("android_resources") {
642 set_sources_assignment_filter([]) 615 set_sources_assignment_filter([])
643 if (defined(invoker.testonly)) { 616 forward_variables_from(invoker, [ "testonly" ])
644 testonly = invoker.testonly
645 }
646 617
647 assert(defined(invoker.resource_dirs)) 618 assert(defined(invoker.resource_dirs))
648 assert(defined(invoker.android_manifest) || defined(invoker.custom_package)) 619 assert(defined(invoker.android_manifest) || defined(invoker.custom_package))
649 620
650 base_path = "$target_gen_dir/$target_name" 621 base_path = "$target_gen_dir/$target_name"
651 zip_path = base_path + ".resources.zip" 622 zip_path = base_path + ".resources.zip"
652 srcjar_path = base_path + ".srcjar" 623 srcjar_path = base_path + ".srcjar"
653 r_text_path = base_path + "_R.txt" 624 r_text_path = base_path + "_R.txt"
654 build_config = base_path + ".build_config" 625 build_config = base_path + ".build_config"
655 626
656 build_config_target_name = "${target_name}__build_config" 627 build_config_target_name = "${target_name}__build_config"
657 process_resources_target_name = "${target_name}__process_resources" 628 process_resources_target_name = "${target_name}__process_resources"
658 final_target_name = target_name 629 final_target_name = target_name
659 630
660 write_build_config(build_config_target_name) { 631 write_build_config(build_config_target_name) {
632 forward_variables_from(invoker,
633 [
634 "android_manifest",
635 "custom_package",
636 "deps",
637 ])
661 visibility = [ ":$process_resources_target_name" ] 638 visibility = [ ":$process_resources_target_name" ]
662 639
663 type = "android_resources" 640 type = "android_resources"
664 resources_zip = zip_path 641 resources_zip = zip_path
665 srcjar = srcjar_path 642 srcjar = srcjar_path
666 r_text = r_text_path 643 r_text = r_text_path
667 if (defined(invoker.deps)) {
668 deps = invoker.deps
669 }
670 if (defined(invoker.android_manifest)) {
671 android_manifest = invoker.android_manifest
672 }
673 if (defined(invoker.custom_package)) {
674 custom_package = invoker.custom_package
675 }
676 }
677
678 android_manifest = "//build/android/AndroidManifest.xml"
679 if (defined(invoker.android_manifest)) {
680 android_manifest = invoker.android_manifest
681 } 644 }
682 645
683 process_resources(process_resources_target_name) { 646 process_resources(process_resources_target_name) {
684 visibility = [ ":$final_target_name" ] 647 visibility = [ ":$final_target_name" ]
685 648 deps = []
686 resource_dirs = invoker.resource_dirs 649 forward_variables_from(invoker,
687 if (defined(invoker.custom_package)) { 650 [
688 custom_package = invoker.custom_package 651 "android_manifest",
689 } 652 "custom_package",
690 653 "deps",
691 if (defined(invoker.v14_skip)) { 654 "resource_dirs",
692 v14_skip = invoker.v14_skip 655 "shared_resources",
693 } 656 "v14_skip",
694 657 ])
695 if (defined(invoker.shared_resources)) { 658 deps += [ ":$build_config_target_name" ]
696 shared_resources = invoker.shared_resources 659 if (!defined(android_manifest)) {
697 } 660 android_manifest = "//build/android/AndroidManifest.xml"
698
699 deps = [
700 ":$build_config_target_name",
701 ]
702 if (defined(invoker.deps)) {
703 # Invoker may have added deps that generate the input resources.
704 deps += invoker.deps
705 } 661 }
706 } 662 }
707 663
708 group(final_target_name) { 664 group(final_target_name) {
709 if (defined(invoker.visibility)) { 665 forward_variables_from(invoker, [ "visibility" ])
710 visibility = invoker.visibility
711 }
712 deps = [ 666 deps = [
713 ":${target_name}__process_resources", 667 ":${target_name}__process_resources",
714 ] 668 ]
715 } 669 }
716 } 670 }
717 671
718 # Declare a target that generates localized strings.xml from a .grd file. 672 # Declare a target that generates localized strings.xml from a .grd file.
719 # 673 #
720 # If this target is included in the deps of an android resources/library/apk, 674 # If this target is included in the deps of an android resources/library/apk,
721 # the strings.xml will be included with that target. 675 # the strings.xml will be included with that target.
722 # 676 #
723 # Variables 677 # Variables
724 # deps: Specifies the dependencies of this target. 678 # deps: Specifies the dependencies of this target.
725 # grd_file: Path to the .grd file to generate strings.xml from. 679 # grd_file: Path to the .grd file to generate strings.xml from.
726 # outputs: Expected grit outputs (see grit rule). 680 # outputs: Expected grit outputs (see grit rule).
727 # 681 #
728 # Example 682 # Example
729 # java_strings_grd("foo_strings_grd") { 683 # java_strings_grd("foo_strings_grd") {
730 # grd_file = "foo_strings.grd" 684 # grd_file = "foo_strings.grd"
731 # } 685 # }
732 template("java_strings_grd") { 686 template("java_strings_grd") {
733 set_sources_assignment_filter([]) 687 set_sources_assignment_filter([])
734 if (defined(invoker.testonly)) { 688 forward_variables_from(invoker, [ "testonly" ])
735 testonly = invoker.testonly
736 }
737 689
738 base_path = "$target_gen_dir/$target_name" 690 base_path = "$target_gen_dir/$target_name"
739 resources_zip = base_path + ".resources.zip" 691 resources_zip = base_path + ".resources.zip"
740 build_config = base_path + ".build_config" 692 build_config = base_path + ".build_config"
741 693
742 write_build_config("${target_name}__build_config") { 694 write_build_config("${target_name}__build_config") {
695 forward_variables_from(invoker, [ "deps" ])
743 type = "android_resources" 696 type = "android_resources"
744 if (defined(invoker.deps)) {
745 deps = invoker.deps
746 }
747 } 697 }
748 698
749 # Put grit files into this subdirectory of target_gen_dir. 699 # Put grit files into this subdirectory of target_gen_dir.
750 extra_output_path = target_name + "_grit_output" 700 extra_output_path = target_name + "_grit_output"
751 701
752 grit_target_name = "${target_name}__grit" 702 grit_target_name = "${target_name}__grit"
753 grit_output_dir = "$target_gen_dir/$extra_output_path" 703 grit_output_dir = "$target_gen_dir/$extra_output_path"
754 grit(grit_target_name) { 704 grit(grit_target_name) {
755 grit_flags = [ 705 grit_flags = [
756 "-E", 706 "-E",
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 # 744 #
795 # Example 745 # Example
796 # java_strings_grd_prebuilt("foo_strings_grd") { 746 # java_strings_grd_prebuilt("foo_strings_grd") {
797 # grit_output_dir = "$root_gen_dir/foo/grit" 747 # grit_output_dir = "$root_gen_dir/foo/grit"
798 # generated_files = [ 748 # generated_files = [
799 # "values/strings.xml" 749 # "values/strings.xml"
800 # ] 750 # ]
801 # } 751 # }
802 template("java_strings_grd_prebuilt") { 752 template("java_strings_grd_prebuilt") {
803 set_sources_assignment_filter([]) 753 set_sources_assignment_filter([])
804 if (defined(invoker.testonly)) { 754 forward_variables_from(invoker, [ "testonly" ])
805 testonly = invoker.testonly
806 }
807 755
808 base_path = "$target_gen_dir/$target_name" 756 base_path = "$target_gen_dir/$target_name"
809 resources_zip = base_path + ".resources.zip" 757 resources_zip = base_path + ".resources.zip"
810 build_config = base_path + ".build_config" 758 build_config = base_path + ".build_config"
811 759
812 build_config_target_name = "${target_name}__build_config" 760 build_config_target_name = "${target_name}__build_config"
813 zip_target_name = "${target_name}__zip" 761 zip_target_name = "${target_name}__zip"
814 final_target_name = target_name 762 final_target_name = target_name
815 763
816 write_build_config(build_config_target_name) { 764 write_build_config(build_config_target_name) {
817 visibility = [ ":$zip_target_name" ] 765 visibility = [ ":$zip_target_name" ]
818 type = "android_resources" 766 type = "android_resources"
819 } 767 }
820 768
821 zip(zip_target_name) { 769 zip(zip_target_name) {
822 visibility = [ ":$final_target_name" ] 770 visibility = [ ":$final_target_name" ]
823 771
824 base_dir = invoker.grit_output_dir 772 base_dir = invoker.grit_output_dir
825 inputs = rebase_path(invoker.generated_files, ".", base_dir) 773 inputs = rebase_path(invoker.generated_files, ".", base_dir)
826 output = resources_zip 774 output = resources_zip
827 deps = [ 775 deps = [
828 ":$build_config_target_name", 776 ":$build_config_target_name",
829 ] 777 ]
830 if (defined(invoker.deps)) { 778 if (defined(invoker.deps)) {
831 deps += invoker.deps 779 deps += invoker.deps
832 } 780 }
833 } 781 }
834 782
835 group(final_target_name) { 783 group(final_target_name) {
836 if (defined(invoker.visibility)) { 784 forward_variables_from(invoker, [ "visibility" ])
837 visibility = invoker.visibility
838 }
839 deps = [ 785 deps = [
840 ":$zip_target_name", 786 ":$zip_target_name",
841 ] 787 ]
842 } 788 }
843 } 789 }
844 790
845 # Declare a Java executable target 791 # Declare a Java executable target
846 # 792 #
847 # This target creates an executable from java code and libraries. The executable 793 # This target creates an executable from java code and libraries. The executable
848 # will be in the output folder's /bin/ directory. 794 # will be in the output folder's /bin/ directory.
(...skipping 22 matching lines...) Expand all
871 # java_files = [ "org/chromium/foo/FooMain.java" ] 817 # java_files = [ "org/chromium/foo/FooMain.java" ]
872 # deps = [ ":bar_java" ] 818 # deps = [ ":bar_java" ]
873 # main_class = "org.chromium.foo.FooMain" 819 # main_class = "org.chromium.foo.FooMain"
874 # } 820 # }
875 template("java_binary") { 821 template("java_binary") {
876 set_sources_assignment_filter([]) 822 set_sources_assignment_filter([])
877 823
878 # TODO(cjhopman): This should not act like a java_library for dependents (i.e. 824 # TODO(cjhopman): This should not act like a java_library for dependents (i.e.
879 # dependents shouldn't get the jar in their classpath, etc.). 825 # dependents shouldn't get the jar in their classpath, etc.).
880 java_library_impl(target_name) { 826 java_library_impl(target_name) {
881 if (defined(invoker.DEPRECATED_java_in_dir)) { 827 forward_variables_from(invoker, "*")
882 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
883 }
884 if (defined(invoker.chromium_code)) {
885 chromium_code = invoker.chromium_code
886 }
887 if (defined(invoker.data_deps)) {
888 deps = invoker.data_deps
889 }
890 if (defined(invoker.deps)) {
891 deps = invoker.deps
892 }
893 if (defined(invoker.enable_errorprone)) {
894 enable_errorprone = invoker.enable_errorprone
895 }
896 if (defined(invoker.java_files)) {
897 java_files = invoker.java_files
898 }
899 if (defined(invoker.srcjar_deps)) {
900 srcjar_deps = invoker.srcjar_deps
901 }
902 if (defined(invoker.srcjars)) {
903 srcjars = invoker.srcjars
904 }
905 if (defined(invoker.bypass_platform_checks)) {
906 bypass_platform_checks = invoker.bypass_platform_checks
907 }
908 if (defined(invoker.testonly)) {
909 testonly = invoker.testonly
910 }
911
912 supports_android = false 828 supports_android = false
913 main_class = invoker.main_class 829 main_class = invoker.main_class
914 } 830 }
915 } 831 }
916 832
917 # Declare a Junit executable target 833 # Declare a Junit executable target
918 # 834 #
919 # This target creates an executable from java code for running as a junit test 835 # This target creates an executable from java code for running as a junit test
920 # suite. The executable will be in the output folder's /bin/ directory. 836 # suite. The executable will be in the output folder's /bin/ directory.
921 # 837 #
(...skipping 11 matching lines...) Expand all
933 # 849 #
934 # Example 850 # Example
935 # junit_binary("foo") { 851 # junit_binary("foo") {
936 # java_files = [ "org/chromium/foo/FooTest.java" ] 852 # java_files = [ "org/chromium/foo/FooTest.java" ]
937 # deps = [ ":bar_java" ] 853 # deps = [ ":bar_java" ]
938 # } 854 # }
939 template("junit_binary") { 855 template("junit_binary") {
940 set_sources_assignment_filter([]) 856 set_sources_assignment_filter([])
941 857
942 java_binary(target_name) { 858 java_binary(target_name) {
859 deps = []
860 forward_variables_from(invoker, "*")
943 bypass_platform_checks = true 861 bypass_platform_checks = true
944 main_class = "org.chromium.testing.local.JunitTestMain" 862 main_class = "org.chromium.testing.local.JunitTestMain"
945 testonly = true 863 testonly = true
946 864
947 if (defined(invoker.DEPRECATED_java_in_dir)) { 865 deps += [
948 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
949 }
950 if (defined(invoker.chromium_code)) {
951 chromium_code = invoker.chromium_code
952 }
953 deps = [
954 "//testing/android/junit:junit_test_support", 866 "//testing/android/junit:junit_test_support",
955 "//third_party/junit", 867 "//third_party/junit",
956 "//third_party/mockito:mockito_java", 868 "//third_party/mockito:mockito_java",
957 "//third_party/robolectric:robolectric_java", 869 "//third_party/robolectric:robolectric_java",
958 "//third_party/robolectric:android-all-4.3_r2-robolectric-0", 870 "//third_party/robolectric:android-all-4.3_r2-robolectric-0",
959 ] 871 ]
960 if (defined(invoker.deps)) {
961 deps += invoker.deps
962 }
963 if (defined(invoker.java_files)) {
964 java_files = invoker.java_files
965 }
966 if (defined(invoker.srcjar_deps)) {
967 srcjar_deps = invoker.srcjar_deps
968 }
969 if (defined(invoker.srcjars)) {
970 srcjars = invoker.srcjars
971 }
972 } 872 }
973 } 873 }
974 874
975 # Declare a java library target 875 # Declare a java library target
976 # 876 #
977 # Variables 877 # Variables
978 # deps: Specifies the dependencies of this target. Java targets in this list 878 # deps: Specifies the dependencies of this target. Java targets in this list
979 # will be added to the javac classpath. 879 # will be added to the javac classpath.
980 # 880 #
981 # java_files: List of .java files included in this library. 881 # java_files: List of .java files included in this library.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 # srcjar_deps = [ 919 # srcjar_deps = [
1020 # ":foo_generated_enum" 920 # ":foo_generated_enum"
1021 # ] 921 # ]
1022 # jar_excluded_patterns = [ 922 # jar_excluded_patterns = [
1023 # "*/FooService.class", "*/FooService##*.class" 923 # "*/FooService.class", "*/FooService##*.class"
1024 # ] 924 # ]
1025 # } 925 # }
1026 template("java_library") { 926 template("java_library") {
1027 set_sources_assignment_filter([]) 927 set_sources_assignment_filter([])
1028 java_library_impl(target_name) { 928 java_library_impl(target_name) {
1029 if (defined(invoker.DEPRECATED_java_in_dir)) { 929 forward_variables_from(invoker, "*")
1030 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
1031 }
1032 if (defined(invoker.chromium_code)) {
1033 chromium_code = invoker.chromium_code
1034 }
1035 if (defined(invoker.data_deps)) {
1036 deps = invoker.data_deps
1037 }
1038 if (defined(invoker.deps)) {
1039 deps = invoker.deps
1040 }
1041 if (defined(invoker.enable_errorprone)) {
1042 enable_errorprone = invoker.enable_errorprone
1043 }
1044 if (defined(invoker.jar_excluded_patterns)) {
1045 jar_excluded_patterns = invoker.jar_excluded_patterns
1046 }
1047 if (defined(invoker.java_files)) {
1048 java_files = invoker.java_files
1049 }
1050 if (defined(invoker.proguard_config)) {
1051 proguard_config = invoker.proguard_config
1052 }
1053 if (defined(invoker.proguard_preprocess)) {
1054 proguard_preprocess = invoker.proguard_preprocess
1055 }
1056 if (defined(invoker.srcjar_deps)) {
1057 srcjar_deps = invoker.srcjar_deps
1058 }
1059 if (defined(invoker.srcjars)) {
1060 srcjars = invoker.srcjars
1061 }
1062 if (defined(invoker.bypass_platform_checks)) {
1063 bypass_platform_checks = invoker.bypass_platform_checks
1064 }
1065 if (defined(invoker.testonly)) {
1066 testonly = invoker.testonly
1067 }
1068 if (defined(invoker.jar_path)) {
1069 jar_path = invoker.jar_path
1070 }
1071
1072 if (defined(invoker.supports_android) && invoker.supports_android) {
1073 supports_android = true
1074 }
1075 } 930 }
1076 } 931 }
1077 932
1078 # Declare a java library target for a prebuilt jar 933 # Declare a java library target for a prebuilt jar
1079 # 934 #
1080 # Variables 935 # Variables
1081 # deps: Specifies the dependencies of this target. Java targets in this list 936 # deps: Specifies the dependencies of this target. Java targets in this list
1082 # will be added to the javac classpath. 937 # will be added to the javac classpath.
1083 # jar_path: Path to the prebuilt jar. 938 # jar_path: Path to the prebuilt jar.
1084 # jar_dep: Target that builds jar_path (optional). 939 # jar_dep: Target that builds jar_path (optional).
1085 # proguard_preprocess: If true, proguard preprocessing will be run. This can 940 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1086 # be used to remove unwanted parts of the library. 941 # be used to remove unwanted parts of the library.
1087 # proguard_config: Path to the proguard config for preprocessing. 942 # proguard_config: Path to the proguard config for preprocessing.
1088 # 943 #
1089 # Example 944 # Example
1090 # java_prebuilt("foo_java") { 945 # java_prebuilt("foo_java") {
1091 # jar_path = "foo.jar" 946 # jar_path = "foo.jar"
1092 # deps = [ 947 # deps = [
1093 # ":foo_resources", 948 # ":foo_resources",
1094 # ":bar_java" 949 # ":bar_java"
1095 # ] 950 # ]
1096 # } 951 # }
1097 template("java_prebuilt") { 952 template("java_prebuilt") {
1098 set_sources_assignment_filter([]) 953 set_sources_assignment_filter([])
1099 java_prebuilt_impl(target_name) { 954 java_prebuilt_impl(target_name) {
1100 jar_path = invoker.jar_path 955 forward_variables_from(invoker, "*")
1101 if (defined(invoker.jar_dep)) {
1102 jar_dep = invoker.jar_dep
1103 }
1104 if (defined(invoker.testonly)) {
1105 testonly = invoker.testonly
1106 }
1107 if (defined(invoker.deps)) {
1108 deps = invoker.deps
1109 }
1110 if (defined(invoker.data_deps)) {
1111 data_deps = invoker.data_deps
1112 }
1113 if (defined(invoker.proguard_config)) {
1114 proguard_config = invoker.proguard_config
1115 }
1116 if (defined(invoker.proguard_preprocess)) {
1117 proguard_preprocess = invoker.proguard_preprocess
1118 }
1119 } 956 }
1120 } 957 }
1121 958
1122 # Declare an Android library target 959 # Declare an Android library target
1123 # 960 #
1124 # This target creates an Android library containing java code and Android 961 # This target creates an Android library containing java code and Android
1125 # resources. 962 # resources.
1126 # 963 #
1127 # Variables 964 # Variables
1128 # deps: Specifies the dependencies of this target. Java targets in this list 965 # deps: Specifies the dependencies of this target. Java targets in this list
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 # ] 1004 # ]
1168 # jar_excluded_patterns = [ 1005 # jar_excluded_patterns = [
1169 # "*/FooService.class", "*/FooService##*.class" 1006 # "*/FooService.class", "*/FooService##*.class"
1170 # ] 1007 # ]
1171 # } 1008 # }
1172 template("android_library") { 1009 template("android_library") {
1173 set_sources_assignment_filter([]) 1010 set_sources_assignment_filter([])
1174 assert(!defined(invoker.jar_path), 1011 assert(!defined(invoker.jar_path),
1175 "android_library does not support a custom jar path") 1012 "android_library does not support a custom jar path")
1176 java_library_impl(target_name) { 1013 java_library_impl(target_name) {
1177 if (defined(invoker.DEPRECATED_java_in_dir)) { 1014 forward_variables_from(invoker, "*")
1178 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
1179 }
1180 if (defined(invoker.chromium_code)) {
1181 chromium_code = invoker.chromium_code
1182 }
1183 if (defined(invoker.data_deps)) {
1184 deps = invoker.data_deps
1185 }
1186 if (defined(invoker.deps)) {
1187 deps = invoker.deps
1188 }
1189 if (defined(invoker.enable_errorprone)) {
1190 enable_errorprone = invoker.enable_errorprone
1191 }
1192 if (defined(invoker.jar_excluded_patterns)) {
1193 jar_excluded_patterns = invoker.jar_excluded_patterns
1194 }
1195 if (defined(invoker.java_files)) {
1196 java_files = invoker.java_files
1197 }
1198 if (defined(invoker.proguard_config)) {
1199 proguard_config = invoker.proguard_config
1200 }
1201 if (defined(invoker.proguard_preprocess)) {
1202 proguard_preprocess = invoker.proguard_preprocess
1203 }
1204 if (defined(invoker.srcjar_deps)) {
1205 srcjar_deps = invoker.srcjar_deps
1206 }
1207 if (defined(invoker.srcjars)) {
1208 srcjars = invoker.srcjars
1209 }
1210 if (defined(invoker.testonly)) {
1211 testonly = invoker.testonly
1212 }
1213 if (defined(invoker.visibility)) {
1214 visibility = invoker.visibility
1215 }
1216 if (defined(invoker.dex_path)) {
1217 dex_path = invoker.dex_path
1218 }
1219 if (defined(invoker.manifest_entries)) {
1220 manifest_entries = invoker.manifest_entries
1221 }
1222 1015
1223 supports_android = true 1016 supports_android = true
1224 requires_android = true 1017 requires_android = true
1225 1018
1226 if (!defined(jar_excluded_patterns)) { 1019 if (!defined(jar_excluded_patterns)) {
1227 jar_excluded_patterns = [] 1020 jar_excluded_patterns = []
1228 } 1021 }
1229 jar_excluded_patterns += [ 1022 jar_excluded_patterns += [
1230 "*/R.class", 1023 "*/R.class",
1231 "*/R##*.class", 1024 "*/R##*.class",
1232 "*/Manifest.class", 1025 "*/Manifest.class",
1233 "*/Manifest##*.class", 1026 "*/Manifest##*.class",
1234 ] 1027 ]
1235 } 1028 }
1236 } 1029 }
1237 1030
1238 # Declare a target that packages a set of Java dependencies into a standalone 1031 # Declare a target that packages a set of Java dependencies into a standalone
1239 # .dex.jar. 1032 # .dex.jar.
1240 # 1033 #
1241 # Variables 1034 # Variables
1242 # deps: specifies the dependencies of this target. Android libraries in deps 1035 # deps: specifies the dependencies of this target. Android libraries in deps
1243 # will be packaged into the resulting .dex.jar file. 1036 # will be packaged into the resulting .dex.jar file.
1244 # dex_path: location at which the output file will be put 1037 # dex_path: location at which the output file will be put
1245 template("android_standalone_library") { 1038 template("android_standalone_library") {
1246 set_sources_assignment_filter([]) 1039 set_sources_assignment_filter([])
1247 deps_dex(target_name) { 1040 deps_dex(target_name) {
1248 deps = invoker.deps 1041 forward_variables_from(invoker,
1249 dex_path = invoker.dex_path 1042 [
1250 if (defined(invoker.excluded_jars)) { 1043 "deps",
1251 excluded_jars = invoker.excluded_jars 1044 "dex_path",
1252 } 1045 "excluded_jars",
1046 ])
1253 } 1047 }
1254 } 1048 }
1255 1049
1256 # Declare an Android library target for a prebuilt jar 1050 # Declare an Android library target for a prebuilt jar
1257 # 1051 #
1258 # This target creates an Android library containing java code and Android 1052 # This target creates an Android library containing java code and Android
1259 # resources. 1053 # resources.
1260 # 1054 #
1261 # Variables 1055 # Variables
1262 # deps: Specifies the dependencies of this target. Java targets in this list 1056 # deps: Specifies the dependencies of this target. Java targets in this list
1263 # will be added to the javac classpath. Android resources in dependencies 1057 # will be added to the javac classpath. Android resources in dependencies
1264 # will be used when building this library. 1058 # will be used when building this library.
1265 # jar_path: Path to the prebuilt jar. 1059 # jar_path: Path to the prebuilt jar.
1266 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1060 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1267 # be used to remove unwanted parts of the library. 1061 # be used to remove unwanted parts of the library.
1268 # proguard_config: Path to the proguard config for preprocessing. 1062 # proguard_config: Path to the proguard config for preprocessing.
1269 # 1063 #
1270 # Example 1064 # Example
1271 # android_java_prebuilt("foo_java") { 1065 # android_java_prebuilt("foo_java") {
1272 # jar_path = "foo.jar" 1066 # jar_path = "foo.jar"
1273 # deps = [ 1067 # deps = [
1274 # ":foo_resources", 1068 # ":foo_resources",
1275 # ":bar_java" 1069 # ":bar_java"
1276 # ] 1070 # ]
1277 # } 1071 # }
1278 template("android_java_prebuilt") { 1072 template("android_java_prebuilt") {
1279 set_sources_assignment_filter([]) 1073 set_sources_assignment_filter([])
1280 java_prebuilt_impl(target_name) { 1074 java_prebuilt_impl(target_name) {
1281 jar_path = invoker.jar_path 1075 forward_variables_from(invoker, "*")
1282 supports_android = true 1076 supports_android = true
1283 requires_android = true 1077 requires_android = true
1284 if (defined(invoker.testonly)) {
1285 testonly = invoker.testonly
1286 }
1287 if (defined(invoker.deps)) {
1288 deps = invoker.deps
1289 }
1290 if (defined(invoker.data_deps)) {
1291 data_deps = invoker.data_deps
1292 }
1293 if (defined(invoker.proguard_config)) {
1294 proguard_config = invoker.proguard_config
1295 }
1296 if (defined(invoker.proguard_preprocess)) {
1297 proguard_preprocess = invoker.proguard_preprocess
1298 }
1299 } 1078 }
1300 } 1079 }
1301 1080
1302 # Declare an Android apk target 1081 # Declare an Android apk target
1303 # 1082 #
1304 # This target creates an Android APK containing java code, resources, assets, 1083 # This target creates an Android APK containing java code, resources, assets,
1305 # and (possibly) native libraries. 1084 # and (possibly) native libraries.
1306 # 1085 #
1307 # Variables 1086 # Variables
1308 # android_manifest: Path to AndroidManifest.xml. 1087 # android_manifest: Path to AndroidManifest.xml.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 # ] 1126 # ]
1348 # srcjar_deps = [ 1127 # srcjar_deps = [
1349 # ":foo_generated_enum" 1128 # ":foo_generated_enum"
1350 # ] 1129 # ]
1351 # native_libs = [ 1130 # native_libs = [
1352 # native_lib_path 1131 # native_lib_path
1353 # ] 1132 # ]
1354 # } 1133 # }
1355 template("android_apk") { 1134 template("android_apk") {
1356 set_sources_assignment_filter([]) 1135 set_sources_assignment_filter([])
1357 if (defined(invoker.testonly)) { 1136 forward_variables_from(invoker, [ "testonly" ])
1358 testonly = invoker.testonly
1359 }
1360 1137
1361 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) 1138 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name))
1362 assert(defined(invoker.android_manifest)) 1139 assert(defined(invoker.android_manifest))
1363 gen_dir = "$target_gen_dir/$target_name" 1140 gen_dir = "$target_gen_dir/$target_name"
1364 base_path = "$gen_dir/$target_name" 1141 base_path = "$gen_dir/$target_name"
1365 _build_config = "$target_gen_dir/$target_name.build_config" 1142 _build_config = "$target_gen_dir/$target_name.build_config"
1366 resources_zip_path = "$base_path.resources.zip" 1143 resources_zip_path = "$base_path.resources.zip"
1367 _all_resources_zip_path = "$base_path.resources.all.zip" 1144 _all_resources_zip_path = "$base_path.resources.all.zip"
1368 jar_path = "$base_path.jar" 1145 jar_path = "$base_path.jar"
1369 _template_name = target_name 1146 _template_name = target_name
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 test_name = invoker.target_name 1637 test_name = invoker.target_name
1861 test_type = "instrumentation" 1638 test_type = "instrumentation"
1862 test_apk = invoker.apk_name 1639 test_apk = invoker.apk_name
1863 if (defined(invoker.isolate_file)) { 1640 if (defined(invoker.isolate_file)) {
1864 isolate_file = invoker.isolate_file 1641 isolate_file = invoker.isolate_file
1865 } 1642 }
1866 } 1643 }
1867 } 1644 }
1868 1645
1869 android_apk(target_name) { 1646 android_apk(target_name) {
1870 if (defined(invoker.android_manifest)) { 1647 deps = []
1871 android_manifest = invoker.android_manifest 1648 data_deps = []
1872 } 1649 forward_variables_from(invoker, "*")
1873 data_deps = [ 1650 data_deps += [
1874 "//testing/android/driver:driver_apk", 1651 "//testing/android/driver:driver_apk",
1875 "//tools/android/forwarder2", 1652 "//tools/android/forwarder2",
1876 "//tools/android/md5sum", 1653 "//tools/android/md5sum",
1877 ] 1654 ]
1878 if (defined(test_runner_data_dep)) { 1655 if (defined(test_runner_data_dep)) {
1879 data_deps += test_runner_data_dep 1656 data_deps += test_runner_data_dep
1880 } 1657 }
1881 if (defined(invoker.data_deps)) { 1658 deps += [ "//testing/android/broker:broker_java" ]
1882 data_deps += invoker.data_deps
1883 }
1884 deps = [
1885 "//testing/android/broker:broker_java",
1886 ]
1887 if (defined(invoker.deps)) {
1888 deps += invoker.deps
1889 }
1890 if (defined(invoker.java_files)) {
1891 java_files = invoker.java_files
1892 }
1893 if (defined(invoker.srcjar_deps)) {
1894 srcjar_deps = invoker.srcjar_deps
1895 }
1896 if (defined(invoker.apk_name)) {
1897 apk_name = invoker.apk_name
1898 }
1899 if (defined(invoker.final_apk_path)) {
1900 final_apk_path = invoker.final_apk_path
1901 }
1902 if (defined(invoker.native_libs)) {
1903 native_libs = invoker.native_libs
1904 }
1905 if (defined(invoker.apk_under_test)) {
1906 apk_under_test = invoker.apk_under_test
1907 }
1908 if (defined(invoker.DEPRECATED_java_in_dir)) {
1909 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
1910 }
1911 } 1659 }
1912 } 1660 }
1913 1661
1914 # Declare an Android gtest apk 1662 # Declare an Android gtest apk
1915 # 1663 #
1916 # This target creates an Android apk for running gtest-based unittests. 1664 # This target creates an Android apk for running gtest-based unittests.
1917 # 1665 #
1918 # Variables 1666 # Variables
1919 # deps: Specifies the dependencies of this target. These will be passed to 1667 # deps: Specifies the dependencies of this target. These will be passed to
1920 # the underlying android_apk invocation and should include the java and 1668 # the underlying android_apk invocation and should include the java and
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 # Example 1752 # Example
2005 # android_aidl("foo_aidl") { 1753 # android_aidl("foo_aidl") {
2006 # import_include = "java/src" 1754 # import_include = "java/src"
2007 # sources = [ 1755 # sources = [
2008 # "java/src/com/foo/bar/FooBarService.aidl", 1756 # "java/src/com/foo/bar/FooBarService.aidl",
2009 # "java/src/com/foo/bar/FooBarServiceCallback.aidl", 1757 # "java/src/com/foo/bar/FooBarServiceCallback.aidl",
2010 # ] 1758 # ]
2011 # } 1759 # }
2012 template("android_aidl") { 1760 template("android_aidl") {
2013 set_sources_assignment_filter([]) 1761 set_sources_assignment_filter([])
2014 if (defined(invoker.testonly)) { 1762 forward_variables_from(invoker, [ "testonly" ])
2015 testonly = invoker.testonly
2016 }
2017 1763
2018 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" 1764 srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
2019 aidl_path = "${android_sdk_build_tools}/aidl" 1765 aidl_path = "${android_sdk_build_tools}/aidl"
2020 framework_aidl = "$android_sdk/framework.aidl" 1766 framework_aidl = "$android_sdk/framework.aidl"
2021 1767
2022 action(target_name) { 1768 action(target_name) {
2023 script = "//build/android/gyp/aidl.py" 1769 script = "//build/android/gyp/aidl.py"
2024 sources = invoker.sources 1770 sources = invoker.sources
2025 1771
2026 imports = [ framework_aidl ] 1772 imports = [ framework_aidl ]
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 # binary: Path to (stripped) executable. 1827 # binary: Path to (stripped) executable.
2082 # 1828 #
2083 # Example 1829 # Example
2084 # create_native_executable_dist("foo_dist") { 1830 # create_native_executable_dist("foo_dist") {
2085 # dist_dir = "$root_build_dir/foo_dist" 1831 # dist_dir = "$root_build_dir/foo_dist"
2086 # binary = "$root_build_dir/foo" 1832 # binary = "$root_build_dir/foo"
2087 # deps = [ ":the_thing_that_makes_foo" ] 1833 # deps = [ ":the_thing_that_makes_foo" ]
2088 # } 1834 # }
2089 template("create_native_executable_dist") { 1835 template("create_native_executable_dist") {
2090 set_sources_assignment_filter([]) 1836 set_sources_assignment_filter([])
2091 if (defined(invoker.testonly)) { 1837 forward_variables_from(invoker, [ "testonly" ])
2092 testonly = invoker.testonly
2093 }
2094 1838
2095 dist_dir = invoker.dist_dir 1839 dist_dir = invoker.dist_dir
2096 binary = invoker.binary 1840 binary = invoker.binary
2097 template_name = target_name 1841 template_name = target_name
2098 1842
2099 libraries_list = 1843 libraries_list =
2100 "${target_gen_dir}/${template_name}_library_dependencies.list" 1844 "${target_gen_dir}/${template_name}_library_dependencies.list"
2101 1845
2102 find_deps_target_name = "${template_name}__find_library_dependencies" 1846 find_deps_target_name = "${template_name}__find_library_dependencies"
2103 copy_target_name = "${template_name}__copy_libraries_and_exe" 1847 copy_target_name = "${template_name}__copy_libraries_and_exe"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 # sources: Paths to .proto files to compile. 1919 # sources: Paths to .proto files to compile.
2176 # proto_path: Root directory of .proto files. 1920 # proto_path: Root directory of .proto files.
2177 # 1921 #
2178 # Example: 1922 # Example:
2179 # proto_java_library("foo_proto_java") { 1923 # proto_java_library("foo_proto_java") {
2180 # proto_path = [ "src/foo" ] 1924 # proto_path = [ "src/foo" ]
2181 # sources = [ "$proto_path/foo.proto" ] 1925 # sources = [ "$proto_path/foo.proto" ]
2182 # } 1926 # }
2183 template("proto_java_library") { 1927 template("proto_java_library") {
2184 set_sources_assignment_filter([]) 1928 set_sources_assignment_filter([])
1929 forward_variables_from(invoker, [ "testonly" ])
2185 _protoc_dep = "//third_party/android_protobuf:android_protoc($host_toolchain)" 1930 _protoc_dep = "//third_party/android_protobuf:android_protoc($host_toolchain)"
2186 _protoc_out_dir = get_label_info(_protoc_dep, "root_out_dir") 1931 _protoc_out_dir = get_label_info(_protoc_dep, "root_out_dir")
2187 _protoc_bin = "$_protoc_out_dir/android_protoc" 1932 _protoc_bin = "$_protoc_out_dir/android_protoc"
2188 _proto_path = invoker.proto_path 1933 _proto_path = invoker.proto_path
2189 1934
2190 _template_name = target_name 1935 _template_name = target_name
2191 1936
2192 action("${_template_name}__protoc_java") { 1937 action("${_template_name}__protoc_java") {
2193 srcjar_path = "$target_gen_dir/$target_name.srcjar" 1938 srcjar_path = "$target_gen_dir/$target_name.srcjar"
2194 script = "//build/protoc_java.py" 1939 script = "//build/protoc_java.py"
(...skipping 23 matching lines...) Expand all
2218 srcjar_deps = [ ":${_template_name}__protoc_java" ] 1963 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2219 deps = [ 1964 deps = [
2220 "//third_party/android_protobuf:protobuf_nano_javalib", 1965 "//third_party/android_protobuf:protobuf_nano_javalib",
2221 ] 1966 ]
2222 } 1967 }
2223 } 1968 }
2224 1969
2225 # TODO(GYP): implement this. 1970 # TODO(GYP): implement this.
2226 template("uiautomator_test") { 1971 template("uiautomator_test") {
2227 set_sources_assignment_filter([]) 1972 set_sources_assignment_filter([])
2228 if (defined(invoker.testonly)) { 1973 forward_variables_from(invoker, [ "testonly" ])
2229 testonly = invoker.testonly
2230 }
2231 assert(target_name != "") 1974 assert(target_name != "")
2232 assert(invoker.deps != [] || true) 1975 assert(invoker.deps != [] || true)
2233 group(target_name) { 1976 group(target_name) {
2234 } 1977 }
2235 } 1978 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698