Open Manishearth opened 3 years ago
Yeah, that's silly. Should be trivial to fix, let me know if you're blocked on it or need it fast and I should be able to fix quick.
Not blocked on it at the moment, I'm writing manual bindings for now.
One challenge here will probably be that when you invoke cargo metadata
, it downloads all dependencies regardless of how they're pulled in. So while we may be able to make cbindgen
not parse dev-dependencies, we may still end up having to fetch them.
One challenge here will probably be that when you invoke
cargo metadata
, it downloads all dependencies regardless of how they're pulled in. So while we may be able to makecbindgen
not parse dev-dependencies, we may still end up having to fetch them.
I just ran into this exact issue. My company builds each package in a network jail & so each package only has access to whatever it explicitly fetches. cbindgen's use of cargo metadata
is effectively converting my dev-dependencies into build dependencies, regardless of whether or not I enable / disable parse_deps.
Looks like the parse_deps option gets passed here from builder::generate()
into Cargo::load()
as use_cargo_lock
which is used here and doesn't control whether or not cargo metadata
is called.
If I get some free time I might poke around and see if it's feasible to skip the cargo metadata
invocation, but for now I'll just copy all my dev-dependencies into build-dependencies.
Looks like the cargo metadata
fork was added on May 24, 2017 in https://github.com/mozilla/cbindgen/commit/d826d98b9e471f92170d2bd7b2771c2caa74f5e1 with the --no-deps
option removed, and then dependency parsing was made optional on Jun 21, 2017 in https://github.com/mozilla/cbindgen/commit/7a60c528f3c1de1b66bf218671f15f34b5bf6dec.
Perhaps we can now back out the fork of cargo metadata
and make the parse_deps
config invoke --no-deps
.
Currently
cbindgen
in parse-deps mode seems to include dev-dependencies and build-dependencies. It would be nice if that could be avoided.(In my case it means that we hit https://github.com/eqrion/cbindgen/issues/665 even though it's only used by criterion)