Skip to content

Commit 7dbfb0a

Browse files
committed
Auto merge of #66681 - Mark-Simulacrum:toolstate-into-bootstrap, r=pietroalbini
Move toolstate checking into bootstrap This intends no functional changes, merely translates the spread of shell/python into Rust. One problematic area that I'd like to avoid but wasn't quite able to figure out how is the master branch script which is still in bash/python -- I cared less about that since it is orthogonal to the actual checking that we're doing, though as-is we're duplicating some code across Rust and that script. r? @kennytm or maybe @pietroalbini
2 parents 8960acf + 97d9364 commit 7dbfb0a

File tree

10 files changed

+445
-266
lines changed

10 files changed

+445
-266
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ impl<'a> Builder<'a> {
368368
check::Rustdoc
369369
),
370370
Kind::Test => describe!(
371+
crate::toolstate::ToolStateCheck,
371372
test::Tidy,
372373
test::Ui,
373374
test::CompileFail,

src/bootstrap/lib.rs

-27
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ mod job {
169169
pub use crate::config::Config;
170170
use crate::flags::Subcommand;
171171
use crate::cache::{Interned, INTERNER};
172-
use crate::toolstate::ToolState;
173172

174173
const LLVM_TOOLS: &[&str] = &[
175174
"llvm-nm", // used to inspect binaries; it shows symbol names, their sizes and visibility
@@ -1074,32 +1073,6 @@ impl Build {
10741073
}
10751074
}
10761075

1077-
/// Updates the actual toolstate of a tool.
1078-
///
1079-
/// The toolstates are saved to the file specified by the key
1080-
/// `rust.save-toolstates` in `config.toml`. If unspecified, nothing will be
1081-
/// done. The file is updated immediately after this function completes.
1082-
pub fn save_toolstate(&self, tool: &str, state: ToolState) {
1083-
if let Some(ref path) = self.config.save_toolstates {
1084-
if let Some(parent) = path.parent() {
1085-
// Ensure the parent directory always exists
1086-
t!(std::fs::create_dir_all(parent));
1087-
}
1088-
let mut file = t!(fs::OpenOptions::new()
1089-
.create(true)
1090-
.read(true)
1091-
.write(true)
1092-
.open(path));
1093-
1094-
let mut current_toolstates: HashMap<Box<str>, ToolState> =
1095-
serde_json::from_reader(&mut file).unwrap_or_default();
1096-
current_toolstates.insert(tool.into(), state);
1097-
t!(file.seek(SeekFrom::Start(0)));
1098-
t!(file.set_len(0));
1099-
t!(serde_json::to_writer(file, &current_toolstates));
1100-
}
1101-
}
1102-
11031076
fn in_tree_crates(&self, root: &str) -> Vec<&Crate> {
11041077
let mut ret = Vec::new();
11051078
let mut list = vec![INTERNER.intern_str(root)];

0 commit comments

Comments
 (0)