Skip to content

Commit f4713e2

Browse files
zhangskzcopybara-github
authored andcommitted
Add protobuf_maven artifacts to protobuf_maven_dev as well so they can still be referenced correctly using the dev namespace for dev-only targets.
Otherwise, protobuf_maven_dev may provide a different version from a transitive dep, which can result in the wrong version being selected (e.g. when used for bazel-generated maven artifacts). Also updates protobuf_util_bundle to use protobuf_maven instead of protobuf_maven_dev which is probably more appropriate since its control the deps in the pom.xml file for maven users (though this is functionally the same rn). Fixes #20710 PiperOrigin-RevId: 738887165
1 parent 0e7d481 commit f4713e2

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

MODULE.bazel

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,18 @@ crate.spec(
151151
crate.from_specs()
152152
use_repo(crate, crate_index = "crates")
153153

154+
PROTOBUF_MAVEN_ARTIFACTS = [
155+
"com.google.code.findbugs:jsr305:3.0.2",
156+
"com.google.code.gson:gson:2.8.9",
157+
"com.google.errorprone:error_prone_annotations:2.5.1",
158+
"com.google.j2objc:j2objc-annotations:2.8",
159+
"com.google.guava:guava:32.0.1-jre",
160+
]
161+
154162
protobuf_maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
155163
protobuf_maven.install(
156164
name = "protobuf_maven",
157-
artifacts = [
158-
"com.google.code.findbugs:jsr305:3.0.2",
159-
"com.google.code.gson:gson:2.8.9",
160-
"com.google.errorprone:error_prone_annotations:2.5.1",
161-
"com.google.j2objc:j2objc-annotations:2.8",
162-
"com.google.guava:guava:32.0.1-jre",
163-
],
165+
artifacts = PROTOBUF_MAVEN_ARTIFACTS,
164166
repositories = [
165167
"https://repo1.maven.org/maven2",
166168
"https://repo.maven.apache.org/maven2",
@@ -172,7 +174,7 @@ use_repo(protobuf_maven, "protobuf_maven")
172174
protobuf_maven_dev = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True)
173175
protobuf_maven_dev.install(
174176
name = "protobuf_maven_dev",
175-
artifacts = [
177+
artifacts = PROTOBUF_MAVEN_ARTIFACTS + [
176178
"com.google.caliper:caliper:1.0-beta-3",
177179
"com.google.guava:guava-testlib:32.0.1-jre",
178180
"com.google.testparameterinjector:test-parameter-injector:1.18",

java/util/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ protobuf_versioned_java_library(
3434
visibility = ["//visibility:public"],
3535
deps = [
3636
"//java/core",
37-
"@protobuf_maven_dev//:com_google_code_findbugs_jsr305",
38-
"@protobuf_maven_dev//:com_google_code_gson_gson",
39-
"@protobuf_maven_dev//:com_google_errorprone_error_prone_annotations",
40-
"@protobuf_maven_dev//:com_google_guava_guava",
41-
"@protobuf_maven_dev//:com_google_j2objc_j2objc_annotations",
37+
"@protobuf_maven//:com_google_code_findbugs_jsr305",
38+
"@protobuf_maven//:com_google_code_gson_gson",
39+
"@protobuf_maven//:com_google_errorprone_error_prone_annotations",
40+
"@protobuf_maven//:com_google_guava_guava",
41+
"@protobuf_maven//:com_google_j2objc_j2objc_annotations",
4242
],
4343
)
4444

0 commit comments

Comments
 (0)