From ccff312a83482b80a15f63876e0ce0e452328d32 Mon Sep 17 00:00:00 2001 From: Dimiter 'malkia' Stanev Date: Sun, 8 Sep 2024 23:04:54 -0700 Subject: [PATCH] With patch found by user posted in grpc now we can refer to grpc as... @grpc :) --- MODULE.bazel | 13 ++++++++++--- bazel/grpc_bzlmod.diff | 21 +++++++++++++++++++++ examples/grpc/BUILD | 6 +++--- exporters/otlp/BUILD | 8 ++++---- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 bazel/grpc_bzlmod.diff diff --git a/MODULE.bazel b/MODULE.bazel index eb0353668a..71ccb51aee 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,9 +9,16 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "boringssl", version = "0.0.0-20240530-2db0eb3") bazel_dep(name = "curl", version = "8.8.0.bcr.1") bazel_dep(name = "depend_on_what_you_use", version = "0.4.0") -bazel_dep(name = "google_benchmark", version = "1.8.5")#, dev_dependency = True) -bazel_dep(name = "googletest", version = "1.15.2")#, dev_dependency = True) -bazel_dep(name = "grpc", version = "1.66.0.bcr.1", repo_name = "com_github_grpc_grpc") +bazel_dep(name = "google_benchmark", version = "1.8.5") #, dev_dependency = True) +bazel_dep(name = "googletest", version = "1.15.2") #, dev_dependency = True) +bazel_dep(name = "grpc", version = "1.66.0.bcr.1") #, repo_name = "com_github_grpc_grpc") +single_version_override( + module_name = "grpc", + # https://github.com/grpc/grpc/pull/37534 + # https://github.com/grpc/grpc/pull/37534.diff + patches = ["bazel/grpc_bzlmod.diff"], + patch_strip = 1, +) bazel_dep(name = "nlohmann_json", version = "3.11.3") bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "rules_cc", version = "0.0.9") diff --git a/bazel/grpc_bzlmod.diff b/bazel/grpc_bzlmod.diff new file mode 100644 index 0000000000..bb8840b0a9 --- /dev/null +++ b/bazel/grpc_bzlmod.diff @@ -0,0 +1,21 @@ +diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl +index 55ea11cd53f07..8177bf864ceaf 100644 +--- a/bazel/cc_grpc_library.bzl ++++ b/bazel/cc_grpc_library.bzl +@@ -102,7 +102,7 @@ def cc_grpc_library( + generate_cc( + name = codegen_grpc_target, + srcs = proto_targets, +- plugin = "@com_github_grpc_grpc//src/compiler:grpc_cpp_plugin", ++ plugin = Label("//src/compiler:grpc_cpp_plugin"), + well_known_protos = well_known_protos, + generate_mocks = generate_mocks, + **kwargs +@@ -114,6 +114,6 @@ def cc_grpc_library( + hdrs = [":" + codegen_grpc_target], + deps = deps + + extra_deps + +- ["@com_github_grpc_grpc//:grpc++_codegen_proto"], ++ [Label("//:grpc++_codegen_proto")], + **kwargs + ) diff --git a/examples/grpc/BUILD b/examples/grpc/BUILD index df1f271893..5f7d6608fd 100644 --- a/examples/grpc/BUILD +++ b/examples/grpc/BUILD @@ -4,7 +4,7 @@ package(default_visibility = ["//visibility:public"]) load("@rules_proto//proto:defs.bzl", "proto_library") -load("@@grpc+//bazel:cc_grpc_library.bzl", "cc_grpc_library") +load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") load("//:dll_deps.bzl", "dll_deps") load("//bazel:otel_cc.bzl", "otel_cc_binary", "otel_cc_import", "otel_cc_library", "otel_cc_shared_library", "otel_cc_test") @@ -54,7 +54,7 @@ otel_cc_binary( ":tracer_common", "//api", "//sdk/src/trace", - "@@grpc+//:grpc++", + "@grpc//:grpc++", ]), ) @@ -69,6 +69,6 @@ otel_cc_binary( ":tracer_common", "//api", "//sdk/src/trace", - "@@grpc+//:grpc++", + "@grpc//:grpc++", ]), ) diff --git a/exporters/otlp/BUILD b/exporters/otlp/BUILD index ea3ea5643c..7d017450a5 100644 --- a/exporters/otlp/BUILD +++ b/exporters/otlp/BUILD @@ -62,7 +62,7 @@ otel_cc_library( deps = [ "//ext:headers", "//sdk/src/common:global_log_handler", - "@@grpc+//:grpc++", + "@grpc//:grpc++", "@opentelemetry-proto//:common_proto_cc", "@opentelemetry-proto//:logs_service_grpc_cc", "@opentelemetry-proto//:metrics_service_grpc_cc", @@ -543,7 +543,7 @@ otel_cc_test( "@googletest//:gtest_main", "@nlohmann_json//:json", "@opentelemetry-proto//:trace_service_grpc_cc", - "@@grpc+//:grpc++", + "@grpc//:grpc++", ]), ) @@ -642,7 +642,7 @@ otel_cc_test( "@googletest//:gtest_main", "@opentelemetry-proto//:logs_service_grpc_cc", "@opentelemetry-proto//:trace_service_grpc_cc", - "@@grpc+//:grpc++", + "@grpc//:grpc++", ]), ) @@ -769,7 +769,7 @@ otel_cc_benchmark( deps = dll_deps([ ":otlp_grpc_exporter", "//examples/common/foo_library:common_foo_library", - "@@grpc+//:grpc++", + "@grpc//:grpc++", "@opentelemetry-proto//:trace_service_grpc_cc", ]), )