@@ -360,6 +360,8 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
360
360
t ! ( fs:: remove_dir_all( & image) ) ;
361
361
}
362
362
363
+ const CARGO_VENDOR_VERSION : & ' static str = "0.1.4" ;
364
+
363
365
/// Creates the `rust-src` installer component and the plain source tarball
364
366
pub fn rust_src ( build : & Build ) {
365
367
println ! ( "Dist src" ) ;
@@ -404,13 +406,6 @@ pub fn rust_src(build: &Build) {
404
406
}
405
407
}
406
408
407
- // If we're inside the vendor directory then we need to preserve
408
- // everything as Cargo's vendoring support tracks all checksums and we
409
- // want to be sure we don't accidentally leave out a file.
410
- if spath. contains ( "vendor" ) {
411
- return true
412
- }
413
-
414
409
let excludes = [
415
410
"CVS" , "RCS" , "SCCS" , ".git" , ".gitignore" , ".gitmodules" ,
416
411
".gitattributes" , ".cvsignore" , ".svn" , ".arch-ids" , "{arch}" ,
@@ -433,6 +428,29 @@ pub fn rust_src(build: &Build) {
433
428
copy ( & build. src . join ( item) , & dst_src. join ( item) ) ;
434
429
}
435
430
431
+ // Get cargo-vendor installed, if it isn't already.
432
+ let mut has_cargo_vendor = false ;
433
+ let mut cmd = Command :: new ( & build. cargo ) ;
434
+ for line in output ( cmd. arg ( "install" ) . arg ( "--list" ) ) . lines ( ) {
435
+ has_cargo_vendor |= line. starts_with ( "cargo-vendor " ) ;
436
+ }
437
+ if !has_cargo_vendor {
438
+ let mut cmd = Command :: new ( & build. cargo ) ;
439
+ cmd. arg ( "install" )
440
+ . arg ( "--force" )
441
+ . arg ( "--debug" )
442
+ . arg ( "--vers" ) . arg ( CARGO_VENDOR_VERSION )
443
+ . arg ( "cargo-vendor" )
444
+ . env ( "RUSTC" , & build. rustc ) ;
445
+ build. run ( & mut cmd) ;
446
+ }
447
+
448
+ // Vendor all Cargo dependencies
449
+ let mut cmd = Command :: new ( & build. cargo ) ;
450
+ cmd. arg ( "vendor" )
451
+ . current_dir ( & dst_src. join ( "src" ) ) ;
452
+ build. run ( & mut cmd) ;
453
+
436
454
// Create source tarball in rust-installer format
437
455
let mut cmd = Command :: new ( "sh" ) ;
438
456
cmd. arg ( sanitize_sh ( & build. src . join ( "src/rust-installer/gen-installer.sh" ) ) )
0 commit comments