Skip to content

Commit

Permalink
Including the case of building from tarball source.
Browse files Browse the repository at this point in the history
fmt code
  • Loading branch information
LuuuXXX committed Nov 7, 2023
1 parent 658435b commit 4c0d9b9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 8 additions & 2 deletions src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
16 changes: 10 additions & 6 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4c0d9b9

Please sign in to comment.