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

Unified Diff: build/config/android/rules.gni

Issue 237973002: Add generate_jni template (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/BUILD.gn ('k') | third_party/libwebp/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
new file mode 100644
index 0000000000000000000000000000000000000000..6820ba3c76c5f766b0543f538f4b07baf11fd317
--- /dev/null
+++ b/build/config/android/rules.gni
@@ -0,0 +1,61 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Declare a jni target
+#
+# This target generates the native jni bindings for a set of .java files.
+#
+# See base/android/jni_generator/jni_generator.py for more info about the
+# format of generating JNI bindings.
+#
+# Variables
+# sources: list of .java files to generate jni for
+# jni_package: subdirectory path for generated bindings
+#
+# Example
+# generate_jni("foo_jni") {
+# sources = [
+# "android/java/src/org/chromium/foo/Foo.java",
+# "android/java/src/org/chromium/foo/FooUtil.java",
+# ]
+# jni_package = "foo"
+# }
+template("generate_jni") {
+ assert(defined(invoker.sources))
+ assert(defined(invoker.jni_package))
+ jni_package = invoker.jni_package
+ base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}"
+ jni_output_dir = "${base_output_dir}/jni"
+
+ jni_generator_includes =
+ rebase_path("//base/android/jni_generator/jni_generator_helper.h")
+
+ config("jni_includes_${target_name}") {
+ include_dirs = [ base_output_dir ]
+ }
+
+ action_foreach(target_name) {
+ script = "//base/android/jni_generator/jni_generator.py"
+ direct_dependent_configs = [ ":jni_includes_${target_name}" ]
+ sources = invoker.sources
+ outputs = [
+ "${jni_output_dir}/{{source_name_part}}_jni.h"
+ ]
+
+ args = [
+ "--input_file={{source}}",
+ "--optimize_generation=1",
+ "--ptr_type=long",
+ "--output_dir", rebase_path(jni_output_dir),
+ "--includes=${jni_generator_includes}",
+ ]
+ if (defined(invoker.jni_generator_jarjar_file)) {
+ args += [
+ "--jarjar", rebase_path(jni_generator_jarjar_file)
+ ]
+ }
+
+ hard_dep = true
+ }
+}
« no previous file with comments | « base/BUILD.gn ('k') | third_party/libwebp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698