Skip to content

Commit 0c69463

Browse files
committed
Load grpc-gateway from bzlmod
1 parent c753dfa commit 0c69463

File tree

7 files changed

+7
-106
lines changed

7 files changed

+7
-106
lines changed

modules/grpc_gateway/BUILD.bazel

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ proto_plugin(
1010
options = ["paths=source_relative"],
1111
outputs = ["{protopath}.pb.gw.go"],
1212
separate_options_flag = True,
13-
tool = select({
14-
"@bazel_tools//src/conditions:darwin_arm64": "@grpc_gateway_plugin_darwin_arm64//file",
15-
"@bazel_tools//src/conditions:darwin_x86_64": "@grpc_gateway_plugin_darwin_x86_64//file",
16-
"@bazel_tools//src/conditions:linux_aarch64": "@grpc_gateway_plugin_linux_arm64//file",
17-
"@bazel_tools//src/conditions:linux_x86_64": "@grpc_gateway_plugin_linux_x86_64//file",
18-
"@bazel_tools//src/conditions:windows_arm64": "@grpc_gateway_plugin_windows_arm64//file",
19-
"@bazel_tools//src/conditions:windows_x64": "@grpc_gateway_plugin_windows_x86_64//file",
20-
}),
13+
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway",
2114
visibility = ["//visibility:public"],
2215
)
2316

@@ -32,13 +25,6 @@ proto_plugin(
3225
"QUIRK_DIRECT_MODE",
3326
],
3427
separate_options_flag = True,
35-
tool = select({
36-
"@bazel_tools//src/conditions:darwin_arm64": "@openapiv2_plugin_darwin_arm64//file",
37-
"@bazel_tools//src/conditions:darwin_x86_64": "@openapiv2_plugin_darwin_x86_64//file",
38-
"@bazel_tools//src/conditions:linux_aarch64": "@openapiv2_plugin_linux_arm64//file",
39-
"@bazel_tools//src/conditions:linux_x86_64": "@openapiv2_plugin_linux_x86_64//file",
40-
"@bazel_tools//src/conditions:windows_arm64": "@openapiv2_plugin_windows_arm64//file",
41-
"@bazel_tools//src/conditions:windows_x64": "@openapiv2_plugin_windows_x86_64//file",
42-
}),
28+
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-openapiv2",
4329
visibility = ["//visibility:public"],
4430
)

modules/grpc_gateway/MODULE.bazel

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,7 @@ module(
55
)
66

77
bazel_dep(name = "gazelle", version = "0.43.0")
8+
bazel_dep(name = "grpc_ecosystem_grpc_gateway", version = "2.26.3")
89
bazel_dep(name = "rules_go", version = "0.54.0")
910
bazel_dep(name = "rules_proto_grpc", version = "0.0.0.rpg.version.placeholder")
1011
bazel_dep(name = "rules_proto_grpc_go", version = "0.0.0.rpg.version.placeholder")
11-
12-
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
13-
go_deps.from_file(go_mod = "//:go.mod")
14-
use_repo(
15-
go_deps,
16-
"com_github_grpc_ecosystem_grpc_gateway_v2",
17-
"org_golang_google_genproto_googleapis_api",
18-
)
19-
20-
download_plugins = use_extension("//:module_extensions.bzl", "download_plugins")
21-
use_repo(
22-
download_plugins,
23-
"grpc_gateway_plugin_darwin_arm64",
24-
"grpc_gateway_plugin_darwin_x86_64",
25-
"grpc_gateway_plugin_linux_arm64",
26-
"grpc_gateway_plugin_linux_x86_64",
27-
"grpc_gateway_plugin_windows_arm64",
28-
"grpc_gateway_plugin_windows_x86_64",
29-
"openapiv2_plugin_darwin_arm64",
30-
"openapiv2_plugin_darwin_x86_64",
31-
"openapiv2_plugin_linux_arm64",
32-
"openapiv2_plugin_linux_x86_64",
33-
"openapiv2_plugin_windows_arm64",
34-
"openapiv2_plugin_windows_x86_64",
35-
)

modules/grpc_gateway/gateway_grpc_library.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def gateway_grpc_library(name, **kwargs):
3333
)
3434

3535
GATEWAY_DEPS = [
36-
Label("@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library"),
37-
Label("@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library"),
36+
Label("@grpc_ecosystem_grpc_gateway//runtime"),
37+
Label("@grpc_ecosystem_grpc_gateway//utilities"),
3838
# Label("@go_googleapis//google/api:annotations_go_proto"), # https://github.com/bazelbuild/bazel-central-registry/issues/1113
3939
]

modules/grpc_gateway/go.mod

Lines changed: 0 additions & 17 deletions
This file was deleted.

modules/grpc_gateway/go.sum

Lines changed: 0 additions & 36 deletions
This file was deleted.

modules/grpc_gateway/tools.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

tools/rulegen/grpc_gateway.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ def {{ .Rule.Name }}(name, **kwargs):
2929
)
3030
3131
GATEWAY_DEPS = [
32-
Label("@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library"),
33-
Label("@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library"),
34-
# Label("@go_googleapis//google/api:annotations_go_proto"), # https://github.com/bazelbuild/bazel-central-registry/issues/1113
32+
Label("@grpc_ecosystem_grpc_gateway//runtime"),
33+
Label("@grpc_ecosystem_grpc_gateway//utilities"),
3534
]`)
3635

3736
var grpcGatewayCompileExampleTemplate = mustTemplate(`load("@rules_proto_grpc_{{ .Lang.Name }}//:defs.bzl", "{{ .Rule.Name }}")

0 commit comments

Comments
 (0)