Skip to content

Commit

Permalink
Add additional bzlmod requirements to allow grpc protobufs to work (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c authored Oct 14, 2022
1 parent fe1935f commit 4603d6c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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 @@ -20,6 +21,7 @@ use_repo(
"bazel_gazelle_go_repository_cache",
"bazel_gazelle_go_repository_config",
"bazel_gazelle_go_repository_tools",
"go_googleapis",
)

go_deps = use_extension("//:extensions.bzl", "go_deps")
Expand Down
23 changes: 23 additions & 0 deletions internal/bzlmod/non_module_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"//internal:go_repository_cache.bzl",
"go_repository_cache",
Expand Down Expand Up @@ -28,6 +29,28 @@ 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 4603d6c

Please sign in to comment.