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

[build] Use MODULE.bazel for all dependencies #22338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Dec 20, 2024

Towards #20731.

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).

See RobotLocomotion/drake-external-examples#348 for how to use this downstream.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added the release notes: feature This pull request contains a new feature label Dec 20, 2024
jwnimmer-tri

This comment was marked as resolved.

jwnimmer-tri

This comment was marked as resolved.

@jwnimmer-tri jwnimmer-tri marked this pull request as ready for review December 21, 2024 21:10
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: feature This pull request contains a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant