Skip to content

Cannot easily use git dependencies that contain Cargo.toml files in subdirectories #6822

Closed
@jdm

Description

@jdm

Problem
Using a git dependency from a repository that contains multiple Cargo.toml files is complicated. If any of these files are invalid (such as files that are used as input for tests), or the result of complicated vendoring situations like Gecko, Cargo tries to make sense of them even if they will not actually contribute anything to the build. Using this same dependency as a path or published package works fine since only the appropriate package's Cargo.toml is read, but the git dependency is recursively walked for all Cargo.toml files that exist.

Steps

  1. Clone https://github.com/jdm/rust-mozjs/tree/smup66-cargo-problem
  2. Run cargo build

Possible Solution(s)
One easy way out - leave the current behaviour as default, but add an extra TOML property for git deps that makes it possible to specify a particular path inside the working tree which should be treated as the package root.

Notes

Output of cargo version:
cargo 1.35.0-nightly (63231f4 2019-03-27)

Without a solution to this problem, anyone using an unusual git dep must end up modifying its contents to remove the TOML files that Cargo can't understand. This is very frustrating, especially when the other dependency modes work just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions