diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-15 16:01:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-15 16:01:37 +0200 |
| commit | 8ad52ddf9e6fdcf253e60a0120e31263b90ec852 (patch) | |
| tree | 02bcb339c351f1d6908ec69a539a320ae769ad3c | |
| parent | 6ac598a4724effcbdb7fcc02de6cd1238096a7d5 (diff) | |
| parent | 13542cdb806fe1f26d6f4fc52755e1bb1ab6d300 (diff) | |
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.
| -rw-r--r-- | config.example.toml | 3 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 10 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/change_tracker.rs | 5 |
4 files changed, 18 insertions, 6 deletions
diff --git a/config.example.toml b/config.example.toml index 2b5e9ae117d..c66d65e639a 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 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 @@ 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 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<Vec<String>>, 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<Vec<String>> = "compression-formats", compression_profile: Option<String> = "compression-profile", include_mingw_linker: Option<bool> = "include-mingw-linker", + vendor: Option<bool> = "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 bedaa15ccb9..379cd568647 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -260,4 +260,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Info, summary: "'tools' and 'library' profiles switched `download-ci-llvm` option from `if-unchanged` to `true`.", }, + ChangeInfo { + change_id: 130110, + severity: ChangeSeverity::Info, + summary: "New option `dist.vendor` added to control whether bootstrap should vendor dependencies for dist tarball.", + }, ]; |
