Can skip dependency checking for non-built dependencies via exclude
in a workspace.
#6042
Labels
A-optional-dependencies
Area: dependencies with optional=true
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
So I was just looking at how Gecko manages to build without all the dependencies being in the tree.
For example, this dependency is Servo-only and thus not in the Gecko tree, yet it builds fine:
https://searchfox.org/mozilla-central/rev/bdc89dfd7869e418d788b28eb60ab8d94e708a15/servo/components/style/Cargo.toml#62
When I tried to do the same on the Servo for a Gecko-only dependency:
servo/servo@d681d58
It failed with:
Which is kind of expected. However I could not understand the difference, and Gecko definitely relies on this. So I chased this down and turns out that gecko
exclude
s theservo
directory, and this causes optional dependencies that not get built to not get into the lockfile at all.For example, that servo patch would also build if I did:
(Note that the
exclude
needs to point at an ancestor of the optional dependency, not to the optional dependency itself).This also causes other optional features that do exist (from crates.io for example) to get dropped from the lockfile.
I'm not completely sure it's intentional, but the side effect of it is really nice. It'd be really nice if it was the default behavior actually, or if at least it was possible without relying on this
exclude
bit. cc #4544.I'm not sure how to proceed from here, we definitely rely on that to avoid having to heavily diverge the lockfiles for the two setups or sync a whole lot more of code.
The text was updated successfully, but these errors were encountered: