115
115
RUST_TOOLCHAIN_LIB_DIR = os .path .join (RUST_TOOLCHAIN_OUT_DIR , 'lib' )
116
116
RUST_TOOLCHAIN_SRC_DIST_DIR = os .path .join (RUST_TOOLCHAIN_LIB_DIR , 'rustlib' ,
117
117
'src' , 'rust' )
118
- RUST_TOOLCHAIN_SRC_DIST_VENDOR_DIR = os .path .join (RUST_TOOLCHAIN_SRC_DIST_DIR ,
119
- 'vendor' )
120
118
RUST_CONFIG_TEMPLATE_PATH = os .path .join (
121
119
os .path .dirname (os .path .abspath (__file__ )), 'config.toml.template' )
122
120
RUST_CARGO_CONFIG_TEMPLATE_PATH = os .path .join (
123
121
os .path .dirname (os .path .abspath (__file__ )), 'cargo-config.toml.template' )
124
- RUST_SRC_VENDOR_DIR = os .path .join (RUST_SRC_DIR , 'vendor' )
125
122
126
123
RUST_HOST_LLVM_BUILD_DIR = os .path .join (CHROMIUM_DIR , 'third_party' ,
127
124
'rust-toolchain-intermediate' ,
@@ -256,8 +253,8 @@ def InstallBetaPackage(package_dir, install_dir):
256
253
RunCommand ([os .path .join (package_dir , 'install.sh' )] + args )
257
254
258
255
259
- def CargoVendor (cargo_bin ):
260
- '''Runs `cargo vendor` to pull down dependencies.'''
256
+ def VendorForStdlib (cargo_bin ):
257
+ '''Runs `cargo vendor` to pull down standard library dependencies.'''
261
258
os .chdir (RUST_SRC_DIR )
262
259
263
260
vendor_env = os .environ
@@ -268,10 +265,8 @@ def CargoVendor(cargo_bin):
268
265
vendor_env ['RUSTC_BOOTSTRAP' ] = '1'
269
266
270
267
vendor_cmd = [
271
- cargo_bin ,
272
- 'vendor' ,
273
- '--locked' ,
274
- '--versioned-dirs' ,
268
+ cargo_bin , 'vendor' , '--manifest-path' , 'library/Cargo.toml' ,
269
+ '--locked' , '--versioned-dirs' , 'library/vendor'
275
270
]
276
271
RunWithRetry (vendor_cmd , 'cargo vendor' )
277
272
@@ -628,6 +623,24 @@ def GitApplyCherryPicks():
628
623
# with `GitMoveSubmoduleBranch()`.
629
624
#############################
630
625
626
+ # TODO Remove once LLVM rolls past llvmorg-20-init-3909-ge61d6066e267
627
+ RunCommand ([
628
+ 'git' ,
629
+ '-C' ,
630
+ RUST_SRC_DIR ,
631
+ 'revert' ,
632
+ '--no-edit' ,
633
+ '-m' ,
634
+ '1' ,
635
+ '8c7a7e346be4cdf13e77ab4acbfb5ade819a4e60' ,
636
+ ])
637
+
638
+ # TODO(b/363219692): Remove once
639
+ # https://github.com/rust-lang/rust/pull/129894 or a similar fix has been
640
+ # merged.
641
+ GitCherryPick (RUST_SRC_DIR , 'https://github.com/rust-lang/rust.git' ,
642
+ 'f20103f9f3e35dad241dd81cd3ae9eb2dafb3f44' )
643
+
631
644
print ('Finished applying cherry-picks.' )
632
645
633
646
@@ -784,7 +797,7 @@ def main():
784
797
if l .strip ('\n ' ) != 'debug = 0' :
785
798
f .write (l )
786
799
787
- CargoVendor (cargo_bin )
800
+ VendorForStdlib (cargo_bin )
788
801
789
802
# Gnrt needs the checkout to be up-to-date, workspace submodules to be
790
803
# synced for cargo to work, and the cargo binary itself. All this is done,
@@ -841,9 +854,10 @@ def main():
841
854
842
855
xpy .run ('install' , [])
843
856
844
- # Copy additional vendored crates required for building stdlib.
845
- print (f'Copying vendored dependencies to { RUST_TOOLCHAIN_OUT_DIR } ...' )
846
- shutil .copytree (RUST_SRC_VENDOR_DIR , RUST_TOOLCHAIN_SRC_DIST_VENDOR_DIR )
857
+ # The Rust stdlib deps are vendored to rust-src/library/vendor, and later
858
+ # the x.py install process copies all subdirs of rust-src/library to the
859
+ # toolchain package, so we do not need to explicitly copy the vendor dir.
860
+ # This is left as a note in case that behavior changes.
847
861
848
862
with open (VERSION_SRC_PATH , 'w' ) as stamp :
849
863
stamp .write (MakeVersionStamp (checkout_revision ))
0 commit comments