diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-05-12 12:47:09 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-05-12 12:59:10 +0000 |
| commit | cfc919f5320e9fb59745653dd16e28acdf6ab05e (patch) | |
| tree | ac9c352dac916d3b4837683281c0a4a7127c0732 | |
| parent | 2df34f9091c7b87b8a6755a041b4358a606cac43 (diff) | |
Use cargo in y.sh
This will allow adding dependencies to the build system in the future.
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | build_system/Cargo.toml | 3 | ||||
| -rw-r--r-- | build_system/main.rs | 8 | ||||
| -rw-r--r-- | y.cmd | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | y.ps1 | 7 | ||||
| -rwxr-xr-x | y.sh | 3 |
6 files changed, 11 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index 7915fa138f8..5a38f2acb0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ # Build artifacts during normal use -/y.bin -/y.bin.dSYM -/y.exe -/y.pdb /download /build /dist diff --git a/build_system/Cargo.toml b/build_system/Cargo.toml index f47b9bc5540..feed2b6eafe 100644 --- a/build_system/Cargo.toml +++ b/build_system/Cargo.toml @@ -11,3 +11,6 @@ path = "main.rs" unstable-features = [] # for rust-analyzer # Do not add any dependencies + +[profile.dev] +debug = 1 diff --git a/build_system/main.rs b/build_system/main.rs index cdd2bae03f8..7dbf608f991 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -147,9 +147,11 @@ fn main() { let rustup_toolchain_name = match (env::var("CARGO"), env::var("RUSTC"), env::var("RUSTDOC")) { (Ok(_), Ok(_), Ok(_)) => None, - (Err(_), Err(_), Err(_)) => Some(rustc_info::get_toolchain_name()), - _ => { - eprintln!("All of CARGO, RUSTC and RUSTDOC need to be set or none must be set"); + (_, Err(_), Err(_)) => Some(rustc_info::get_toolchain_name()), + vars => { + eprintln!( + "If RUSTC or RUSTDOC is set, both need to be set and in addition CARGO needs to be set: {vars:?}" + ); process::exit(1); } }; diff --git a/y.cmd b/y.cmd index e9b688645a4..42106849163 100644 --- a/y.cmd +++ b/y.cmd @@ -1,8 +1,6 @@ @echo off echo [BUILD] build system >&2 -mkdir build 2>nul -rustc build_system/main.rs -o build\y.exe -Cdebuginfo=1 --edition 2021 || goto :error -build\y.exe %* || goto :error +cargo run --manifest-path build_system/Cargo.toml -- %* || goto :error goto :EOF :error diff --git a/y.ps1 b/y.ps1 index 02ef0fcbd50..821f0ec6e57 100644..100755 --- a/y.ps1 +++ b/y.ps1 @@ -1,12 +1,7 @@ $ErrorActionPreference = "Stop" $host.ui.WriteErrorLine("[BUILD] build system") -New-Item -ItemType Directory -Force -Path build | Out-Null -& rustc build_system/main.rs -o build\y.exe -Cdebuginfo=1 --edition 2021 -if ($LASTEXITCODE -ne 0) { - exit $LASTEXITCODE -} -& build\y.exe $args +& cargo run --manifest-path build_system/Cargo.toml -- $args if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/y.sh b/y.sh index bc925a23e2a..b9152d2cc6d 100755 --- a/y.sh +++ b/y.sh @@ -2,5 +2,4 @@ set -e echo "[BUILD] build system" 1>&2 -rustc build_system/main.rs -o y.bin -Cdebuginfo=1 --edition 2021 -exec ./y.bin "$@" +exec cargo run --manifest-path build_system/Cargo.toml -- "$@" |
