Skip to content

Commit

Permalink
Rollup merge of rust-lang#42214 - RalfJung:rust-src, r=alexcrichton
Browse files Browse the repository at this point in the history
rust-src: include everything needed to compile libstd with jemalloc

I am not very happy about all this `Path::new`, but did not find a nice way to avoid it. Also, this shouldn't be very performance-critical.

With this patch, rust-src-1.19.0-dev.tar.gz grows from 1.4 to 3.1 MiB (new uncompressed size: 15.5 MiB). Not great, but shipping incomplete sources is also not great, and this is still much smaller than pre-rust-lang#41546. Excluding the entire `src/jemalloc/test` does not work, unfortunately; there is a file in there that is needed to build libstd. (And anyway there's just 190 KiB uncompressed left in that folder.)

In principle, we could try excluding the Rust test suite directories (that would be `libcore/tests` and `libcollection/tests`). I don't know enough about how this component is used to judge whether that would cause any problems. Anyway this is just 600 KiB uncompressed.

Fixes rust-lang#41952
  • Loading branch information
Mark-Simulacrum authored May 26, 2017
2 parents f7c11a8 + 6453f68 commit 0d00c83
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ pub fn rust_src(build: &Build) {
"src/liballoc",
"src/liballoc_jemalloc",
"src/liballoc_system",
"src/libbacktrace",
"src/libcollections",
"src/libcompiler_builtins",
"src/libcore",
Expand All @@ -634,12 +635,25 @@ pub fn rust_src(build: &Build) {
"src/libstd_unicode",
"src/libunwind",
"src/rustc/libc_shim",
"src/libtest",
"src/libterm",
"src/libgetopts",
"src/compiler-rt",
"src/jemalloc",
];
let std_src_dirs_exclude = [
"src/compiler-rt/test",
"src/jemalloc/test/unit",
];

for item in &std_src_dirs {
let dst = &dst_src.join(item);
t!(fs::create_dir_all(dst));
cp_r(&plain_dst_src.join(item), dst);
cp_filtered(&plain_dst_src.join(item), dst,
&|path| {
let item_path = Path::new(item).join(path);
!std_src_dirs_exclude.iter().any(|excl| item_path == Path::new(excl))
} );
}

// Create source tarball in rust-installer format
Expand Down

0 comments on commit 0d00c83

Please sign in to comment.