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

chore(bazel): add MODULE.bazel files for bzlmod #144

Merged
merged 1 commit into from
Feb 26, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ on:
permissions:
contents: read

env:
USE_BAZEL_VERSION: 5.0.0

jobs:
test:
runs-on: ubuntu-latest

env:
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
strategy:
matrix:
bazel_version: ["6.0.0", "7.0.0"]
bzlmod: ["--noenable_bzlmod", "--enable_bzlmod"]
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Run bazel build
run: bazelisk build //...
run: bazelisk build ${{ matrix.bzlmod }} //...
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ proto_library(
":rls_config_proto",
"@com_google_googleapis//google/rpc:code_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:wrappers_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:wrappers_proto",
],
)
15 changes: 15 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module(
name = "grpc_proto",
version = "0.0.0",
repo_name = "io_grpc_grpc_proto",
)

bazel_dep(name = "rules_proto", version = "4.0.0")
bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not use 24.4 as used in WORKSPACE today?

Copy link
Contributor Author

@mmorel-35 mmorel-35 Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid, it's not available on BCR yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

23.1 was released May 2023. 23.2 was released the same month. 24.0 was released Aug 2023. And 25.0 was released Nov 2023. Looks like 23.1 was added to BCR at the very, very end of 2023.

Either BCR needs updating or we define the module locally (however that should be done). I can accept the skew, but we need to be able to choose something recent, so having this problem out-of-the-gate makes me think we need to go through that process now so we know how it is done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'v tried importing it but then it requires a lot more bazel_deps which is quite bothering.
I believe BCR needs to be updated but I don't understand why it is not more for such a crucial dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Well, this PR is still a step in the right direction. We can use the older version for now.

# -- bazel_dep definitions -- #

http_archives_extension = use_extension("//bazel:http_archives_extension.bzl", "http_archives_extension")
use_repo(http_archives_extension, "com_google_googleapis")

switched_rules_extension = use_extension("//bazel:switched_rules_extension.bzl", "switched_rules_extension")
use_repo(switched_rules_extension, "com_google_googleapis_imports")