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

Add additional bzlmod requirements to allow grpc protobufs to work #1345

Merged
merged 1 commit into from
Oct 14, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
fmeum marked this conversation as resolved.
Show resolved Hide resolved
# 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,
)