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

multi-package dependency management #7805

Closed
silence-code opened this issue Jan 16, 2020 · 6 comments
Closed

multi-package dependency management #7805

silence-code opened this issue Jan 16, 2020 · 6 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@silence-code
Copy link

cargo should support multi-package dependency management, just like the tag provided by maven

@silence-code silence-code added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 16, 2020
@silence-code
Copy link
Author

cargo should support multi-package dependency management, just like the 'dependencyManagement' tag provided by maven

@ehuss
Copy link
Contributor

ehuss commented Jan 18, 2020

Unfortunately I'm not too familiar with Maven. From what I understand, dependencyManagement provides a way to force a version when a transitive dependency does not specify a version, is that correct? Can you include more information about your use case, and what it would do?

Generally using * versions in Cargo is to be avoided (crates.io doesn't allow publishing with it). Also, there are mechanisms like [patch] to change the versions selected. There's also #5471 which would provide a way to set some default dependencies in a workspace, which is kinda similar.

@ehuss
Copy link
Contributor

ehuss commented Feb 25, 2020

Without more information, I'm going to close this. If you have a more detailed proposal, feel free to leave a comment.

@ehuss ehuss closed this as completed Feb 25, 2020
@mknet
Copy link

mknet commented May 3, 2021

The idea of the dependencyManagement in Maven is do define a specific version of a dependency at a central place of a multi package/module project. An idea could be to provide the versions of the dependency in the Cargo.toml / Virtual Manifest and just add the name of the crate to the sub Cargo.toml.

For instance:

Cargo.toml

[workspace]

members = [
    "a",
    "b"
]

[dependencies.diesel]
version = "1.4.4"

a/Cargo.toml

[package]
name = "a"

[dependencies]
diesel = "something to mark that we want to use the version defined in the super Cargo.toml"

@ehuss
Copy link
Contributor

ehuss commented May 3, 2021

@mknet You may be interested in RFC 2906 which provides workspace dependencies.

@mknet
Copy link

mknet commented May 3, 2021

@ehuss You are absolutely right! I am interested. :) Thanks for sharing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants