diff --git a/config.example.toml b/config.example.toml index 79a7886457f75..e5df28a49af6c 100644 --- a/config.example.toml +++ b/config.example.toml @@ -48,7 +48,8 @@ change-id = 116881 # We also currently only support this when building LLVM for the build triple. # # Set this to `"if-unchanged"` to only download if the llvm-project have not -# been modified. (if no changes, the logic is the same as `"if-available"`) +# been modified. (If there are no changes or if built from tarball source, +# the logic is the same as "if-available") # # Note that many of the LLVM options are not currently supported for # downloading. Currently only the "assertions" option can be toggled. diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 8817189a8bb9d..04a1644377039 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -147,8 +147,14 @@ impl Step for Profile { } fn run(self, builder: &Builder<'_>) { - if self == Profile::Codegen { - builder.update_submodule(&Path::new("src/llvm-project")); + // During ./x.py setup once you select the codegen profile. + // The submodule will be downloaded. It does not work in the + // tarball case since they don't include Git and submodules + // are already included. + if !builder.rust_info().is_from_tarball() { + if self == Profile::Codegen { + builder.update_submodule(&Path::new("src/llvm-project")); + } } setup(&builder.build.config, self) } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index e7b949c406f95..1d90766fbf18e 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -2108,12 +2108,16 @@ impl Config { llvm::is_ci_llvm_available(&self, asserts) } Some(StringOrBool::String(s)) if s == "if-unchanged" => { - if self - .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) - .is_none() - { - // there are some untracked changes in the the given paths. - false + if !self.rust_info.is_from_tarball() { + if self + .last_modified_commit(&["src/llvm-project"], "download-ci-llvm", true) + .is_none() + { + // there are some untracked changes in the the given paths. + false + } else { + llvm::is_ci_llvm_available(&self, asserts) + } } else { llvm::is_ci_llvm_available(&self, asserts) }