Skip to content

Commit

Permalink
Rollup merge of #133853 - onur-ozkan:use-vendor-directory-on-dist-bui…
Browse files Browse the repository at this point in the history
…ld, 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.
  • Loading branch information
fmease authored Dec 10, 2024
2 parents ce8d241 + 9ca9b41 commit ea64a5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 2 additions & 3 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,8 @@
# Indicate whether the vendored sources are used for Rust dependencies or not.
#
# Vendoring requires additional setup. We recommend using the pre-generated source tarballs if you
# want to use vendoring. See
# https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
#vendor = false
# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
#vendor = if "is a tarball source" && "vendor" dir exists && ".cargo/config.toml" file exists { true } else { false }

# Typically the build system will build the Rust compiler twice. The second
# compiler, however, will simply use its own libraries to link against. If you
Expand Down
7 changes: 6 additions & 1 deletion src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,6 @@ impl Config {
set(&mut config.docs_minification, docs_minification);
set(&mut config.docs, docs);
set(&mut config.locked_deps, locked_deps);
set(&mut config.vendor, vendor);
set(&mut config.full_bootstrap, full_bootstrap);
set(&mut config.extended, extended);
config.tools = tools;
Expand Down Expand Up @@ -1711,6 +1710,12 @@ impl Config {
config.in_tree_llvm_info = GitInfo::new(false, &config.src.join("src/llvm-project"));
config.in_tree_gcc_info = GitInfo::new(false, &config.src.join("src/gcc"));

config.vendor = vendor.unwrap_or(
config.rust_info.is_from_tarball()
&& config.src.join("vendor").exists()
&& config.src.join(".cargo/config.toml").exists(),
);

if let Some(rust) = toml.rust {
let Rust {
optimize: optimize_toml,
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/utils/change_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Warning,
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.",
},
ChangeInfo {
change_id: 133853,
severity: ChangeSeverity::Info,
summary: "`build.vendor` is now enabled by default for dist/tarball sources when 'vendor' directory and '.cargo/config.toml' file are present.",
},
];

0 comments on commit ea64a5d

Please sign in to comment.