-
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
cargo shouldn't check for dev-dependencies when running cargo build
or cargo install
#4988
Comments
Looks like the behaviour here was last changed in 9e77919, any thoughts @alexcrichton ? |
Currently |
Here's a commit that fixes the issue for me: master...infinity0:master However I'm not sure if you even want the functionality, and it opens up a can of worms:
|
IIRC, @alexcrichton said that it needs all dependencies because it needs to prepare full Cargo.lock. |
@infinity0 see #3732 |
I see, my commit does indeed omit dev-dependencies from Cargo.lock and |
FTR @ignatenkobrain is having to patch out the dev-dependencies in all Fedora rust crates' Cargo.toml files but I think it would be cleaner if cargo could do this itself. If the cargo team agrees I'd be happy to get the patch mentioned above into working shape. |
I pushed a fix for |
This seems closely related to #3369 , which made |
It makes sense to me as well that |
I think it would be good to do both for What I'm doing here is getting debcargo ready for official Debian use, and I see that @joshtriplett (who originally wrote it) is calling |
@infinity0 We can't call However, one thought occurs to me for how to address that. If you want to test-build a library crate, you can generate a dummy crate that lists the library crate as a dependency in (That doesn't address running the testsuite of the library crate, which I'd love to do but which doesn't work from .crate files either. But build-testing seems like an improvement.) So, my proposal would be to fix |
@joshtriplett When can you |
@sfackler Crates that are part of workspaces with the rest of the workspace missing. @alexcrichton can go into further detail; he was the one who originally explained in very thorough and patient detail why running any cargo command directly in the unpacked .crate would not always work, and that only putting that source in a local registry and then running |
That may have been before #4030? Cargo now rewrites the manifest of published crates to remove path dependencies. |
I am a bit confused by this statement, could you clarify? I thought it would be necessary to have If possible - as @sfackler seems to be maybe suggesting - IMO it would be preferable to do a test |
@infinity0 I meant "which you wouldn't normally need to build the library .deb". I don't think it makes sense to add all the dependencies of the package to its Build-Depends just so that we can do a dummy |
Don't require dev-dependencies when not needed in certain cases Specifically, when running `cargo install` and add a flag for this behaviour in `cargo build`. This closes #4988.
In the docs, dev-dependencies are advertised as "not used when compiling a package for building, but are used for compiling tests, examples, and benchmarks."
However, cargo fails if dev-dependencies are not available in a local registry. For example:
This makes it awkward to package crates for distros, since we need to set up a local registry - we would have to add dev-dependencies in here as well, even though they're not actually used by
build
orinstall
.The text was updated successfully, but these errors were encountered: