-
Notifications
You must be signed in to change notification settings - Fork 118
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
bazel: Migrate to bazel 7; use bzlmod for dependencies #284
Open
minor-fixes
wants to merge
17
commits into
bazelbuild:main
Choose a base branch
from
minor-fixes:bzlmod
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ed3e356
semver proto builds in example project
minor-fixes 9c96115
remote_execution proto builds in C++ in example project
minor-fixes d9dbe8b
All REAPI protos build in C++ example project
minor-fixes ea4cefd
Moved C++ protos to separate dir
minor-fixes 00ccfb5
REAPI protos are generated for Go in example project
minor-fixes 1e4f490
Generate rules in accordance with rules_go best practice
minor-fixes 55ff12e
Java appears to build
minor-fixes 2b6d25b
Add building C++ example
minor-fixes 136049c
Examples for Go and Java added
minor-fixes 3dda8cf
Clean up old rules, files
minor-fixes 759f9f6
Go rules moved back into main repo
minor-fixes 145bed9
Move C++ rules back to main repo
minor-fixes 7cc3801
Move Java rules back to main repo
minor-fixes 1919452
Rename module; remove unused workspace rules
minor-fixes 4264d81
Fix gazelle in example project
minor-fixes 4c99dfd
Rev bazel version to latest; dedupe patches
minor-fixes a3fdad4
Address review feedback (java target naming, gitignore)
minor-fixes 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,3 @@ | ||
# The examples/ dir has example bazel workspaces that show how to import | ||
# remote-apis, and should not be treated as part of this workspace. | ||
examples |
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 @@ | ||
7.0.1 |
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
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,10 @@ | ||
load("@gazelle//:def.bzl", "gazelle") | ||
|
||
# gazelle:prefix github.com/bazelbuild/remote-apis | ||
|
||
# gazelle:resolve proto google/api/annotations.proto @googleapis//google/api:annotations_proto | ||
# gazelle:resolve proto go google/api/annotations.proto @org_golang_google_genproto//googleapis/api/annotations | ||
|
||
gazelle( | ||
name = "gazelle", | ||
) |
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,64 @@ | ||||||
"""remote-apis dependencies""" | ||||||
|
||||||
module( | ||||||
name = "bazel_remote_apis", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
bazel itself uses this name, not sure which should be preferred |
||||||
repo_name = "com_github_bazelbuild_remote_apis", | ||||||
) | ||||||
|
||||||
# deps | ||||||
bazel_dep(name = "gazelle", version = "0.35.0") | ||||||
bazel_dep(name = "rules_cc", version = "0.0.9") | ||||||
bazel_dep(name = "rules_go", version = "0.44.2") | ||||||
bazel_dep(name = "rules_java", version = "7.3.2") | ||||||
bazel_dep(name = "rules_proto", version = "6.0.0-rc1") | ||||||
bazel_dep(name = "rules_proto_grpc_cpp", version = "5.0.0-alpha2") | ||||||
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") | ||||||
|
||||||
# dev deps | ||||||
bazel_dep(name = "toolchains_llvm", version = "0.10.3", dev_dependency = True) | ||||||
|
||||||
# Top-level projects will need a C++ toolchain to build protoc, grpc, etc., but | ||||||
# we shouldn't dictate their toolchain, so the toolchain is marked as a dev | ||||||
# dependency. | ||||||
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True) | ||||||
llvm.toolchain( | ||||||
# This is a version of LLVM that builds absl and upb successfully with their | ||||||
# default compile options. | ||||||
# | ||||||
# TODO: Update this to the latest version of LLVM possible | ||||||
llvm_version = "13.0.0", | ||||||
) | ||||||
use_repo(llvm, "llvm_toolchain") | ||||||
register_toolchains("@llvm_toolchain//:all", dev_dependency = True) | ||||||
|
||||||
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") | ||||||
go_deps.from_file(go_mod = "//:go.mod") | ||||||
use_repo( | ||||||
go_deps, | ||||||
"org_golang_google_genproto", | ||||||
"org_golang_google_genproto_googleapis_api", | ||||||
"org_golang_google_genproto_googleapis_rpc", | ||||||
"org_golang_google_grpc", | ||||||
"org_golang_google_protobuf", | ||||||
) | ||||||
|
||||||
# googleapis workaround for lack of bzlmod support | ||||||
# From: https://github.com/bazelbuild/rules_go/issues/3685#issuecomment-1711854475 | ||||||
# | ||||||
# TODO: Drop this once googleapis has official bzlmod support | ||||||
bazel_dep(name = "com_google_googleapis", version = "64926d52febbf298cb82a8f472ade4a3969ba922") | ||||||
archive_override( | ||||||
module_name = "com_google_googleapis", | ||||||
integrity = "sha256-nRqTDnZ8k8glOYuPhpLso/41O5qq3t+88fyiKCyF34g=", | ||||||
patch_strip = 1, | ||||||
patches = [ | ||||||
"patches/googleapis_add_bzlmod_support.patch", | ||||||
], | ||||||
strip_prefix = "googleapis-64926d52febbf298cb82a8f472ade4a3969ba922", | ||||||
urls = [ | ||||||
"https://github.com/googleapis/googleapis/archive/64926d52febbf298cb82a8f472ade4a3969ba922.zip", | ||||||
], | ||||||
) | ||||||
switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules") | ||||||
switched_rules.use_languages() | ||||||
use_repo(switched_rules, "com_google_googleapis_imports") |
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.
Can we assume a sufficiently up-to-date git client version?
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.
I think that's a reasonable assumption. If we find that this breaks someone, it's easy to revert back to the explicit list of directories.
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.
Out of curiosity, how's this different from just "bazel-*"?
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.
(just double-checked to confirm) This ignores bazel-generated symlinks in repo subdirs, not just the toplevel, which is significant because there now exist example workspaces where one can
cd
to and run builds.Clarified the comment above.
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.
I get that
**/bazel-*
would indeed ignore that. But why can't we just usebazel-*
? So without a leading slash, without a leading anything.