warn when there's a newer version of the x tool available
This commit is contained in:
parent
726bbfc8f0
commit
c49555821f
@ -69,3 +69,4 @@ pub mod ui_tests;
|
|||||||
pub mod unit_tests;
|
pub mod unit_tests;
|
||||||
pub mod unstable_book;
|
pub mod unstable_book;
|
||||||
pub mod walk;
|
pub mod walk;
|
||||||
|
pub mod x;
|
||||||
|
@ -53,6 +53,21 @@ fn main() {
|
|||||||
VecDeque::with_capacity(concurrency.get());
|
VecDeque::with_capacity(concurrency.get());
|
||||||
|
|
||||||
macro_rules! check {
|
macro_rules! check {
|
||||||
|
($p:ident) => {
|
||||||
|
while handles.len() >= concurrency.get() {
|
||||||
|
handles.pop_front().unwrap().join().unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
let handle = s.spawn(|| {
|
||||||
|
let mut flag = false;
|
||||||
|
$p::check(&mut flag);
|
||||||
|
if (flag) {
|
||||||
|
bad.store(true, Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
handles.push_back(handle);
|
||||||
|
};
|
||||||
|
|
||||||
($p:ident $(, $args:expr)* ) => {
|
($p:ident $(, $args:expr)* ) => {
|
||||||
drain_handles(&mut handles);
|
drain_handles(&mut handles);
|
||||||
|
|
||||||
@ -64,7 +79,8 @@ fn main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
handles.push_back(handle);
|
handles.push_back(handle);
|
||||||
}
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check!(target_specific_tests, &src_path);
|
check!(target_specific_tests, &src_path);
|
||||||
@ -107,6 +123,8 @@ fn main() {
|
|||||||
check!(alphabetical, &compiler_path);
|
check!(alphabetical, &compiler_path);
|
||||||
check!(alphabetical, &library_path);
|
check!(alphabetical, &library_path);
|
||||||
|
|
||||||
|
check!(x);
|
||||||
|
|
||||||
let collected = {
|
let collected = {
|
||||||
drain_handles(&mut handles);
|
drain_handles(&mut handles);
|
||||||
|
|
||||||
|
19
src/tools/tidy/src/x.rs
Normal file
19
src/tools/tidy/src/x.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
pub fn check(_bad: &mut bool) {
|
||||||
|
let result = Command::new("x")
|
||||||
|
.arg("--version")
|
||||||
|
.output();
|
||||||
|
let output = match result {
|
||||||
|
Ok(output) => output,
|
||||||
|
Err(_e) => todo!(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if output.status.success() {
|
||||||
|
let version = String::from_utf8_lossy(&output.stdout);
|
||||||
|
assert_eq!("0.1.0", version.trim_end());
|
||||||
|
}
|
||||||
|
// FIXME: throw some kind of tidy error when the version of x isn't
|
||||||
|
// greater than or equal to the version we'd expect.
|
||||||
|
//tidy_error!(bad, "Current version of x is {version} Consider updating to the newer version of x by running `cargo install --path src/tools/x`")
|
||||||
|
}
|
@ -52,6 +52,14 @@ fn exec_or_status(command: &mut Command) -> io::Result<ExitStatus> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
match env::args().skip(1).next().as_deref() {
|
||||||
|
Some("--version") => {
|
||||||
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
|
println!("{}", version);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
let current = match env::current_dir() {
|
let current = match env::current_dir() {
|
||||||
Ok(dir) => dir,
|
Ok(dir) => dir,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user