Support splicing manifests from multiple Cargo workspaces#3934
Open
malt3 wants to merge 3 commits intobazelbuild:mainfrom
Open
Support splicing manifests from multiple Cargo workspaces#3934malt3 wants to merge 3 commits intobazelbuild:mainfrom
malt3 wants to merge 3 commits intobazelbuild:mainfrom
Conversation
…d#3089) This test reproduces the bug where crate_universe fails when a Cargo workspace member has a path dependency pointing outside the Cargo workspace root (but still inside the Bazel workspace). The test is expected to fail until the bug is fixed.
bc7ba6d to
356dd1e
Compare
When manifests come from different Cargo workspaces (e.g. a primary workspace depending on crates in a separate external workspace), splicing previously failed with "manifests are not allowed to come from different workspaces". This change: - Adds `main_manifest` to SplicingManifest so the splicer can disambiguate which workspace root is primary when multiple are found. - Nests the spliced workspace at its repo-relative depth inside the temp dir so that `../` path deps resolve within the temp dir instead of escaping into unwritable system directories. - Collects path deps from `[workspace.dependencies]` in addition to per-package deps. - Symlinks entire foreign workspace root directories (not just crate dirs) so Cargo can walk up and resolve `dep.workspace = true` inherited dependencies. - Wires `main_manifest` through extensions.bzl and crates_vendor.bzl. - Calls symlink_external_path_deps from the cargo_tree_resolver so `cargo tree` also sees external path deps. This fixes bazelbuild#3089, along with adding support for multiple workspaces in the splicer. Co-Authored-By: Steve Barrau <98589981+stevebarrau@users.noreply.github.com>
356dd1e to
275962d
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When manifests come from different Cargo workspaces (e.g. a primary
workspace depending on crates in a separate external workspace),
splicing previously failed with "manifests are not allowed to come from
different workspaces". Additionally, external relative paths aren't resolved.
This change:
main_manifestto SplicingManifest so the splicer candisambiguate which workspace root is primary when multiple are found.
dir so that
../path deps resolve within the temp dir instead ofescaping into unwritable system directories.
[workspace.dependencies]in addition toper-package deps.
dirs) so Cargo can walk up and resolve
dep.workspace = trueinherited dependencies.
main_manifestthrough extensions.bzl and crates_vendor.bzl.cargo treealso sees external path deps.This fixes #3089,
along with adding support for multiple workspaces in the splicer.
Co-Authored-By: Steve Barrau 98589981+stevebarrau@users.noreply.github.com