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
pull/12591/head
Deanna Garcia 2 years ago
parent 112a9021be
commit 433c35dbcb
  1. 37
      java/core/BUILD.bazel
  2. 20
      java/util/BUILD.bazel

@ -121,11 +121,21 @@ internal_gen_well_known_protos_java(
)
# 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 @@ protobuf_java_export(
"//:lite_well_known_protos",
],
tags = ["manual"],
runtime_deps = [":lite"],
runtime_deps = [":lite_bundle"],
)
protobuf_java_library(
@ -171,7 +181,7 @@ internal_gen_well_known_protos_java(
],
)
protobuf_versioned_java_library(
java_library(
name = "core",
srcs = glob(
[
@ -181,6 +191,25 @@ protobuf_versioned_java_library(
) + [
":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 @@ protobuf_java_export(
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":core"],
runtime_deps = [":core_bundle"],
)
filegroup(

@ -5,11 +5,27 @@ load("//build_defs:java_opts.bzl", "protobuf_java_export", "protobuf_versioned_j
load("//:protobuf_version.bzl", "PROTOBUF_JAVA_VERSION")
load("//java/internal:testing.bzl", "junit_tests")
protobuf_versioned_java_library(
java_library(
name = "util",
srcs = glob([
"src/main/java/com/google/protobuf/util/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//java/core",
"@maven//:com_google_code_findbugs_jsr305",
"@maven//:com_google_code_gson_gson",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_guava",
"@maven//:com_google_j2objc_j2objc_annotations",
],
)
protobuf_versioned_java_library(
name = "util_bundle",
srcs = glob([
"src/main/java/com/google/protobuf/util/*.java",
]),
bundle_description = "Utilities for Protocol Buffers",
bundle_name = "Protocol Buffers [Util]",
bundle_symbolic_name = "com.google.protobuf.util",
@ -32,7 +48,7 @@ protobuf_java_export(
pom_template = "pom_template.xml",
tags = ["manual"],
visibility = ["//java:__pkg__"],
runtime_deps = [":util"],
runtime_deps = [":util_bundle"],
)
filegroup(

Loading…
Cancel
Save