Skip to content

Commit 74bfa66

Browse files
committed
simplify force-recompile logic for "library"
Signed-off-by: onur-ozkan <[email protected]>
1 parent a826133 commit 74bfa66

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

Diff for: src/bootstrap/src/core/build_steps/compile.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use std::path::{Path, PathBuf};
1515
use std::process::Stdio;
1616
use std::{env, fs, str};
1717

18-
use build_helper::git::get_closest_merge_commit;
1918
use serde_derive::Deserialize;
2019

2120
use crate::core::build_steps::tool::SourceType;
@@ -27,7 +26,7 @@ use crate::core::builder::{
2726
use crate::core::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection};
2827
use crate::utils::exec::command;
2928
use crate::utils::helpers::{
30-
self, exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
29+
exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
3130
};
3231
use crate::{CLang, Compiler, DependencyType, GitRepo, LLVM_TOOLS, Mode};
3332

@@ -125,23 +124,9 @@ impl Step for Std {
125124
// Force compilation of the standard library from source if the `library` is modified. This allows
126125
// library team to compile the standard library without needing to compile the compiler with
127126
// the `rust.download-rustc=true` option.
128-
let force_recompile =
129-
if builder.rust_info().is_managed_git_subrepository() && builder.download_rustc() {
130-
let closest_merge_commit =
131-
get_closest_merge_commit(Some(&builder.src), &builder.config.git_config(), &[])
132-
.unwrap();
133-
134-
// Check if `library` has changes (returns false otherwise)
135-
!t!(helpers::git(Some(&builder.src))
136-
.args(["diff-index", "--quiet", &closest_merge_commit])
137-
.arg("--")
138-
.arg("library")
139-
.as_command_mut()
140-
.status())
141-
.success()
142-
} else {
143-
false
144-
};
127+
let force_recompile = builder.rust_info().is_managed_git_subrepository()
128+
&& builder.download_rustc()
129+
&& builder.config.last_modified_commit(&["library"], "download-rustc", true).is_none();
145130

146131
run.builder.ensure(Std {
147132
compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),

0 commit comments

Comments
 (0)