Remove osgi dependency from main java libraries.
//java:core, //java:lite, and //java:util shouldn't have this extra dependency. For now, we just add a separate version but we will look into using the java_library in protobuf_versioned_java_library in the future.
PiperOrigin-RevId: 527643325
diff --git a/java/core/BUILD.bazel b/java/core/BUILD.bazel
index 49bf0e0..8f2bfe3 100644
--- a/java/core/BUILD.bazel
+++ b/java/core/BUILD.bazel
@@ -121,11 +121,21 @@
)
# Should be used as `//java/lite`.
-protobuf_versioned_java_library(
+java_library(
name = "lite",
srcs = LITE_SRCS + [
":gen_well_known_protos_javalite",
],
+ visibility = [
+ "//java/lite:__pkg__",
+ ],
+)
+
+protobuf_versioned_java_library(
+ name = "lite_bundle",
+ srcs = LITE_SRCS + [
+ ":gen_well_known_protos_javalite",
+ ],
bundle_description = "Lite version of Protocol Buffers library. This " +
"version is optimized for code size, but does not " +
"guarantee API/ABI stability.",
@@ -145,7 +155,7 @@
"//:lite_well_known_protos",
],
tags = ["manual"],
- runtime_deps = [":lite"],
+ runtime_deps = [":lite_bundle"],
)
protobuf_java_library(
@@ -171,7 +181,7 @@
],
)
-protobuf_versioned_java_library(
+java_library(
name = "core",
srcs = glob(
[
@@ -181,6 +191,25 @@
) + [
":gen_well_known_protos_java",
],
+ visibility = ["//visibility:public"],
+ exports = [
+ ":lite_runtime_only",
+ ],
+ deps = [
+ ":lite_runtime_only",
+ ],
+)
+
+protobuf_versioned_java_library(
+ name = "core_bundle",
+ srcs = glob(
+ [
+ "src/main/java/com/google/protobuf/*.java",
+ ],
+ exclude = LITE_SRCS,
+ ) + [
+ ":gen_well_known_protos_java",
+ ],
bundle_description = "Core Protocol Buffers library. Protocol Buffers " +
"are a way of encoding structured data in an " +
"efficient yet extensible format.",
@@ -205,7 +234,7 @@
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
- runtime_deps = [":core"],
+ runtime_deps = [":core_bundle"],
)
filegroup(