Skip to content

Add --no-dev-dependencies to generate-lockfile #8514

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

Closed
jyn514 opened this issue Jul 19, 2020 · 2 comments
Closed

Add --no-dev-dependencies to generate-lockfile #8514

jyn514 opened this issue Jul 19, 2020 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@jyn514
Copy link
Member

jyn514 commented Jul 19, 2020

Describe the problem you are trying to solve

In some cases, crates may have cyclic dependencies if you count dev-dependencies, but work fine without. For example, the proc-macro https://crates.io/crates/zbus_macros 1.0.0 has a dev-dependency on https://crates.io/crates/zbus 1.0.0, which in turn has a normal dependency on zbus_macros. When docs.rs tried to generate the lockfile for zbus_macros, it got an error because zbus had not yet been published:

Command { std: "/home/cratesfyi/workspace/cargo-home/bin/cargo" "+nightly" "generate-lockfile" "--manifest-path" "Cargo.toml", kill_on_drop: false }`
    Updating crates.io index
error: failed to select a version for the requirement `zbus = "^1"`
candidate versions found which didn't match: 0.1.2
location searched: crates.io index

Describe the solution you'd like

docs.rs doesn't actually need the dev-dependencies to run cargo doc. If we could use generate-lockfile --no-dev-dependencies that should fix the issues here. I have no idea how hard that would be for cargo though.

Notes

@jyn514 jyn514 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jul 19, 2020
@ehuss
Copy link
Contributor

ehuss commented Jul 29, 2020

Hm, I'm a bit surprised that crates.io allows publishing with a version that does not exist. In a way, this isn't specific to dev-dependencies, as you could have any normal dependency pointing to a version that has not yet been published. Though I guess it is more likely to hit dev-dependencies because otherwise you need to publish with --no-verify.

Anyways, this already exists as -Zavoid-dev-deps (#5133).

@ehuss
Copy link
Contributor

ehuss commented Aug 19, 2020

Closing as the avoid-dev-deps is already implemented. However, for the root issue where docs.rs has issues with yet-to-be-published dependencies, that seems to be a broader problem with atomically publishing multiple crates at once (tracked in #1169 and rust-lang/crates-io-cargo-teams#82).

@ehuss ehuss closed this as completed Aug 19, 2020
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

2 participants