From 741b3164d874ef95ab40d4aca7536265f84e1155 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sun, 8 Sep 2024 20:14:50 +0300 Subject: [PATCH] make dist vendoring configurable Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/dist.rs | 6 +----- src/bootstrap/src/core/config/config.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index b0bd18792be..294a56b3e97 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1011,11 +1011,7 @@ fn run(self, builder: &Builder<'_>) -> GeneratedTarball { write_git_info(builder.rust_info().info(), plain_dst_src); write_git_info(builder.cargo_info.info(), &plain_dst_src.join("./src/tools/cargo")); - // If we're building from git or tarball sources, we need to vendor - // a complete distribution. - if builder.rust_info().is_managed_git_subrepository() - || builder.rust_info().is_from_tarball() - { + if builder.config.dist_vendor { builder.require_and_update_all_submodules(); // Vendor all Cargo dependencies diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 79c2f73161e..555a6a7f8bd 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -308,6 +308,7 @@ pub struct Config { pub dist_compression_formats: Option>, pub dist_compression_profile: String, pub dist_include_mingw_linker: bool, + pub dist_vendor: bool, // libstd features pub backtrace: bool, // support for RUST_BACKTRACE @@ -933,6 +934,7 @@ struct Dist { compression_formats: Option> = "compression-formats", compression_profile: Option = "compression-profile", include_mingw_linker: Option = "include-mingw-linker", + vendor: Option = "vendor", } } @@ -2028,13 +2030,19 @@ fn get_table(option: &str) -> Result { compression_formats, compression_profile, include_mingw_linker, + vendor, } = dist; config.dist_sign_folder = sign_folder.map(PathBuf::from); config.dist_upload_addr = upload_addr; config.dist_compression_formats = compression_formats; set(&mut config.dist_compression_profile, compression_profile); set(&mut config.rust_dist_src, src_tarball); - set(&mut config.dist_include_mingw_linker, include_mingw_linker) + set(&mut config.dist_include_mingw_linker, include_mingw_linker); + config.dist_vendor = vendor.unwrap_or_else(|| { + // If we're building from git or tarball sources, enable it by default. + config.rust_info.is_managed_git_subrepository() + || config.rust_info.is_from_tarball() + }); } if let Some(r) = rustfmt {