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

[Request] Support shared dependency declaration in virtual manifests #5471

Closed
phrohdoh opened this issue May 3, 2018 · 3 comments
Closed
Labels
A-crate-dependencies Area: [dependencies] of any kind A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@phrohdoh
Copy link

phrohdoh commented May 3, 2018

Given a virtual manifest like so:

[workspace]
members = [
    "a",
    "b",
    "c",
    "d",
]

It would be useful to declare dependencies that are shared between members in a central place (such as this manifest):

[dependencies]
serde = "1.0.45"
serde_json = "1.0.17"
serde_derive = "1.0.45"

When building if we are looking for crate serde in, for example, package a but a/Cargo.toml @ dependencies does not list serde we would look in the virtual manifest that includes a as a member (if there is one).


This will no doubt complicate dependency resolution somewhat but I do not know to what extent so if it is too crazy please feel free to close this ticket.


The idea for this is that, at least in my experience, workspace members have certain shared deps that you want to stay in sync and this makes that easier to express.

@alexcrichton alexcrichton added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label May 3, 2018
@hbobenicio
Copy link

hbobenicio commented Aug 27, 2019

I also think that this feature would be really nice to have in Cargo.

More motivation

Imagine if your workspace have... lets say... 20 projects inside it. All of them with the same core 10 dependencies. What if you want to ensure all of your workspace projects use the same version? What if you want to upgrade the version of one of them, include another one or remove some of them?

Some key things to have in mind about it

  • What if you want a specific project to override one of that version? (is it possible? would it potentially break code or cause misterious incompatibilities if linked with other binaries?)
  • What if you want a specific project to exclude some dependencies declared at workspace?
  • What if you want to share other things that are not dependencies (like just properties or other metadata)?

@ehuss ehuss added A-workspaces Area: workspaces A-crate-dependencies Area: [dependencies] of any kind labels Mar 5, 2020
@alexcrichton
Copy link
Member

For anyone interested in this issue I've posted an RFC which I think will help resolve this. Feedback on the RFC would be most welcome!

@epage
Copy link
Contributor

epage commented May 24, 2023

#8415 has been stabilized with support for sharing of dependencies in a workspace

@epage epage closed this as completed May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crate-dependencies Area: [dependencies] of any kind A-workspaces Area: workspaces C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

5 participants