cargo shouldn't check for dev-dependencies when running cargo build
or cargo install
· Issue #4988 · rust-lang/cargo (original) (raw)
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:
$ basename $PWD
aho-corasick
$ git describe
0.6.4
$ ls -1 ../registry/
libc-0.2.36/
memchr-2.0.1/
$ # ^^^ this is all the dependencies, but none of the dev-dependencies like csv
$ cat config
[source.crates-io]
replace-with = "dh-cargo-registry"
[source.dh-cargo-registry]
directory = "./registry"
$ CARGO_HOME=$PWD cargo build
warning: path `$PWD/src/main.rs` was erroneously implicitly accepted for binary `aho-corasick-dot`,
please set bin.path in Cargo.toml
error: no matching package named `csv` found (required by `aho-corasick`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: = 0.15.0
exit code 101
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
or install
.