Use cargo in y.sh
This will allow adding dependencies to the build system in the future.
This commit is contained in:
parent
2df34f9091
commit
cfc919f532
6 changed files with 11 additions and 18 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,8 +1,4 @@
|
||||||
# Build artifacts during normal use
|
# Build artifacts during normal use
|
||||||
/y.bin
|
|
||||||
/y.bin.dSYM
|
|
||||||
/y.exe
|
|
||||||
/y.pdb
|
|
||||||
/download
|
/download
|
||||||
/build
|
/build
|
||||||
/dist
|
/dist
|
||||||
|
|
|
@ -11,3 +11,6 @@ path = "main.rs"
|
||||||
unstable-features = [] # for rust-analyzer
|
unstable-features = [] # for rust-analyzer
|
||||||
|
|
||||||
# Do not add any dependencies
|
# Do not add any dependencies
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
debug = 1
|
||||||
|
|
|
@ -147,9 +147,11 @@ fn main() {
|
||||||
|
|
||||||
let rustup_toolchain_name = match (env::var("CARGO"), env::var("RUSTC"), env::var("RUSTDOC")) {
|
let rustup_toolchain_name = match (env::var("CARGO"), env::var("RUSTC"), env::var("RUSTDOC")) {
|
||||||
(Ok(_), Ok(_), Ok(_)) => None,
|
(Ok(_), Ok(_), Ok(_)) => None,
|
||||||
(Err(_), Err(_), Err(_)) => Some(rustc_info::get_toolchain_name()),
|
(_, Err(_), Err(_)) => Some(rustc_info::get_toolchain_name()),
|
||||||
_ => {
|
vars => {
|
||||||
eprintln!("All of CARGO, RUSTC and RUSTDOC need to be set or none must be set");
|
eprintln!(
|
||||||
|
"If RUSTC or RUSTDOC is set, both need to be set and in addition CARGO needs to be set: {vars:?}"
|
||||||
|
);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
4
y.cmd
4
y.cmd
|
@ -1,8 +1,6 @@
|
||||||
@echo off
|
@echo off
|
||||||
echo [BUILD] build system >&2
|
echo [BUILD] build system >&2
|
||||||
mkdir build 2>nul
|
cargo run --manifest-path build_system/Cargo.toml -- %* || goto :error
|
||||||
rustc build_system/main.rs -o build\y.exe -Cdebuginfo=1 --edition 2021 || goto :error
|
|
||||||
build\y.exe %* || goto :error
|
|
||||||
goto :EOF
|
goto :EOF
|
||||||
|
|
||||||
:error
|
:error
|
||||||
|
|
7
y.ps1
Normal file → Executable file
7
y.ps1
Normal file → Executable file
|
@ -1,12 +1,7 @@
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
$host.ui.WriteErrorLine("[BUILD] build system")
|
$host.ui.WriteErrorLine("[BUILD] build system")
|
||||||
New-Item -ItemType Directory -Force -Path build | Out-Null
|
& cargo run --manifest-path build_system/Cargo.toml -- $args
|
||||||
& rustc build_system/main.rs -o build\y.exe -Cdebuginfo=1 --edition 2021
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
|
||||||
exit $LASTEXITCODE
|
|
||||||
}
|
|
||||||
& build\y.exe $args
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
exit $LASTEXITCODE
|
exit $LASTEXITCODE
|
||||||
}
|
}
|
||||||
|
|
3
y.sh
3
y.sh
|
@ -2,5 +2,4 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
echo "[BUILD] build system" 1>&2
|
echo "[BUILD] build system" 1>&2
|
||||||
rustc build_system/main.rs -o y.bin -Cdebuginfo=1 --edition 2021
|
exec cargo run --manifest-path build_system/Cargo.toml -- "$@"
|
||||||
exec ./y.bin "$@"
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue