about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-12-10 08:55:57 +0100
committerGitHub <noreply@github.com>2024-12-10 08:55:57 +0100
commitea64a5d8116e4a88af4103a0dfc3594b14a66816 (patch)
tree489b06faee0c14cf905e3cb952b43f9d7ed52cc2
parentce8d24139627d4154c137445e80bb66a47d87680 (diff)
parent9ca9b41df2ca682c815b9bb3e580ce93b216a50d (diff)
downloadrust-ea64a5d8116e4a88af4103a0dfc3594b14a66816.tar.gz
rust-ea64a5d8116e4a88af4103a0dfc3594b14a66816.zip
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.
-rw-r--r--config.example.toml5
-rw-r--r--src/bootstrap/src/core/config/config.rs7
-rw-r--r--src/bootstrap/src/utils/change_tracker.rs5
3 files changed, 13 insertions, 4 deletions
diff --git a/config.example.toml b/config.example.toml
index 9ec0d77e79b..5ea6774ce03 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -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
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index aa5cce2fb1b..b8f9be26bf2 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -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;
@@ -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,
diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs
index 41a541d7269..f4f189c718a 100644
--- a/src/bootstrap/src/utils/change_tracker.rs
+++ b/src/bootstrap/src/utils/change_tracker.rs
@@ -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.",
+    },
 ];