-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Compile a crate from its source archive directly #128884
Comments
https://internals.rust-lang.org/t/jar-for-rust-single-file-crate-support-for-rustc/19576 is the last conversation I saw for compiling a
This part isn't making sense to me. If you are passing a
Sounds like you aren't creating a Then this is purely a |
I feel like it would be better to first librarify the relevant code in cargo and then discuss adding it to rustc? |
A lot of that depends on what rustc would want. For example, one idea that came up in that thread is if we could abstract this in a way for cargo to define the filesystem so we could read from git databases directly, rather than checking out files. Would we want that in scope? What would it look like to support something like that? |
Well you're right, this issue should probably live in FROM scratch AS cratesio-ring-0.17.8-index.crates.io-6f17d22bba15001f
ADD --chmod=0664 --checksum=sha256:c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d \
https://static.crates.io/crates/ring/ring-0.17.8.crate /crate
SHELL ["/usr/bin/dash", "-c"]
RUN \
--mount=from=rust-base,src=/lib,dst=/lib \
--mount=from=rust-base,src=/lib64,dst=/lib64 \
--mount=from=rust-base,src=/usr,dst=/usr \
set -eux \
&& mkdir -p /extracted \
&& tar zxvf /crate --strip-components=1 -C /extracted I use this to fetch and extract a WRT |
The performance might be a concern for reading from git versus from file system. |
squashfs could be another possibility. |
Problem
Today, crates provided by e.g. crates.io are downloaded in a (somewhat loosely defined?) archive format, with a
.crate
extension. Example: https://static.crates.io/crates/clap/clap-3.0.6.crateThis gets stored as a local cache and is also extracted in a nearby folder, which then gets fed to
cargo
/rustc
for compilation.I (and surely others) am developing a
$RUSTC_WRAPPER
that has to deal with these archives and thus have to replicate the handling of said.crate
s. Given these open issues, and for optimization reasons, I would like forcargo
(orrustc
) to be able to take in these archives directly, without prior extraction:src
cache read-only. cargo#9455Proposed Solution
I am not familiar with the inner workings of either
cargo
norrustc
so this is a high level take.Basically, I'm asking that today's call to
rustc
be seamlessly interchangeable from:to
thus moving the crate archive handling code to within the boundary of (I guess)
rustc
.This in turn
rustc
Notes
I realize this issue may need to move to
rustc
. But hey let's have a small discussion first :)The text was updated successfully, but these errors were encountered: