| Index: build/config/android/rules.gni
|
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
|
| index 850f13e44beb58fda74fcd1954155390448007d9..abf64a1c4044cc5e048e92248fa8f778363cbd25 100644
|
| --- a/build/config/android/rules.gni
|
| +++ b/build/config/android/rules.gni
|
| @@ -2,6 +2,8 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import("internal_rules.gni")
|
| +
|
| # Declare a jni target
|
| #
|
| # This target generates the native jni bindings for a set of .java files.
|
| @@ -57,3 +59,83 @@ template("generate_jni") {
|
| }
|
| }
|
| }
|
| +
|
| +# Declare a target for c-preprocessor-generated java files
|
| +#
|
| +# This target generates java files using the host C pre-processor. Each file in
|
| +# sources will be compiled using the C pre-processor. If include_path is
|
| +# specified, it will be passed (with --I) to the pre-processor.
|
| +#
|
| +# This target will create a single .srcjar. Adding this target to a library
|
| +# target's srcjar_deps will make the generated java files be included in that
|
| +# library's final outputs.
|
| +#
|
| +# Variables
|
| +# sources: list of files to be processed by the C pre-processor. For each
|
| +# file in sources, there will be one .java file in the final .srcjar. For a
|
| +# file named FooBar.template, a java file will be created with name
|
| +# FooBar.java.
|
| +# source_prereqs: additional compile-time dependencies. Any files
|
| +# `#include`-ed in the templates should be listed here.
|
| +# package_name: this will be the subdirectory for each .java file in the .srcjar.
|
| +#
|
| +# Example
|
| +# java_cpp_template("foo_generated_enum") {
|
| +# sources = [
|
| +# "android/java/templates/Foo.template",
|
| +# ]
|
| +# source_prereqs = [
|
| +# "android/java/templates/native_foo_header.h",
|
| +# ]
|
| +#
|
| +# package_name = "org/chromium/base/library_loader"
|
| +# include_path = "android/java/templates"
|
| +# }
|
| +template("java_cpp_template") {
|
| + assert(defined(invoker.sources))
|
| + package_name = invoker.package_name + ""
|
| +
|
| + if (defined(invoker.include_path)) {
|
| + include_path = invoker.include_path + ""
|
| + } else {
|
| + include_path = "//"
|
| + }
|
| +
|
| + action_foreach("${target_name}__apply_gcc") {
|
| + script = "//build/android/gyp/gcc_preprocess.py"
|
| + if (defined(invoker.source_prereqs)) {
|
| + source_prereqs = invoker.source_prereqs + []
|
| + }
|
| +
|
| + sources = invoker.sources
|
| +
|
| + gen_dir = "${target_gen_dir}/${package_name}"
|
| + gcc_template_output_pattern = "${gen_dir}/{{source_name_part}}.java"
|
| +
|
| + outputs = [
|
| + gcc_template_output_pattern
|
| + ]
|
| +
|
| + args = [
|
| + "--include-path", rebase_path(include_path, root_build_dir),
|
| + "--output", rebase_path(gen_dir, root_build_dir) + "/{{source_name_part}}.java",
|
| + "--template={{source}}",
|
| + ]
|
| + }
|
| +
|
| + apply_gcc_outputs = get_target_outputs(":${target_name}__apply_gcc")
|
| + base_gen_dir = get_label_info(":${target_name}__apply_gcc", "target_gen_dir")
|
| +
|
| + srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
|
| + zip("${target_name}__zip_srcjar") {
|
| + inputs = apply_gcc_outputs
|
| + output = srcjar_path
|
| + base_dir = base_gen_dir
|
| + }
|
| +
|
| + group(target_name) {
|
| + deps = [
|
| + ":${target_name}__zip_srcjar"
|
| + ]
|
| + }
|
| +}
|
|
|