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

feat: crates_universe Intra workspace Dependency Resolution #3308

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

abezukor
Copy link
Contributor

@abezukor abezukor commented Mar 1, 2025

Currently rules_rust requires that intra-workspace dependencies are manually specified in the deps sections of rust_library and rust_binary targets. Third party dependencies can be automatically detected using crates_universe.
I have a large cargo workspace with (~4500) intra-workspace dependencies that I plan to continue supporting compiling with cargo. Therefore I don't want to have to keep all of the intra-workspace dependencies up to date in both the Cargo.toml and bazel BUILD files.
This PR adds a disabled by default option to allow all_crate_deps to also include intra-workspace dependencies in the rendering config. Once enabled you can use all_crate_deps in your build files to add both third-party and first party dependencies.

Known Limitations

  • If you have first and third-party crates with the same name and version, your workspace will fail to render.

Notes

  • I originally attempted to do this by making it an option in all_crate_deps, but that relies on the aliases having been generated during the rendering, and therefore prevents the feature from being entirely disabled. One of my goals was that the feature can be fully disabled, such that the checksums do not change.

@abezukor abezukor force-pushed the intra_workspace_dependency_resolution branch 5 times, most recently from 499852d to b6d557a Compare March 1, 2025 22:59
@abezukor abezukor force-pushed the intra_workspace_dependency_resolution branch from b6d557a to c9f57dd Compare March 1, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant