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

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

Issue 2627223003: Support `public_deps` in `android_library` (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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 075c8a77c29be4a5903b7072b000ba6d7d4182b5..6e38320e69e21805b361a8d86432657b85f0249d 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -1204,6 +1204,9 @@ if (enable_java_templates) {
# deps: Specifies the dependencies of this target. Java targets in this list
# will be added to the javac classpath. Android resources in dependencies
# will be used when building this library.
+ # public_deps: Specifies the dependencies of this target that will be
+ # exposed as part of its public API (the .class files will be available
+ # in the output jar).
#
# java_files: List of .java files included in this library.
# srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
@@ -1269,9 +1272,32 @@ if (enable_java_templates) {
assert(defined(invoker.alternative_android_sdk_ijar_dep))
}
- java_library_impl(target_name) {
+ _java_library_impl_target_name = target_name
+ _needs_dist_jar = false
+
+ if (defined(invoker.public_deps)) {
+ forward_variables_from(invoker, [ "testonly" ])
+
+ _public_deps = invoker.public_deps
+ _java_library_impl_target_name = "${target_name}__java_library_impl"
+ _public_deps += [ ":${_java_library_impl_target_name}" ]
+ _needs_dist_jar = true
+
+ dist_jar(target_name) {
+ _target_dir_name = get_label_info(":$target_name", "dir")
+ output_jar_path =
+ "$root_out_dir/lib.java$_target_dir_name/${target_name}.jar"
+ deps = _public_deps
+ }
+ }
+
+ java_library_impl(_java_library_impl_target_name) {
forward_variables_from(invoker, "*")
+ if (_needs_dist_jar) {
+ output_name = "${target_name}_no_public_deps"
+ }
+
supports_android = true
requires_android = true
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698