docs/alpha-checklist.md turns the six alpha workflows into manual steps for Windows and macOS (action, expected result, a box per platform, about 40 minutes each) and says how to report a failure. cargo xtask demo-project DIR creates the offline demo the steps run against: a small PHP shop (classes, an interface, a function, one deliberate error), a history by three authors from 2024 to 2026 with a merged branch and a tag, the branch feature/discounts that conflicts with main, and a bare origin.git holding a remote-only branch and one commit the project has not fetched yet. Tested against real git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.6 KiB
Rust
77 lines
2.6 KiB
Rust
//! Project automation for Lutra, run as `cargo xtask <command>`.
|
|
//!
|
|
//! Every subcommand prints what it checks and exits with status 1 and a
|
|
//! message when the check fails.
|
|
|
|
mod assets;
|
|
mod cleanroom;
|
|
mod demo;
|
|
mod layers;
|
|
mod licences;
|
|
mod lints;
|
|
mod macreport;
|
|
mod tasks;
|
|
mod util;
|
|
|
|
use std::process::ExitCode;
|
|
|
|
/// Usage text printed for `help` and unknown subcommands.
|
|
const USAGE: &str = concat!(
|
|
"usage: cargo xtask <command>
|
|
|
|
commands:
|
|
ci [--skip-ui] the full quality gate (run before every commit)
|
|
layers check the crate layering
|
|
assets check that every asset has a row in ASSETS.md
|
|
cleanroom check for JetBrains copyright notices and exported configuration
|
|
ui-licences check the licences of the frontend's production dependencies
|
|
lints-selftest prove that shipped unwrap() fails clippy and test unwrap() passes
|
|
dev [-- ARGS] run the desktop app in development mode, ARGS go to the app
|
|
fixtures create Symfony and Laravel reference projects in target/fixtures/
|
|
demo-project DIR create the offline demo for docs/alpha-checklist.md in DIR
|
|
",
|
|
"mac-report [--skip-gate] [--port PORT] [--out DIR]
|
|
check this machine end to end and write one report file
|
|
(default target/mac-report/report.md, port 7971)"
|
|
);
|
|
|
|
/// Dispatches to the subcommand named by the first argument.
|
|
fn main() -> ExitCode {
|
|
let args: Vec<String> = std::env::args().skip(1).collect();
|
|
let Some((command, rest)) = args.split_first() else {
|
|
println!("{USAGE}");
|
|
return ExitCode::SUCCESS;
|
|
};
|
|
let result = match command.as_str() {
|
|
"ci" => tasks::ci(rest.iter().any(|a| a == "--skip-ui")),
|
|
"layers" => layers::check_workspace(),
|
|
"assets" => assets::check_repo(),
|
|
"cleanroom" => cleanroom::check_repo(),
|
|
"ui-licences" => licences::check_ui(),
|
|
"lints-selftest" => lints::selftest(),
|
|
"dev" => {
|
|
let app_args: Vec<String> = rest
|
|
.iter()
|
|
.skip_while(|a| *a != "--")
|
|
.skip(1)
|
|
.cloned()
|
|
.collect();
|
|
tasks::dev(&app_args)
|
|
}
|
|
"fixtures" => tasks::fixtures(),
|
|
"demo-project" => demo::run(rest),
|
|
"mac-report" => macreport::parse(rest).and_then(|o| macreport::mac_report(&o)),
|
|
"help" | "--help" | "-h" => {
|
|
println!("{USAGE}");
|
|
Ok(())
|
|
}
|
|
other => Err(format!("unknown command `{other}`\n\n{USAGE}")),
|
|
};
|
|
match result {
|
|
Ok(()) => ExitCode::SUCCESS,
|
|
Err(message) => {
|
|
eprintln!("xtask: {message}");
|
|
ExitCode::FAILURE
|
|
}
|
|
}
|
|
}
|