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
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,8 +1,4 @@
|
||||
# Build artifacts during normal use
|
||||
/y.bin
|
||||
/y.bin.dSYM
|
||||
/y.exe
|
||||
/y.pdb
|
||||
/download
|
||||
/build
|
||||
/dist
|
||||
|
@ -11,3 +11,6 @@ path = "main.rs"
|
||||
unstable-features = [] # for rust-analyzer
|
||||
|
||||
# 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")) {
|
||||
(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);
|
||||
}
|
||||
};
|
||||
|
4
y.cmd
4
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
|
||||
|
7
y.ps1
Normal file → Executable file
7
y.ps1
Normal file → Executable file
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user