aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Delmerico <delmerico@google.com>2022-02-03 19:12:20 +0000
committerSam Delmerico <delmerico@google.com>2022-02-03 19:12:20 +0000
commitfe5f4c89112958a00fc4079eb6966c225aadc866 (patch)
treeb32696bff1aeedfe3d7432bf946f22131e26cdc6
parentba149bac757282c00c754544b3788e01a5797241 (diff)
downloadguava-fe5f4c89112958a00fc4079eb6966c225aadc866.tar.gz
`guava` target is alias depending on configuration
Instead of requiring modules to explicitly depend on one of the guava targets, we provide an alias that matches the correct dependency depending on what Bazel configuration is available for that dependency edge. In particular, this allows error_prone to build as a host module and depend on the host-only Guava library. Bug: 215229742 Test: build/bazel/bp2build.sh Change-Id: I714834695a124316c1d80cd734555d177f608bd6
-rw-r--r--BUILD11
1 files changed, 11 insertions, 0 deletions
diff --git a/BUILD b/BUILD
index 03f888d22..168dbb0f1 100644
--- a/BUILD
+++ b/BUILD
@@ -1,4 +1,14 @@
# TODO(b/198224074): auto-generate this file using bp2build.
+#
+
+alias(
+ name = "guava",
+ actual = select({
+ "//build/bazel/platforms/os:android": ":guava-android-host",
+ "//conditions:default": ":guava-jre",
+ }),
+ visibility = ["//visibility:public"],
+)
java_library(
name = "guava-android-host",
@@ -10,6 +20,7 @@ java_library(
"//external/error_prone:error_prone_annotations",
"//external/jsr305",
],
+ target_compatible_with = ["//build/bazel/platforms/os:android"],
)
java_library(