Skip to content

Commit 8ad52dd

Browse files
authored
Rollup merge of #130110 - onur-ozkan:configurable-dist-vendor, r=Kobzol,Mark-Simulacrum
make dist vendoring configurable Adds a new option `dist.vendor` which allows people to decide whether to vendor dependencies for their custom distribution tarball builds. Note that our builds will not be affected, as the default for this option is the same as the previous vendoring condition from bootstrap.
2 parents 6ac598a + 13542cd commit 8ad52dd

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

config.example.toml

+3
Original file line numberDiff line numberDiff line change
@@ -942,3 +942,6 @@
942942
# Copy the linker, DLLs, and various libraries from MinGW into the Rust toolchain.
943943
# Only applies when the host or target is pc-windows-gnu.
944944
#include-mingw-linker = true
945+
946+
# Whether to vendor dependencies for the dist tarball.
947+
#vendor = if "is a tarball source" || "is a git repository" { true } else { false }

src/bootstrap/src/core/build_steps/dist.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,7 @@ impl Step for PlainSourceTarball {
10111011
write_git_info(builder.rust_info().info(), plain_dst_src);
10121012
write_git_info(builder.cargo_info.info(), &plain_dst_src.join("./src/tools/cargo"));
10131013

1014-
// If we're building from git or tarball sources, we need to vendor
1015-
// a complete distribution.
1016-
if builder.rust_info().is_managed_git_subrepository()
1017-
|| builder.rust_info().is_from_tarball()
1018-
{
1014+
if builder.config.dist_vendor {
10191015
builder.require_and_update_all_submodules();
10201016

10211017
// Vendor all Cargo dependencies

src/bootstrap/src/core/config/config.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ pub struct Config {
308308
pub dist_compression_formats: Option<Vec<String>>,
309309
pub dist_compression_profile: String,
310310
pub dist_include_mingw_linker: bool,
311+
pub dist_vendor: bool,
311312

312313
// libstd features
313314
pub backtrace: bool, // support for RUST_BACKTRACE
@@ -933,6 +934,7 @@ define_config! {
933934
compression_formats: Option<Vec<String>> = "compression-formats",
934935
compression_profile: Option<String> = "compression-profile",
935936
include_mingw_linker: Option<bool> = "include-mingw-linker",
937+
vendor: Option<bool> = "vendor",
936938
}
937939
}
938940

@@ -2028,13 +2030,19 @@ impl Config {
20282030
compression_formats,
20292031
compression_profile,
20302032
include_mingw_linker,
2033+
vendor,
20312034
} = dist;
20322035
config.dist_sign_folder = sign_folder.map(PathBuf::from);
20332036
config.dist_upload_addr = upload_addr;
20342037
config.dist_compression_formats = compression_formats;
20352038
set(&mut config.dist_compression_profile, compression_profile);
20362039
set(&mut config.rust_dist_src, src_tarball);
2037-
set(&mut config.dist_include_mingw_linker, include_mingw_linker)
2040+
set(&mut config.dist_include_mingw_linker, include_mingw_linker);
2041+
config.dist_vendor = vendor.unwrap_or_else(|| {
2042+
// If we're building from git or tarball sources, enable it by default.
2043+
config.rust_info.is_managed_git_subrepository()
2044+
|| config.rust_info.is_from_tarball()
2045+
});
20382046
}
20392047

20402048
if let Some(r) = rustfmt {

src/bootstrap/src/utils/change_tracker.rs

+5
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
260260
severity: ChangeSeverity::Info,
261261
summary: "'tools' and 'library' profiles switched `download-ci-llvm` option from `if-unchanged` to `true`.",
262262
},
263+
ChangeInfo {
264+
change_id: 130110,
265+
severity: ChangeSeverity::Info,
266+
summary: "New option `dist.vendor` added to control whether bootstrap should vendor dependencies for dist tarball.",
267+
},
263268
];

0 commit comments

Comments
 (0)