Skip to content

Commit

Permalink
bzlmod: Simplify go_grpc_library support
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Oct 14, 2022
1 parent 4603d6c commit 7bec986
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
6 changes: 5 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module(
print("WARNING: The bazel_gazelle Bazel module is still highly experimental and subject to change at any time. Only use it to try out bzlmod for now.")

bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(name = "protobuf", version = "3.19.6", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_go", version = "0.33.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_proto", version = "4.0.0")

Expand All @@ -21,6 +20,11 @@ use_repo(
"bazel_gazelle_go_repository_cache",
"bazel_gazelle_go_repository_config",
"bazel_gazelle_go_repository_tools",
)

rules_go_non_module_deps = use_extension("@io_bazel_rules_go//go/private:extensions.bzl", "non_module_dependencies")
use_repo(
rules_go_non_module_deps,
"go_googleapis",
)

Expand Down
23 changes: 0 additions & 23 deletions internal/bzlmod/non_module_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"//internal:go_repository_cache.bzl",
"go_repository_cache",
Expand Down Expand Up @@ -29,28 +28,6 @@ def _non_module_deps_impl(module_ctx):
config = Label("@bazel_gazelle_go_repository_directives//:WORKSPACE"),
)

# Required when depending on org_golang_google_grpc. The patches are
# pulled from @rules_go
http_archive(
name = "go_googleapis",
# master, as of 2022-09-10
urls = [
"https://mirror.bazel.build/github.com/googleapis/googleapis/archive/8167badf3ce86086c69db2942a8995bb2de56c51.zip",
"https://github.com/googleapis/googleapis/archive/8167badf3ce86086c69db2942a8995bb2de56c51.zip",
],
sha256 = "b97d75f1c937ed2235c501fafc475f51a3280d26f9410831686fdfd1b4f612f9",
strip_prefix = "googleapis-8167badf3ce86086c69db2942a8995bb2de56c51",
patches = [
# releaser:patch-cmd find . -name BUILD.bazel -delete
Label("@io_bazel_rules_go//third_party:go_googleapis-deletebuild.patch"),
# set gazelle directives; change workspace name
Label("@io_bazel_rules_go//third_party:go_googleapis-directives.patch"),
# releaser:patch-cmd gazelle -repo_root .
Label("@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch"),
],
patch_args = ["-E", "-p1"],
)

non_module_deps = module_extension(
_non_module_deps_impl,
)

0 comments on commit 7bec986

Please sign in to comment.