#![allow(clippy::print_stdout)]
use std::process::{exit, Command};
fn run(cmd: &str, args: &[&str]) -> bool {
Command::new(cmd)
.args(args)
.status()
.is_ok_and(|s| s.success())
}
fn main() {
let fmt_ok = run("cargo", &["fmt", "--all", "--check"]);
let lint_ok = run(
"cargo",
&[
"clippy",
"--workspace",
"--all-features",
"--",
"-D",
"warnings",
],
);
let test_ok = run("cargo", &["test", "--workspace", "--all-features"]);
let hard_ok = fmt_ok && lint_ok && test_ok;
let receipts_exist = std::fs::read_dir("receipts").is_ok_and(|mut d| d.next().is_some());
if !hard_ok {
eprintln!("[DOD] HARD FAILURE: fmt={fmt_ok} lint={lint_ok} test={test_ok}");
exit(2);
}
if !receipts_exist {
eprintln!("[DOD] SOFT FAILURE: receipts/ missing or empty");
exit(1);
}
println!("[DOD] ALL PASS");
exit(0);
}