From 05f53637e99e9874e63749124716a770fd58fd43 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 31 Aug 2026 00:15:14 +0200 Subject: build: add cargo aliases for doing fast compilation --- .cargo/config.toml | 5 +++++ Cargo.lock | 4 ++++ Cargo.toml | 2 +- xtask/Cargo.toml | 6 ++++++ xtask/src/main.rs | 24 ++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 xtask/Cargo.toml create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index af130b7..eed713a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,8 @@ +[alias] +fcheck = "run -p xtask -- execute cargo +nightly check --config .cargo/config-nightly-fast-compile.toml" +fbuild = "run -p xtask -- execute cargo +nightly build --config .cargo/config-nightly-fast-compile.toml" +frun = "run -p xtask -- execute cargo +nightly run --config .cargo/config-nightly-fast-compile.toml" + [env] SLANG_USE_PREBUILT = "1" diff --git a/Cargo.lock b/Cargo.lock index 6b2d0f2..7dc3324 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3147,6 +3147,10 @@ version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4" +[[package]] +name = "xtask" +version = "0.1.0" + [[package]] name = "zerocopy" version = "0.8.42" diff --git a/Cargo.toml b/Cargo.toml index 4eaf692..55fe089 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [workspace] -members = ["engine*", "util-macros", "opengl-bindings"] +members = ["engine*", "util-macros", "opengl-bindings", "xtask"] [workspace.dependencies] engine = { path = "engine" } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml new file mode 100644 index 0000000..337bfe3 --- /dev/null +++ b/xtask/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "xtask" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/xtask/src/main.rs b/xtask/src/main.rs new file mode 100644 index 0000000..e955925 --- /dev/null +++ b/xtask/src/main.rs @@ -0,0 +1,24 @@ +use std::process::Command; + +fn main() +{ + let mut args = std::env::args(); + + let Some(task) = args.nth(1) else { + println!("Error: No task is specified"); + return; + }; + + if task == "execute" { + let Some(program) = args.next() else { + println!("Error: No program is specified"); + return; + }; + + if let Err(err) = Command::new(program).args(args).status() { + println!("Error: Failed to execute command: {err}"); + } + } else { + println!("Error: Unknown task '{task}'"); + } +} -- cgit v1.2.3-18-g5258