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

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

Issue 269943005: Add android_library template (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « build/config/android/internal_rules.gni ('k') | third_party/guava/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
index 5b313ac10fb30c42b04c889a8e9a978fb65a3925..9bd4046ae2e43eed7c2030f2b8735b7341aceeb9 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -2,8 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import("config.gni")
-import("internal_rules.gni")
+import("//build/config/android/config.gni")
+import("//build/config/android/internal_rules.gni")
# Declare a jni target
#
@@ -91,6 +91,8 @@ template("generate_jni") {
# jar_file: the path to the .jar. If not provided, will default to the sdk's
# android.jar
#
+# deps, forward_dependent_configs_from: As normal
+#
# Example
# generate_jar_jni("foo_jni") {
# classes = [
@@ -171,9 +173,9 @@ template("generate_jar_jni") {
# 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.
+# 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.
#
# Variables
# sources: list of files to be processed by the C pre-processor. For each
@@ -247,3 +249,69 @@ template("java_cpp_template") {
]
}
}
+
+# Declare an Android library target
+#
+# This target creates an Android library containing java code and Android
+# resources.
+#
+# Variables
+# deps: Specifies the dependencies of this target. Java targets in this list
+# will be added to the javac classpath.
+# java_files: List of .java files included in this library.
+# srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
+# will be added to java_files and be included in this library.
+#
+# jar_excluded_patterns: List of patterns of .class files to exclude from the final jar.
+#
+# Example
+# android_library("foo_java") {
+# java_files = [
+# "android/org/chromium/foo/Foo.java",
+# "android/org/chromium/foo/FooInterface.java",
+# "android/org/chromium/foo/FooService.java",
+# ]
+# deps = [
+# ":bar_java"
+# ]
+# srcjar_deps = [
+# ":foo_generated_enum"
+# ]
+# jar_excluded_patterns = [
+# "*/FooService.class", "*/FooService##*.class"
+# ]
+# }
+template("android_library") {
+ #TODO(cjhopman): resources
+
+ assert(defined(invoker.java_files))
+ dep = ":${target_name}"
+ base_path = get_label_info(dep, "target_gen_dir") + "/" + target_name
+ build_config = base_path + ".build_config"
+
+ write_build_config("${target_name}__build_config") {
+ type = "android_library"
+
+ deps = []
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ # base_path
+ }
+
+ jar_path = base_path + ".jar"
+ android_java_library(target_name) {
+ java_files = invoker.java_files
+ build_config = build_config
+
+ if (defined(invoker.jar_excluded_patterns)) {
+ jar_excluded_patterns = invoker.jar_excluded_patterns
+ }
+
+ if (defined(invoker.srcjar_deps)) {
+ srcjar_deps = invoker.srcjar_deps
+ }
+ }
+}
+
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | third_party/guava/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698