Skip to content

Commit

Permalink
Merge pull request #344 from GuillaumeGomez/improvements
Browse files Browse the repository at this point in the history
Improve y.sh script (to potentially allow dependencies) and improve `build_system` help message
  • Loading branch information
antoyo authored Sep 25, 2023
2 parents 2e585e8 + 6be1f36 commit 71febd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 11 additions & 1 deletion build_system/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ mod utils;
macro_rules! arg_error {
($($err:tt)*) => {{
eprintln!($($err)*);
eprintln!();
usage();
std::process::exit(1);
}};
}

fn usage() {
// println!("{}", include_str!("usage.txt"));
println!("\
Available commands for build_system:
prepare : Run prepare command
build : Run build command
--help : Show this message");
}

pub enum Command {
Expand All @@ -31,6 +37,10 @@ fn main() {
let command = match env::args().nth(1).as_deref() {
Some("prepare") => Command::Prepare,
Some("build") => Command::Build,
Some("--help") => {
usage();
process::exit(0);
}
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
Some(command) => arg_error!("Unknown command {}", command),
None => {
Expand Down
7 changes: 4 additions & 3 deletions y.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -e
echo "[BUILD] build system" 1>&2
mkdir -p build_system/target
rustc build_system/src/main.rs -o build_system/target/y -Cdebuginfo=1 --edition 2021
exec ./build_system/target/y "$@"
cd build_system
cargo build --release
cd ..
./build_system/target/release/y $@

0 comments on commit 71febd9

Please sign in to comment.