-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Presence of binaries or examples causes "dev-dependencies" metadata to be required for cargo package
#7487
Comments
cargo package
cargo package
Sorry, I'm having trouble understanding the use case here. It might be helpful to explain what you're trying to do and what issues/errors you are having. Using |
To clarify, its not using "cargo vendor", all dependencies are forcibly communicated to vendor (as in, linux-vendor) dependencies, and must be installed prior to any steps. Our build chain starts with official copies that are pre-downloaded from crates.io, and unrolls them to a source tree to allow patching (which includes user controlled patching), and in depending on conditions, run tests (its a source-based distribution, and so end users have control to patch things, not all end users run tests, but some elect to do so). Then at some point after patching and (optionally) testing, The desire is that end users who aren't electing to run tests, aren't pulling in dev-dependencies forcibly, (our package manager contols this), and only those who do run tests are forced to satisfy dev-dependencies first. Currently a usable workaround is just Though I'd prefer to leave examples in the crate just in case somebody wants them for something later. |
( NB: We already patch-out target-specific dependencies just to keep the graph small, because target-specific dependencies metadata are still required to satisfy various cargo stages, even if they're not ultimately used. And the absence of the crates.io index/cache is what otherwise causes these crates to be needed just to satisfy metadata ) |
The extra confusion is why it is that examples and seemingly, only examples that makes this happen. It feels like there's some sort of intentional logic behind this, but what that is is beyond me. |
Further probing shows its not just Its really bizzare that you can have dependencies missing, and
And without even changing Cargo.toml, you suddenly get a much more breaky cargo. |
Found another path that trips this behaviour as well, and it helps somewhat diagnose this behaviour:
Possibly for the same underlying rationale. I'm speculating here, but it might be some aspiration about what "cargo run" requires, and/or something about the requirements of |
I get the impression that the code-path that activates this requirement should be gated out by --no-verify or something. Its fine and all to have checks for this sort of thing, just there should also be a way to turn them off. |
cargo package
cargo package
I'm still having a hard time understanding the exact issue here. Is it that you are using source replacement, and don't have the crates.io index? It would help to have an MCVE and the resulting error message. When binaries are in a package, it rebuilds |
That does sound like a good redux of the problem. You can synthetically present the circumstances that trigger it using an intentionally invalid dependency. Invalid dependencies declared in But as soon as you have any kind of binaries, a And its this mandatory step that makes matters annoying. |
Also worth mentioning, that for us at least, |
We ran into this issue over at rusoto/rusoto#1603 — we'd like to add |
Dev-dependencies are only verified if you tell cargo that you can pull them from the registry by including the As I believe this resolves the need in this issue, I'm closing it. If there is a reason for us to reconsider, let us know! |
I've been trying to track down an annoying issue in vendoring, where we're using the crate-dir layout as described here
As part of the build process, we invoke
cargo package
at some point to give us an image that we then roll out to the crate-dir to the vendor layout prefix.An annoying recurring problem is dependencies listed as "dev-dependencies" turn out to be necessary to be pre-provided somewhere( for metadata purposes, due to the absence of the crates.io registry index/cache thing ), and this is leading to fun problems with them becoming cyclical dependencies that thwart the build system.
Testing has shown that the presence of the "examples/" directory with literally any ".rs" file is sufficient for this to happen.
One could possibly argue that examples and tests are similar in both requiring dev-dependencies in some regard, but oddly, only examples are tripping up the "dev-dependencies required" issue.
You can soft-demonstrate this issue in some regards by checking out a copy of a crate (
itertools
is my example), and making sure there is no Cargo.lock file, and running:With the
examples/
directory present, every invocation of that command will trip it up with emitting:At the end of the task.
Removing the examples directory makes this problem go away.
The text was updated successfully, but these errors were encountered: