-
Notifications
You must be signed in to change notification settings - Fork 873
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
Migrate to bzlmod #950
Closed
Closed
Migrate to bzlmod #950
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7696754
bzlmod
Sayter99 526e7eb
bzlmod
Sayter99 81505d1
change module name
Sayter99 a41c7b2
workspace stuff
Sayter99 cdd7dbb
nothing in workspace
Sayter99 7ad2c1b
update doc
Sayter99 dabc3f6
fix ci
Sayter99 2bfc76c
include bzlmod changes
Sayter99 dade7e8
wip
Sayter99 8a9a563
review feedback
Sayter99 8f5614c
wip
Sayter99 662da6a
wip
Sayter99 3fccdd2
working
Sayter99 55ef0eb
update docs
Sayter99 1cbe9c5
fix ci
Sayter99 b4f0a6e
respect include path
Sayter99 daa7d14
Merge pull request #1 from Sayter99/workspace-support
Sayter99 5ae4ef0
try set default
Sayter99 76544da
use default implicilty
Sayter99 6c703c1
explicitly set python
Sayter99 2201e44
set default
Sayter99 56b46f7
test
Sayter99 e0f5272
0.31.0
Sayter99 ba3e0ed
0.31.0
Sayter99 e05a694
Attempt to add support for nanopb and users with different python ver…
mark64 27a3086
get rid of warning message
mark64 0236e88
upgrade CI macos version
Sayter99 438ecb6
Merge remote-tracking branch 'bzl/master' into bzlmod-testing
mark64 1bba4e4
remove workspace support
Sayter99 c1f7ac6
Merge pull request #2 from mark64/bzlmod-testing
Sayter99 5593871
improve comment
Sayter99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests/bazel_workspace_support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ jobs: | |
- name: Build | ||
run: | | ||
bazelisk build //... | ||
cd tests/bazel_workspace_support | ||
bazelisk build //... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module(name = "nanopb", version = "0.4.9") | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.5.0") | ||
bazel_dep(name = "rules_cc", version = "0.0.9") | ||
bazel_dep(name = "rules_python", version = "0.24.0") | ||
bazel_dep(name = "rules_proto", version = "5.3.0-21.7") | ||
bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf") | ||
|
||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain( | ||
configure_coverage_tool = True, | ||
python_version = "3.10", | ||
ignore_root_user_error = True, | ||
) | ||
|
||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
use_repo(pip, "nanopb_pypi") | ||
pip.parse( | ||
hub_name = "nanopb_pypi", | ||
requirements_lock = "@nanopb//:extra/requirements_lock.txt", | ||
python_version = "3.10", | ||
) | ||
|
||
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
http_archive( | ||
name = "rules_proto_grpc", | ||
sha256 = "c0d718f4d892c524025504e67a5bfe83360b3a982e654bc71fed7514eb8ac8ad", | ||
strip_prefix = "rules_proto_grpc-4.6.0", | ||
urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.6.0.tar.gz"], | ||
) | ||
|
||
register_toolchains("@rules_proto_grpc//protobuf:protoc_toolchain") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brief warning: I don't think Bazel will treat
http_archive
repositories as bzlmod deps. I suspect in this case it's okay because rules_proto_grpc has a working WORKSPACE file, but I can't remember off the top of my head. Just something to keep an eye out for.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, it is not considered a bazel_dep. I found one release from bcr, switched to use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is still an http archive, did you intend to replace this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If rules_proto_grpc isn't working out-of-the-box with bzlmod, I think the only path to get things working is to manually enumerate the dependencies of rules_proto_grpc, pull it in as a http archive, and hope for the best. The one major drawback is that this instance of rules_proto_grpc becomes unique to nanopb, and any other references to
rules_proto_grpc
from other dependencies will produce a second source of truth.I'm not sure if there's a way around this outside of requiring every project that uses nanopb to be hybrid WORKSPACE/blzmod, which isn't a satisfying result. I think you've done the best you can here.