-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
support for [patch] override from .cargo/config #7199
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR and sorry for the delay in getting to this! This has been a feature we've been hesitant to add in the past because There is however a feature where you can replace with |
@alexcrichton That actually works exactly as we need, however it prints out this nerve wrecking long warning, as described in #5539 (comment). |
The |
Hmm, that same dependency requirement, which I was unaware of, makes |
@alexcrichton Can the issue with So, for local testing with all the patched crates we would be using something like Then, if everything is ok we would push/publish dependencies in correct order using regular This would solve adding/removing |
Ah ok, thanks for checking @jchlapinski! @kuviman that's a possibility yeah! I mostly mean to point out that the sort of silent usage of |
In order for However, @alexcrichton does not like the idea that basically in case Perhaps the solution would be one of the following:
[[package]]
name = "local-lib"
source = "../local-lib" # currently for local crates this field is not defined at all
version = "0.2.4"
dependencies = []
I am happy to put this feature into code, after it is established how should it work. |
@jchlapinski hm I wonder if you can clarify your problem statement a bit? You say:
FWIW a For your possible solutions, those are plausible at least I think! I haven't given this a huge amount of thought as to what a solution would look like, I think I still need to do work to understand the use case motivating this. |
Hm, actually, virtual
Anyway, works for me, thanks for the tip! |
@jchlapinski would the virtual manifest idea work for you as well? If so maybe we could close this in favor of the nested workspaces issue? |
@alexcrichton unfortunately no, we are already using virtual manifests and workspaces, but that does not solve our issues completely. Please allow me a day or two, I will write up a working example of what we are trying to achieve and what is not fully working right now for us, so that we will avoid confusion. Nested workspaces are also something that we would love to see supported, BTW. |
☔ The latest upstream changes (presumably #7444) made this pull request unmergeable. Please resolve the merge conflicts. |
Ok I'm gonna go ahead and close this since this has gone quiet for quite some time. I think it'd be great to continue the discussion on nested workspaces to figure out a design and/or manpower to implement, and if there are other targeted issues here to take care of it'd be much appreciated to have a follow-up issue to discuss! |
We have exactly the same scenario as described in #5539. We would like to be able to override
[patch]
for some crates WITHOUT the need to modify their individualCargo.toml
manifests.This PR is a draft implementation of this use case, where all entries from
[patch]
section defined in.cargo/config
are picked up for every manifest.Please comment if such a change is viable for cargo. Some potential problems/design decisions that should be solved:
[patch]
entries be merged from both.cargo/config
andCargo.toml
, or simply overridden entirely from.cargo/config
if present.[replace]
section? I have seen a few open issues with discussion whether this section should be deprecated/removed?[patch]
is overridden for several nested crates, from.cargo/config
, probably warnings about unused patch dependency for each crate should then be silenced?As a more detailed explanation why we want this feature - we develop a large project consisting of a few crates that are regular
[workspace]
members, as well as a few crates that are self-contained libraries, published independently on crates.io (however some depend on others).In order to be able to work on a project as a whole, we nested those self-contained libraries in main repository as git submodules, and patched workspace members to use local versions of those libraries, instead of downloading them from crates.io. This makes developement much easier, since simultaneous changes in dependent libraries can be tested, before releasing them on crates.io.
However since, those libraries are independent from the main project, they had to be excluded from the workspace, and as such, their dependencies are not patched. This creates a problem, since when testing, each library is build using all of its dependencies from crates.io (skipping locally made changes in other libs).