@@ -489,8 +489,8 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
489
489
t ! ( fs:: remove_dir_all( & image) ) ;
490
490
}
491
491
492
- fn copy_src_dirs ( build : & Build , src_dirs : & [ & str ] , dst_dir : & Path ) {
493
- let filter_fn = move | path : & Path | {
492
+ fn copy_src_dirs ( build : & Build , src_dirs : & [ & str ] , exclude_dirs : & [ & str ] , dst_dir : & Path ) {
493
+ fn filter_fn ( exclude_dirs : & [ & str ] , dir : & str , path : & Path ) -> bool {
494
494
let spath = match path. to_str ( ) {
495
495
Some ( path) => path,
496
496
None => return false ,
@@ -506,6 +506,11 @@ fn copy_src_dirs(build: &Build, src_dirs: &[&str], dst_dir: &Path) {
506
506
}
507
507
}
508
508
509
+ let full_path = Path :: new ( dir) . join ( path) ;
510
+ if exclude_dirs. iter ( ) . any ( |excl| full_path == Path :: new ( excl) ) {
511
+ return false ;
512
+ }
513
+
509
514
let excludes = [
510
515
"CVS" , "RCS" , "SCCS" , ".git" , ".gitignore" , ".gitmodules" ,
511
516
".gitattributes" , ".cvsignore" , ".svn" , ".arch-ids" , "{arch}" ,
@@ -515,13 +520,13 @@ fn copy_src_dirs(build: &Build, src_dirs: &[&str], dst_dir: &Path) {
515
520
!path. iter ( )
516
521
. map ( |s| s. to_str ( ) . unwrap ( ) )
517
522
. any ( |s| excludes. contains ( & s) )
518
- } ;
523
+ }
519
524
520
525
// Copy the directories using our filter
521
526
for item in src_dirs {
522
527
let dst = & dst_dir. join ( item) ;
523
528
t ! ( fs:: create_dir_all( dst) ) ;
524
- cp_filtered ( & build. src . join ( item) , dst, & filter_fn) ;
529
+ cp_filtered ( & build. src . join ( item) , dst, & |path| filter_fn ( exclude_dirs , item , path ) ) ;
525
530
}
526
531
}
527
532
@@ -544,6 +549,7 @@ pub fn rust_src(build: &Build) {
544
549
"src/liballoc" ,
545
550
"src/liballoc_jemalloc" ,
546
551
"src/liballoc_system" ,
552
+ "src/libbacktrace" ,
547
553
"src/libcollections" ,
548
554
"src/libcompiler_builtins" ,
549
555
"src/libcore" ,
@@ -559,9 +565,18 @@ pub fn rust_src(build: &Build) {
559
565
"src/libstd_unicode" ,
560
566
"src/libunwind" ,
561
567
"src/rustc/libc_shim" ,
568
+ "src/libtest" ,
569
+ "src/libterm" ,
570
+ "src/libgetopts" ,
571
+ "src/compiler-rt" ,
572
+ "src/jemalloc" ,
573
+ ] ;
574
+ let std_src_dirs_exclude = [
575
+ "src/compiler-rt/test" ,
576
+ "src/jemalloc/test/unit" ,
562
577
] ;
563
578
564
- copy_src_dirs ( build, & std_src_dirs[ ..] , & dst_src) ;
579
+ copy_src_dirs ( build, & std_src_dirs[ ..] , & std_src_dirs_exclude [ .. ] , & dst_src) ;
565
580
566
581
// Create source tarball in rust-installer format
567
582
let mut cmd = rust_installer ( build) ;
@@ -608,7 +623,7 @@ pub fn plain_source_tarball(build: &Build) {
608
623
"src" ,
609
624
] ;
610
625
611
- copy_src_dirs ( build, & src_dirs[ ..] , & plain_dst_src) ;
626
+ copy_src_dirs ( build, & src_dirs[ ..] , & [ ] , & plain_dst_src) ;
612
627
613
628
// Copy the files normally
614
629
for item in & src_files {
0 commit comments