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.
This commit is contained in:
Matthias Krüger 2024-09-15 16:01:37 +02:00 committed by GitHub
commit 8ad52ddf9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 6 deletions

View File

@ -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 }

View File

@ -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

View File

@ -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 @@ struct Dist {
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 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
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 {

View File

@ -260,4 +260,9 @@ pub fn human_readable_changes(changes: &[ChangeInfo]) -> String {
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.",
},
];