Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 } | 390 } |
| 391 | 391 |
| 392 group(final_target_name) { | 392 group(final_target_name) { |
| 393 forward_variables_from(invoker, [ "visibility" ]) | 393 forward_variables_from(invoker, [ "visibility" ]) |
| 394 public_deps = [ | 394 public_deps = [ |
| 395 ":$zip_srcjar_target_name", | 395 ":$zip_srcjar_target_name", |
| 396 ] | 396 ] |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 # Declare a target for generating Java constants from Google API Keys. | |
| 401 # | |
| 402 # This target will create a single .srcjar. Adding this target to an | |
| 403 # android_library target's srcjar_deps will make the generated java files be | |
| 404 # included in that library's final outputs. | |
| 405 # | |
| 406 # Example | |
| 407 # java_google_api_keys("foo_generated_keys") { | |
| 408 # } | |
| 409 template("java_google_api_keys") { | |
|
agrieve
2015/10/30 00:55:13
This is not really a general-purpose template (giv
dvh
2015/10/30 20:56:21
Are there examples of non-general-purpose things I
agrieve
2015/10/31 02:09:37
What I think would be best is to avoid declaring a
brettw
2015/11/02 05:29:18
+1
| |
| 410 set_sources_assignment_filter([]) | |
|
agrieve
2015/10/30 00:55:14
No need to do this since the template doesn't look
dvh
2015/10/30 20:56:21
Done.
| |
| 411 forward_variables_from(invoker, [ "testonly" ]) | |
| 412 | |
| 413 generate_google_api_keys_target_name = | |
|
agrieve
2015/10/30 00:55:13
nit: It has become customary to prefix all local v
dvh
2015/10/30 20:56:21
Done.
| |
| 414 "${target_name}__generate_google_api_keys" | |
| 415 zip_srcjar_target_name = "${target_name}__zip_srcjar" | |
| 416 final_target_name = target_name | |
| 417 | |
| 418 action(generate_google_api_keys_target_name) { | |
| 419 visibility = [ ":$zip_srcjar_target_name" ] | |
| 420 | |
| 421 # The sources aren't compiled so don't check their dependencies. | |
| 422 check_includes = false | |
|
agrieve
2015/10/30 00:55:13
this isn't applicable since there are no sources
dvh
2015/10/30 20:56:21
Done.
| |
| 423 | |
| 424 script = "//build/android/gyp/java_google_api_keys.py" | |
| 425 gen_dir = "${target_gen_dir}/${target_name}/java_google_api_keys" | |
| 426 outputs = [ | |
| 427 get_path_info(rebase_path("GoogleAPIKeys.java", ".", gen_dir), "abspath"), | |
|
agrieve
2015/10/30 00:55:13
Nit: I think rebase_path(foo, "", bar) will return
dvh
2015/10/30 20:56:21
Done.
| |
| 428 ] | |
| 429 | |
| 430 args = [ rebase_path(gen_dir, root_build_dir) ] | |
| 431 } | |
| 432 | |
| 433 generate_google_api_keys_outputs = | |
|
agrieve
2015/10/30 00:55:14
nit: this is used only within zip(), so put it wit
dvh
2015/10/30 20:56:21
Done.
| |
| 434 get_target_outputs(":$generate_google_api_keys_target_name") | |
| 435 base_gen_dir = | |
|
agrieve
2015/10/30 00:55:14
I believe this is equivalent to:
base_gen_dir = ta
dvh
2015/10/30 20:56:21
Could you tell me more about that?
I'm not even su
agrieve
2015/10/31 02:09:37
The command "gn help" has pretty exhaustive docs.
| |
| 436 get_label_info(":$generate_google_api_keys_target_name", "target_gen_dir") | |
| 437 | |
| 438 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | |
| 439 zip(zip_srcjar_target_name) { | |
| 440 visibility = [ ":$final_target_name" ] | |
| 441 inputs = generate_google_api_keys_outputs | |
| 442 output = srcjar_path | |
| 443 base_dir = base_gen_dir | |
| 444 deps = [ | |
| 445 ":$generate_google_api_keys_target_name", | |
| 446 ] | |
| 447 } | |
| 448 | |
| 449 group(final_target_name) { | |
| 450 forward_variables_from(invoker, [ "visibility" ]) | |
| 451 public_deps = [ | |
| 452 ":$zip_srcjar_target_name", | |
| 453 ] | |
| 454 } | |
| 455 } | |
| 456 | |
| 400 # Declare a target for processing a Jinja template. | 457 # Declare a target for processing a Jinja template. |
| 401 # | 458 # |
| 402 # Variables | 459 # Variables |
| 403 # input: The template file to be processed. | 460 # input: The template file to be processed. |
| 404 # output: Where to save the result. | 461 # output: Where to save the result. |
| 405 # variables: (Optional) A list of variables to make available to the template | 462 # variables: (Optional) A list of variables to make available to the template |
| 406 # processing environment, e.g. ["name=foo", "color=red"]. | 463 # processing environment, e.g. ["name=foo", "color=red"]. |
| 407 # | 464 # |
| 408 # Example | 465 # Example |
| 409 # jinja_template("chrome_public_manifest") { | 466 # jinja_template("chrome_public_manifest") { |
| (...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2028 } | 2085 } |
| 2029 | 2086 |
| 2030 android_library(target_name) { | 2087 android_library(target_name) { |
| 2031 java_files = [] | 2088 java_files = [] |
| 2032 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2089 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
| 2033 deps = [ | 2090 deps = [ |
| 2034 "//third_party/android_protobuf:protobuf_nano_javalib", | 2091 "//third_party/android_protobuf:protobuf_nano_javalib", |
| 2035 ] | 2092 ] |
| 2036 } | 2093 } |
| 2037 } | 2094 } |
| OLD | NEW |