Chromium Code Reviews| Index: build/config/android/rules.gni |
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
| index 76f57dd73758fced358cfcbdb9ca90f6d11362fb..60d0fff1b70b0dc3ab990400757706f8b759a596 100644 |
| --- a/build/config/android/rules.gni |
| +++ b/build/config/android/rules.gni |
| @@ -397,6 +397,63 @@ template("java_cpp_enum") { |
| } |
| } |
| +# Declare a target for generating Java constants from Google API Keys. |
| +# |
| +# This target will create a single .srcjar. Adding this target to an |
| +# android_library target's srcjar_deps will make the generated java files be |
| +# included in that library's final outputs. |
| +# |
| +# Example |
| +# java_google_api_keys("foo_generated_keys") { |
| +# } |
| +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
|
| + 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.
|
| + forward_variables_from(invoker, [ "testonly" ]) |
| + |
| + 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.
|
| + "${target_name}__generate_google_api_keys" |
| + zip_srcjar_target_name = "${target_name}__zip_srcjar" |
| + final_target_name = target_name |
| + |
| + action(generate_google_api_keys_target_name) { |
| + visibility = [ ":$zip_srcjar_target_name" ] |
| + |
| + # The sources aren't compiled so don't check their dependencies. |
| + 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.
|
| + |
| + script = "//build/android/gyp/java_google_api_keys.py" |
| + gen_dir = "${target_gen_dir}/${target_name}/java_google_api_keys" |
| + outputs = [ |
| + 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.
|
| + ] |
| + |
| + args = [ rebase_path(gen_dir, root_build_dir) ] |
| + } |
| + |
| + 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.
|
| + get_target_outputs(":$generate_google_api_keys_target_name") |
| + 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.
|
| + get_label_info(":$generate_google_api_keys_target_name", "target_gen_dir") |
| + |
| + srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
| + zip(zip_srcjar_target_name) { |
| + visibility = [ ":$final_target_name" ] |
| + inputs = generate_google_api_keys_outputs |
| + output = srcjar_path |
| + base_dir = base_gen_dir |
| + deps = [ |
| + ":$generate_google_api_keys_target_name", |
| + ] |
| + } |
| + |
| + group(final_target_name) { |
| + forward_variables_from(invoker, [ "visibility" ]) |
| + public_deps = [ |
| + ":$zip_srcjar_target_name", |
| + ] |
| + } |
| +} |
| + |
| # Declare a target for processing a Jinja template. |
| # |
| # Variables |