Skip to content

Presence of binaries or examples causes "dev-dependencies" metadata to be required for cargo package #7487

@kentfredric

Description

@kentfredric

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:

   cargo package --no-verify --no-metadata

With the examples/ directory present, every invocation of that command will trip it up with emitting:

    Updating crates.io index

At the end of the task.

Removing the examples directory makes this problem go away.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions