Skip to content
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

Fallback to building dependencies from crates.io when the path is not valid #8747

Closed
pedrocr opened this issue Oct 1, 2020 · 1 comment
Closed
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@pedrocr
Copy link

pedrocr commented Oct 1, 2020

Describe the problem you are trying to solve

When developing interconnected crates it's common to put them all in a single git repository and then use both path and version in Cargo.toml so that both running the local code and publishing to crates.io with version dependencies works well.

A similar setup is when you want to have each crate in its own git repository instead. The same setup works but requires the user to always have the local crates in the paths or else an error for missing Cargo.toml will be generated for any dependency that has both version and path.

Describe the solution you'd like

It would be good to just fallback to building the version from crates.io when the path doesn't exist or doesn't have a Cargo.toml inside it. That way someone that clones just the single repository will be able to do local changes, commits and PRs and only need to clone other crates if they want to do coordinated changes between crates.

@pedrocr pedrocr added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Oct 1, 2020
pedrocr added a commit to pedrocr/cargo that referenced this issue Oct 2, 2020
If a given path is not a valid dependency, just ignore it. This allows
falling back to git or the repository automatically while retaining the
ability to have the code locally if you need to develop a dependency in
tandem with the crate code.

Fixes rust-lang#8747
@pedrocr
Copy link
Author

pedrocr commented Oct 5, 2020

For an example of this at work see the following crates:

https://github.com/pedrocr/chimper
https://github.com/pedrocr/imagepipe
https://github.com/pedrocr/multicache
https://github.com/pedrocr/rawloader

If you compile chimper straight from crates.io it will resolve all the dependencies and work fine, because all the crates specify both path and a version dependency. If however you clone the chimper repository locally you will now need to clone also the other three repositories or the build will fail. If all you wanted to change was something local to chimper it's inconvenient to have to clone all the other repositories just to have the dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant