Skip to content

Commit da59e77

Browse files
authored
Rollup merge of #133853 - onur-ozkan:use-vendor-directory-on-dist-build, r=Kobzol
use vendor sources by default on dist tarballs Tarball sources are distributed with vendor sources along with the `.cargo/config.toml` file configured for vendor sources. This means we can use vendor sources by default unless explicitly disabled with `build.vendor=false` by the user. So, let's do that.
2 parents 3546bd9 + 9ca9b41 commit da59e77

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

config.example.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,8 @@
311311
# Indicate whether the vendored sources are used for Rust dependencies or not.
312312
#
313313
# Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you
314-
# want to use vendoring. See
315-
# https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
316-
#vendor = false
314+
# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
315+
#vendor = if "is a tarball source" && "vendor" dir exists && ".cargo/config.toml" file exists { true } else { false }
317316

318317
# Typically the build system will build the Rust compiler twice. The second
319318
# compiler, however, will simply use its own libraries to link against. If you

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,6 @@ impl Config {
16321632
set(&mut config.docs_minification, docs_minification);
16331633
set(&mut config.docs, docs);
16341634
set(&mut config.locked_deps, locked_deps);
1635-
set(&mut config.vendor, vendor);
16361635
set(&mut config.full_bootstrap, full_bootstrap);
16371636
set(&mut config.extended, extended);
16381637
config.tools = tools;
@@ -1711,6 +1710,12 @@ impl Config {
17111710
config.in_tree_llvm_info = GitInfo::new(false, &config.src.join("src/llvm-project"));
17121711
config.in_tree_gcc_info = GitInfo::new(false, &config.src.join("src/gcc"));
17131712

1713+
config.vendor = vendor.unwrap_or(
1714+
config.rust_info.is_from_tarball()
1715+
&& config.src.join("vendor").exists()
1716+
&& config.src.join(".cargo/config.toml").exists(),
1717+
);
1718+
17141719
if let Some(rust) = toml.rust {
17151720
let Rust {
17161721
optimize: optimize_toml,

src/bootstrap/src/utils/change_tracker.rs

+5
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
310310
severity: ChangeSeverity::Warning,
311311
summary: "Revert `rust.download-rustc` global default to `false` and only use `rust.download-rustc = \"if-unchanged\"` default for library and tools profile. As alt CI rustc is built without debug assertions, `rust.debug-assertions = true` will now inhibit downloading CI rustc.",
312312
},
313+
ChangeInfo {
314+
change_id: 133853,
315+
severity: ChangeSeverity::Info,
316+
summary: "`build.vendor` is now enabled by default for dist/tarball sources when 'vendor' directory and '.cargo/config.toml' file are present.",
317+
},
313318
];

0 commit comments

Comments
 (0)