diff --git a/config.example.toml b/config.example.toml index 2b5e9ae117db7..c66d65e639aa0 100644 --- a/config.example.toml +++ b/config.example.toml @@ -942,3 +942,6 @@ # Copy the linker, DLLs, and various libraries from MinGW into the Rust toolchain. # Only applies when the host or target is pc-windows-gnu. #include-mingw-linker = true + +# Whether to vendor dependencies for the dist tarball. +#vendor = if "is a tarball source" || "is a git repository" { true } else { false } diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index b0bd18792beb2..294a56b3e976a 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1011,11 +1011,7 @@ impl Step for PlainSourceTarball { 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 79c2f73161e48..555a6a7f8bdeb 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 @@ define_config! { compression_formats: Option> = "compression-formats", compression_profile: Option = "compression-profile", include_mingw_linker: Option = "include-mingw-linker", + vendor: Option = "vendor", } } @@ -2028,13 +2030,19 @@ impl Config { 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 { diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 99bcc6e0787ff..1b357f77984d1 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -255,4 +255,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "`download-ci-llvm = true` now checks if CI llvm is available and has become the default for the compiler profile", }, + ChangeInfo { + change_id: 130110, + severity: ChangeSeverity::Info, + summary: "New option `dist.vendor` added to control whether bootstrap should vendor dependencies for dist tarball.", + }, ];