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

Add option to download the crate source without building it #11563

Closed
xFrednet opened this issue Jan 11, 2023 · 2 comments
Closed

Add option to download the crate source without building it #11563

xFrednet opened this issue Jan 11, 2023 · 2 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@xFrednet
Copy link
Member

Problem

  1. A project I'm currently working on requires compiling library crates. This is not possible with cargo install. Therefore, the source code first needs to be downloaded and then compiled locally. Cargo currently doesn't provide an interface to do this, which means that the git and registry fetching has to be implemented manually.
  2. Clippy has a tool called lintcheck which fetches defined crates and checks with the current Clippy build. Lintcheck also had to manually implement fetching crates
  3. A user might want to verify the source code of a crate, before including it as a dependency which will run the build script as part of the compilation/check comment.

Manual implementations will probably not be as robust as cargo interface and might introduce security vulnerabilities.

Proposed Solution

Cargo already as infrastructure to fetch from git and from registries like creates.io. I propose to add a new comment, like cargo download that exposes the option to fetch the source into a directory, without anything more.

The command should support arguments to specify dependencies, so:

  • Git: repository and optionally: branch, revision or tag
  • Registry: version and optionally: registry

Notes

There is a crate called cargo-download that implemented this as a sub comment. It still gets around ~5 downloads per day. Sadly, it doesn't seam to be maintained anymore.


I believe this is a relatively small feature, that's why I'm only creating an issue. Please let me know if this requires an RFC or if it should be discussed somewhere else.

@xFrednet xFrednet added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 11, 2023
@epage
Copy link
Contributor

epage commented Jan 11, 2023

Related issues include #1545 (but instead cloning the repo) and #1861 (sounds like a duplicate of this)

@xFrednet
Copy link
Member Author

Yes, looks like a duplicate of the later one. Thank you! I'll close this in favor of that one

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

No branches or pull requests

2 participants