@@ -19,7 +19,7 @@ use object::read::archive::ArchiveFile;
1919
2020use crate :: core:: build_steps:: doc:: DocumentationFormat ;
2121use crate :: core:: build_steps:: tool:: { self , Tool } ;
22- use crate :: core:: build_steps:: vendor:: default_paths_to_vendor ;
22+ use crate :: core:: build_steps:: vendor:: { VENDOR_DIR , Vendor } ;
2323use crate :: core:: build_steps:: { compile, llvm} ;
2424use crate :: core:: builder:: { Builder , Kind , RunConfig , ShouldRun , Step } ;
2525use crate :: core:: config:: TargetSelection ;
@@ -1050,19 +1050,6 @@ impl Step for PlainSourceTarball {
10501050 if builder. config . dist_vendor {
10511051 builder. require_and_update_all_submodules ( ) ;
10521052
1053- // Vendor all Cargo dependencies
1054- let mut cmd = command ( & builder. initial_cargo ) ;
1055- cmd. arg ( "vendor" ) . arg ( "--versioned-dirs" ) ;
1056-
1057- for ( p, _) in default_paths_to_vendor ( builder) {
1058- cmd. arg ( "--sync" ) . arg ( p) ;
1059- }
1060-
1061- cmd
1062- // Will read the libstd Cargo.toml which uses the unstable `public-dependency` feature.
1063- . env ( "RUSTC_BOOTSTRAP" , "1" )
1064- . current_dir ( plain_dst_src) ;
1065-
10661053 // Vendor packages that are required by opt-dist to collect PGO profiles.
10671054 let pkgs_for_pgo_training = build_helper:: LLVM_PGO_CRATES
10681055 . iter ( )
@@ -1074,15 +1061,18 @@ impl Step for PlainSourceTarball {
10741061 manifest_path. push ( "Cargo.toml" ) ;
10751062 manifest_path
10761063 } ) ;
1077- for manifest_path in pkgs_for_pgo_training {
1078- cmd. arg ( "--sync" ) . arg ( manifest_path) ;
1079- }
10801064
1081- let config = cmd. run_capture ( builder) . stdout ( ) ;
1065+ // Vendor all Cargo dependencies
1066+ let vendor = builder. ensure ( Vendor {
1067+ sync_args : pkgs_for_pgo_training. collect ( ) ,
1068+ versioned_dirs : true ,
1069+ root_dir : plain_dst_src. into ( ) ,
1070+ output_dir : VENDOR_DIR . into ( ) ,
1071+ } ) ;
10821072
10831073 let cargo_config_dir = plain_dst_src. join ( ".cargo" ) ;
10841074 builder. create_dir ( & cargo_config_dir) ;
1085- builder. create ( & cargo_config_dir. join ( "config.toml" ) , & config) ;
1075+ builder. create ( & cargo_config_dir. join ( "config.toml" ) , & vendor . config ) ;
10861076 }
10871077
10881078 // Delete extraneous directories
0 commit comments