Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the artifact macro for loading maven deps #9574

Merged
merged 7 commits into from Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions BUILD.bazel
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_jvm_external//:defs.bzl", "artifact")
load(":java_grpc_library.bzl", "java_grpc_library")

java_proto_library(
Expand All @@ -33,9 +34,9 @@ java_library(
"//protobuf",
"//stub",
"//stub:javax_annotation",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_protobuf//:protobuf_java",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
],
)

Expand All @@ -47,16 +48,16 @@ java_library(
"//protobuf-lite",
"//stub",
"//stub:javax_annotation",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
],
)

java_plugin(
name = "auto_value",
generates_api = 1,
processor_class = "com.google.auto.value.processor.AutoValueProcessor",
deps = ["@com_google_auto_value_auto_value//jar"],
deps = [artifact("com.google.auto.value:auto-value")],
)

java_library(
Expand All @@ -65,7 +66,7 @@ java_library(
neverlink = 1,
visibility = ["//:__subpackages__"],
exports = [
"@com_google_auto_value_auto_value_annotations//jar",
"@org_apache_tomcat_annotations_api//jar", # @Generated for Java 9+
artifact("com.google.auto.value:auto-value-annotations"),
artifact("org.apache.tomcat:annotations-api"), # @Generated for Java 9+
],
)
5 changes: 0 additions & 5 deletions WORKSPACE
Expand Up @@ -34,14 +34,9 @@ switched_rules_by_language(

maven_install(
artifacts = IO_GRPC_GRPC_JAVA_ARTIFACTS + PROTOBUF_MAVEN_ARTIFACTS,
generate_compat_repositories = True,
override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS,
repositories = [
"https://repo.maven.apache.org/maven2/",
],
strict_visibility = True,
)

load("@maven//:compat.bzl", "compat_repositories")

compat_repositories()
31 changes: 16 additions & 15 deletions alts/BUILD.bazel
@@ -1,3 +1,4 @@
load("@rules_jvm_external//:defs.bzl", "artifact")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//:java_grpc_library.bzl", "java_grpc_library")

Expand All @@ -14,16 +15,16 @@ java_library(
"//grpclb",
"//netty",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
"@io_netty_netty_buffer//jar",
"@io_netty_netty_codec//jar",
"@io_netty_netty_common//jar",
"@io_netty_netty_handler//jar",
"@io_netty_netty_transport//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
artifact("io.netty:netty-buffer"),
artifact("io.netty:netty-codec"),
artifact("io.netty:netty-common"),
artifact("io.netty:netty-handler"),
artifact("io.netty:netty-transport"),
],
)

Expand All @@ -41,13 +42,13 @@ java_library(
"//auth",
"//core:internal",
"//netty",
"@com_google_auth_google_auth_library_oauth2_http//jar",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@io_netty_netty_common//jar",
"@io_netty_netty_handler//jar",
"@io_netty_netty_transport//jar",
artifact("com.google.auth:google-auth-library-oauth2-http"),
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
artifact("io.netty:netty-common"),
artifact("io.netty:netty-handler"),
artifact("io.netty:netty-transport"),
],
)

Expand Down
12 changes: 7 additions & 5 deletions api/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "api",
srcs = glob([
Expand All @@ -7,10 +9,10 @@ java_library(
javacopts = ["-Xep:DoNotCall:OFF"], # Remove once requiring Bazel 3.4.0+; allows non-final
visibility = ["//visibility:public"],
deps = [
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_failureaccess//jar", # future transitive dep of Guava. See #5214
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:failureaccess"), # future transitive dep of Guava. See #5214
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
],
)
10 changes: 6 additions & 4 deletions auth/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "auth",
srcs = glob([
Expand All @@ -6,9 +8,9 @@ java_library(
visibility = ["//visibility:public"],
deps = [
"//api",
"@com_google_auth_google_auth_library_credentials//jar",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
artifact("com.google.auth:google-auth-library-credentials"),
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
],
)
10 changes: 6 additions & 4 deletions census/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "census",
srcs = glob([
Expand All @@ -7,9 +9,9 @@ java_library(
deps = [
"//api",
"//context",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@io_opencensus_opencensus_api//jar",
"@io_opencensus_opencensus_contrib_grpc_metrics//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
artifact("io.opencensus:opencensus-api"),
artifact("io.opencensus:opencensus-contrib-grpc-metrics"),
],
)
9 changes: 5 additions & 4 deletions compiler/BUILD.bazel
@@ -1,4 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_jvm_external//:defs.bzl", "artifact")
load("//:java_grpc_library.bzl", "java_rpc_toolchain")

# This should not generally be referenced. Users should use java_grpc_library
Expand All @@ -22,8 +23,8 @@ java_library(
"//protobuf",
"//stub",
"//stub:javax_annotation",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
"@com_google_protobuf//:protobuf_java",
],
)
Expand All @@ -35,8 +36,8 @@ java_library(
"//protobuf-lite",
"//stub",
"//stub:javax_annotation",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
],
)

Expand Down
18 changes: 10 additions & 8 deletions core/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "core",
visibility = ["//visibility:public"],
Expand All @@ -23,14 +25,14 @@ java_library(
deps = [
"//api",
"//context",
"@com_google_android_annotations//jar",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_code_gson_gson//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@io_perfmark_perfmark_api//jar",
"@org_codehaus_mojo_animal_sniffer_annotations//jar",
artifact("com.google.code.gson:gson"),
artifact("com.google.android:annotations"),
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
artifact("io.perfmark:perfmark-api"),
artifact("org.codehaus.mojo:animal-sniffer-annotations"),
],
)

Expand Down
4 changes: 3 additions & 1 deletion googleapis/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "googleapis",
srcs = glob([
Expand All @@ -9,6 +11,6 @@ java_library(
"//api",
"//core:internal",
"//xds",
"@com_google_guava_guava//jar",
artifact("com.google.guava:guava"),
],
)
7 changes: 4 additions & 3 deletions grpclb/BUILD.bazel
@@ -1,3 +1,4 @@
load("@rules_jvm_external//:defs.bzl", "artifact")
load("//:java_grpc_library.bzl", "java_grpc_library")

java_library(
Expand All @@ -16,11 +17,11 @@ java_library(
"//core:internal",
"//util",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@com_google_protobuf//:protobuf_java_util",
"@io_grpc_grpc_proto//:grpclb_load_balancer_java_proto",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
],
)

Expand Down
12 changes: 7 additions & 5 deletions inprocess/BUILD.bazel
@@ -1,16 +1,18 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "inprocess",
srcs = glob([
"src/main/java/io/grpc/inprocess/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//core:internal",
"//api",
"//context",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"//core:internal",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
],
)
34 changes: 18 additions & 16 deletions netty/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "netty",
srcs = glob([
Expand All @@ -10,22 +12,22 @@ java_library(
deps = [
"//api",
"//core:internal",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@io_netty_netty_buffer//jar",
"@io_netty_netty_codec//jar",
"@io_netty_netty_codec_http//jar",
"@io_netty_netty_codec_http2//jar",
"@io_netty_netty_codec_socks//jar",
"@io_netty_netty_common//jar",
"@io_netty_netty_handler//jar",
"@io_netty_netty_handler_proxy//jar",
"@io_netty_netty_resolver//jar",
"@io_netty_netty_transport//jar",
"@io_netty_netty_transport_native_unix_common//jar",
"@io_perfmark_perfmark_api//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
artifact("io.netty:netty-buffer"),
artifact("io.netty:netty-codec"),
artifact("io.netty:netty-codec-http"),
artifact("io.netty:netty-codec-http2"),
artifact("io.netty:netty-codec-socks"),
artifact("io.netty:netty-common"),
artifact("io.netty:netty-handler"),
artifact("io.netty:netty-handler-proxy"),
artifact("io.netty:netty-resolver"),
artifact("io.netty:netty-transport"),
artifact("io.netty:netty-transport-native-unix-common"),
artifact("io.perfmark:perfmark-api"),
],
)

Expand Down
10 changes: 6 additions & 4 deletions netty/shaded/BUILD.bazel
@@ -1,12 +1,14 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

# Publicly exposed in //netty package. Purposefully does not export any symbols.
java_library(
name = "shaded",
visibility = ["//netty:__pkg__"],
runtime_deps = [
"//netty",
"@io_netty_netty_tcnative_boringssl_static//jar",
"@io_netty_netty_tcnative_classes//jar",
"@io_netty_netty_transport_native_unix_common//jar",
"@io_netty_netty_transport_native_epoll_linux_x86_64//jar",
artifact("io.netty:netty-tcnative-boringssl-static"),
artifact("io.netty:netty-tcnative-classes"),
artifact("io.netty:netty-transport-native-unix-common"),
artifact("io.netty:netty-transport-native-epoll_linux_x86_64"),
],
)
16 changes: 9 additions & 7 deletions okhttp/BUILD.bazel
@@ -1,3 +1,5 @@
load("@rules_jvm_external//:defs.bzl", "artifact")

java_library(
name = "okhttp",
srcs = glob([
Expand All @@ -12,12 +14,12 @@ java_library(
"//api",
"//core:internal",
"//util",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_errorprone_error_prone_annotations//jar",
"@com_google_guava_guava//jar",
"@com_google_j2objc_j2objc_annotations//jar",
"@com_squareup_okhttp_okhttp//jar",
"@com_squareup_okio_okio//jar",
"@io_perfmark_perfmark_api//jar",
artifact("com.google.code.findbugs:jsr305"),
artifact("com.google.errorprone:error_prone_annotations"),
artifact("com.google.guava:guava"),
artifact("com.google.j2objc:j2objc-annotations"),
artifact("com.squareup.okhttp:okhttp"),
artifact("com.squareup.okio:okio"),
artifact("io.perfmark:perfmark-api"),
],
)