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

Document how to use a git repository's sub-crate #1466

Closed
toolness opened this issue Mar 29, 2015 · 4 comments
Closed

Document how to use a git repository's sub-crate #1466

toolness opened this issue Mar 29, 2015 · 4 comments
Labels
A-documenting-cargo-itself Area: Cargo's documentation

Comments

@toolness
Copy link

In the Path Dependencies section of the documentation, it states:

And that's it! The next cargo build will automatically build hello_utils and all of its own dependencies, and others can also start using the crate as well.

However, as far as I can tell, I do not understand how one would use this hello_utils sub-crate via git. The guide contains documentation on how to use a crate via git in the Adding Dependencies section of the documentation, but there doesn't seem to be any information on how to use a sub-crate from an entirely different project--only a "top-level" crate.

For instance, if I submitted a PR to the hypothetical hello_world's hello_utils sub-crate and wanted to use it immediately in my own project, how would I do that?

Perhaps this is obvious but after searching online and trying a number of things on my own, I can't seem to find a solution for this.

@alexcrichton alexcrichton added the A-documenting-cargo-itself Area: Cargo's documentation label Mar 29, 2015
@huonw
Copy link
Member

huonw commented Jul 9, 2015

Cargo searches a repo for crates, it doesn't just look for a Cargo.toml at the top level, so say

[dependencies.hello_utils]
git = "https://github.com/huonw/hello_world"

would work if I had a hello_world repo with a crate called hello_utils somewhere in it.

@sbeckeriv
Copy link
Contributor

I think this has been covered and can be closed.

@alexcrichton
Copy link
Member

Indeed!

@dvdplm
Copy link

dvdplm commented Dec 1, 2017

it doesn't just look for a Cargo.toml at the top level

This tripped me up and would be super helpful to see in the docs. This works (but was surprising):

[dependencies]
rocket = { git = "https://github.com/SergioBenitez/Rocket/" }
rocket_codegen = { git = "https://github.com/SergioBenitez/Rocket/" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation
Projects
None yet
Development

No branches or pull requests

5 participants