From 6fad603bfebe6314ecaa4d74a3ffdca430eeb8a6 Mon Sep 17 00:00:00 2001
From: "cjhopman@chromium.org"
 <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Mon, 26 May 2014 04:01:47 +0000
Subject: Add java_cpp_template template

This is the GN version of build/java_cpp_template.gypi.

It defines a template that wraps an action_foreach that generates .java
files using the host C preprocessor.

The major difference in the GN version is that it takes all the
generated java files and zips them together in a single .srcjar. When
such a target is included in the srcjar_deps of a java library, the
.java files in the .srcjar will be treated much like files listed in
that libraries java_sources (particularly they will be compiled and
included in the .jar/.dex).

Depends on https://crrev.com/264773014/

BUG=359249

Review URL: https://codereview.chromium.org/264923007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272775 0039d316-1c4b-4281-b951-d872f2087c98
---
 build/config/android/internal_rules.gni | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 build/config/android/internal_rules.gni

(limited to 'build/config/android/internal_rules.gni')

diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
new file mode 100644
index 0000000..b3114ef
--- /dev/null
+++ b/build/config/android/internal_rules.gni
@@ -0,0 +1,25 @@
+
+# Creates a zip archive of the inputs.
+# If base_dir is provided, the archive paths will be relative to it.
+template("zip") {
+  assert(defined(invoker.inputs))
+  assert(defined(invoker.output))
+
+  rebase_inputs = rebase_path(invoker.inputs)
+  rebase_output = rebase_path(invoker.output)
+  action(target_name) {
+    script = "//build/android/gn/zip.py"
+    source_prereqs = invoker.inputs
+    outputs = [invoker.output]
+    args = [
+      "--inputs=$rebase_inputs",
+      "--output=$rebase_output",
+    ]
+    if (defined(invoker.base_dir)) {
+      args += [
+        "--base-dir", rebase_path(invoker.base_dir)
+      ]
+    }
+  }
+}
+
-- 
cgit v1.1