about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-10-10 08:54:23 +0300
committeronur-ozkan <work@onurozkan.dev>2024-10-10 08:55:15 +0300
commitb198a4666505a94efbd0a5fb443bb3cf8997be9a (patch)
treeb953535cb7671198b5371735cadee6be939a4229
parent7a0e8bd1fd9998765ac99a640566c57eeda9882e (diff)
downloadrust-b198a4666505a94efbd0a5fb443bb3cf8997be9a.tar.gz
rust-b198a4666505a94efbd0a5fb443bb3cf8997be9a.zip
disable `download-rustc` if LLVM submodule has changes in CI
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/core/config/config.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 9f84b492b80..3f025a198cb 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -2399,6 +2399,20 @@ impl Config {
                 Some(commit) => {
                     self.download_ci_rustc(commit);
 
+                    // CI-rustc can't be used without CI-LLVM. If `self.llvm_from_ci` is false, it means the "if-unchanged"
+                    // logic has detected some changes in the LLVM submodule (download-ci-llvm=false can't happen here as
+                    // we don't allow it while parsing the configuration).
+                    if !self.llvm_from_ci {
+                        // This happens when LLVM submodule is updated in CI, we should disable ci-rustc without an error
+                        // to not break CI. For non-CI environments, we should return an error.
+                        if CiEnv::is_ci() {
+                            println!("WARNING: LLVM submodule has changes, `download-rustc` will be disabled.");
+                            return None;
+                        } else {
+                            panic!("ERROR: LLVM submodule has changes, `download-rustc` can't be used.");
+                        }
+                    }
+
                     if let Some(config_path) = &self.config {
                         let ci_config_toml = match self.get_builder_toml("ci-rustc") {
                             Ok(ci_config_toml) => ci_config_toml,