@@ -19,7 +19,7 @@ use object::read::archive::ArchiveFile;
19
19
20
20
use crate :: core:: build_steps:: doc:: DocumentationFormat ;
21
21
use 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 } ;
23
23
use crate :: core:: build_steps:: { compile, llvm} ;
24
24
use crate :: core:: builder:: { Builder , Kind , RunConfig , ShouldRun , Step } ;
25
25
use crate :: core:: config:: TargetSelection ;
@@ -1050,19 +1050,6 @@ impl Step for PlainSourceTarball {
1050
1050
if builder. config . dist_vendor {
1051
1051
builder. require_and_update_all_submodules ( ) ;
1052
1052
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
-
1066
1053
// Vendor packages that are required by opt-dist to collect PGO profiles.
1067
1054
let pkgs_for_pgo_training = build_helper:: LLVM_PGO_CRATES
1068
1055
. iter ( )
@@ -1074,15 +1061,18 @@ impl Step for PlainSourceTarball {
1074
1061
manifest_path. push ( "Cargo.toml" ) ;
1075
1062
manifest_path
1076
1063
} ) ;
1077
- for manifest_path in pkgs_for_pgo_training {
1078
- cmd. arg ( "--sync" ) . arg ( manifest_path) ;
1079
- }
1080
1064
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
+ } ) ;
1082
1072
1083
1073
let cargo_config_dir = plain_dst_src. join ( ".cargo" ) ;
1084
1074
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 ) ;
1086
1076
}
1087
1077
1088
1078
// Delete extraneous directories
0 commit comments