Skip to content

Commit 71febd9

Browse files
authored
Merge pull request #344 from GuillaumeGomez/improvements
Improve y.sh script (to potentially allow dependencies) and improve `build_system` help message
2 parents 2e585e8 + 6be1f36 commit 71febd9

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

build_system/src/main.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ mod utils;
99
macro_rules! arg_error {
1010
($($err:tt)*) => {{
1111
eprintln!($($err)*);
12+
eprintln!();
1213
usage();
1314
std::process::exit(1);
1415
}};
1516
}
1617

1718
fn usage() {
18-
// println!("{}", include_str!("usage.txt"));
19+
println!("\
20+
Available commands for build_system:
21+
22+
prepare : Run prepare command
23+
build : Run build command
24+
--help : Show this message");
1925
}
2026

2127
pub enum Command {
@@ -31,6 +37,10 @@ fn main() {
3137
let command = match env::args().nth(1).as_deref() {
3238
Some("prepare") => Command::Prepare,
3339
Some("build") => Command::Build,
40+
Some("--help") => {
41+
usage();
42+
process::exit(0);
43+
}
3444
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
3545
Some(command) => arg_error!("Unknown command {}", command),
3646
None => {

y.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

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

0 commit comments

Comments
 (0)