dev-dependencies are built even when unused #5385
Labels
A-features
Area: features — conditional compilation
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
I ran into a weird combination of problems:
cargo build --example foo --release --target x86_64-unknown-linux-musl
(without workarounds)Since
foo
has no direct or indirect dependency to openssl-sys,cargo build --example foo --release --target x86_64-unknown-linux-musl
should work just fine. This is currently not the case since cargo builds all dev-dependencies as well when doing a build, even if those are unused.I currently have a weird workaround in place where I moved the openssl related dev-dependency to the normal dependencies so I can control it with feature flags. This means I have to start
bar
with that feature flag. This makes CI more complicated. Also, since the crate is a library, moving a dev dependency to the normal dependencies is problematic.I think cargo could determine that openssl-sys is not needed for the build I've started and therefore skip it. What do you think?
The text was updated successfully, but these errors were encountered: