Skip to content

Commit 0d00c83

Browse files
Rollup merge of rust-lang#42214 - RalfJung:rust-src, r=alexcrichton
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
2 parents f7c11a8 + 6453f68 commit 0d00c83

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/bootstrap/dist.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ pub fn rust_src(build: &Build) {
619619
"src/liballoc",
620620
"src/liballoc_jemalloc",
621621
"src/liballoc_system",
622+
"src/libbacktrace",
622623
"src/libcollections",
623624
"src/libcompiler_builtins",
624625
"src/libcore",
@@ -634,12 +635,25 @@ pub fn rust_src(build: &Build) {
634635
"src/libstd_unicode",
635636
"src/libunwind",
636637
"src/rustc/libc_shim",
638+
"src/libtest",
639+
"src/libterm",
640+
"src/libgetopts",
641+
"src/compiler-rt",
642+
"src/jemalloc",
643+
];
644+
let std_src_dirs_exclude = [
645+
"src/compiler-rt/test",
646+
"src/jemalloc/test/unit",
637647
];
638648

639649
for item in &std_src_dirs {
640650
let dst = &dst_src.join(item);
641651
t!(fs::create_dir_all(dst));
642-
cp_r(&plain_dst_src.join(item), dst);
652+
cp_filtered(&plain_dst_src.join(item), dst,
653+
&|path| {
654+
let item_path = Path::new(item).join(path);
655+
!std_src_dirs_exclude.iter().any(|excl| item_path == Path::new(excl))
656+
} );
643657
}
644658

645659
// Create source tarball in rust-installer format

0 commit comments

Comments
 (0)