-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build] Use MODULE.bazel for all dependencies
The WORKSPACE.bzlmod is no longer load-bearing, so as of this commit it should be possible to consume Drake as module external of other downstream projects (instead of as a repository external). Notable changes: Adjust the pkg_config and java repository rules to handle the new distinction between canonical vs apparent repository names. Adjust some of our hard-coded runfiles paths (header_lint test, wheel build snopt, drake_models parse_test) to align with the new canonical repository names. Adjust our lcm native code loader to accommodate the new runfiles layout. Add test coverage for EventLog (which uses a distinctive spelling of its import paths in upstream code). Adjust labels used by our (non-symbolic) macros to only ever refer to drake labels, not external labels. Textual macros resolve labels in the workspace context of the code calling them, not Drake. Therefore they must only ever refer to Drake, since Drake's externals are now invisible (by default) with bzlmod. We introduce Drake aliases for the externals so that we can use a safe labels in our macros. (This fix is only necessary for macros which we expect downstream code to call, i.e., macros without a "drake_..." prefix in their name. We still have plenty of other drake-specific macros that refer to non-drake labels, but that's not a problem.) The longer term fix for this will probably be switching from textual macros to symbolic macros, but we don't attempt that here. Adjust CMake logic to edit MODULE.bazel to opt-out of any overridden externals, so that the WORKSPACE.bzlmod replacements take effect. Document our stability promises for our module extension.
- Loading branch information
1 parent
9be1979
commit 81104a5
Showing
19 changed files
with
489 additions
and
162 deletions.
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
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 |
---|---|---|
@@ -1,22 +1,12 @@ | ||
# -*- bazel -*- | ||
# | ||
# This file lists Drake's workspace-style external dependencies. It is used in | ||
# concert with MODULE.bazel (which has the module-style externals). | ||
# This file lists Drake's workspace-style external dependencies that are only | ||
# needed by Drake Developers instead of downstream projects. Most dependencies | ||
# are listed in MODULE.bazel, instead. | ||
|
||
workspace(name = "drake") | ||
|
||
load("//tools/workspace:default.bzl", "add_default_workspace") | ||
|
||
add_default_workspace(bzlmod = True) | ||
|
||
# Add some special heuristic logic for using CLion with Drake. | ||
load("//tools/clion:repository.bzl", "drake_clion_environment") | ||
|
||
drake_clion_environment() | ||
|
||
load("@bazel_skylib//lib:versions.bzl", "versions") | ||
|
||
# This needs to be in WORKSPACE or a repository rule for native.bazel_version | ||
# to actually be defined. The minimum_bazel_version value should match the | ||
# version passed to the find_package(Bazel) call in the root CMakeLists.txt. | ||
versions.check(minimum_bazel_version = "7.4") |
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
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
Oops, something went wrong.