Use new build scripts

This commit is contained in:
Jaby 2023-10-09 21:49:40 +02:00
parent 082baa0657
commit a16d0c10dc
4 changed files with 188 additions and 178 deletions

View File

@ -1,100 +1,110 @@
{ {
"folders": [ "folders": [
{ {
"path": "." "path": "."
} }
], ],
"settings": { "settings": {
}, },
"tasks": { "tasks": {
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "all", "label": "all",
"type": "shell", "type": "shell",
"command": "./build_all.bat ${input:cargo cmd}", "windows": {
"group": { "command": "./build_all.bat ${input:cargo cmd}"
"kind": "build" },
}, "linux": {
"options": { "command": "./build_all.sh ${input:cargo cmd}"
"env": { },
"win_tools": "psxcdgen psxcdgen_ex psxcdread psxreadmap wslpath", "group": {
"linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay wslpath", "kind": "build"
"clean_tools": "cdtypes tool_helper" },
} "options": {
} "env": {
}, "win_tools": "psxcdgen_ex psxcdread psxreadmap wslpath",
{ "linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay",
"label": "cargo", "clean_tools": "cdtypes tool_helper"
"type": "shell", }
"command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}", }
"group": { },
"kind": "build", {
}, "label": "cargo",
"options": { "type": "shell",
"env": { "windows": {
"CARGO_RUN_ARGS": "${input:cargo run args}" "command": "./run_cargo.bat ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
} },
} "linux": {
}, "command": "./run_cargo.sh ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}",
{ },
"label": "cargo test", "group": {
"type": "shell", "kind": "build",
"command": "./run_cargo ${input:project} test release ${input:cargo target}" },
}, "options": {
{ "env": {
"label": "run test make", "CARGO_RUN_ARGS": "${input:cargo run args}"
"type": "shell", }
"command": "wsl make -f Test.mk test_${input:project}", }
"group": { },
"kind": "build", {
}, "label": "cargo test",
"options": { "type": "shell",
"cwd": "${workspaceFolder}/Tests" "command": "./run_cargo ${input:project} test release ${input:cargo target}"
}, },
"dependsOn": ["cargo test"], {
"dependsOrder": "sequence" "label": "run test make",
} "type": "shell",
], "command": "wsl make -f Test.mk test_${input:project}",
"inputs": [ "group": {
{ "kind": "build",
"id": "build cfg", },
"type": "pickString", "options": {
"options": ["debug", "release"], "cwd": "${workspaceFolder}/Tests"
"default": "release", },
"description": "build configuration" "dependsOn": ["cargo test"],
}, "dependsOrder": "sequence"
{ }
"id": "project", ],
"type": "pickString", "inputs": [
"options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"], {
"description": "project to build" "id": "build cfg",
}, "type": "pickString",
{ "options": ["debug", "release"],
"id": "cargo cmd", "default": "release",
"type":"pickString", "description": "build configuration"
"options": ["build", "check", "update", "clean", "run"], },
"default": "build", {
"description": "cargo command to run" "id": "project",
}, "type": "pickString",
{ "options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"],
"id": "cargo target", "description": "project to build"
"type": "pickString", },
"options": ["windows", "linux"], {
"description": "The target for the tool to build" "id": "cargo cmd",
}, "type":"pickString",
{ "options": ["build", "check", "update", "clean", "run"],
"id": "cargo run args", "default": "build",
"type": "pickString", "description": "cargo command to run"
"options": [ },
"", {
"--help", "id": "cargo target",
"--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml", "type": "pickString",
"--wsl -o Planschbecken.bin ../../../examples/PoolBox/application/bin/PSX-release/PoolBox.elf" "options": ["windows", "linux"],
], "description": "The target for the tool to build"
"default": "", },
"description": "Argument options to pass to cargo run" {
} "id": "cargo run args",
] "type": "pickString",
} "options": [
"",
"--help",
"--list -o ../Tests/Test_Planschbecken psx bin-cue ../Tests/ISO_Planschbecken.xml",
"--wsl -o Planschbecken.bin ../../../examples/PoolBox/application/bin/PSX-release/PoolBox.elf"
],
"default": "",
"description": "Argument options to pass to cargo run"
}
]
}
} }

View File

@ -1,20 +1,20 @@
@echo off @echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
rem build_all {build|check|clean} rem build_all {build|check|clean}
if %1 == clean ( if %1 == clean (
for %%a in (%clean_tools%) do ( for %%a in (%clean_tools%) do (
call .\run_cargo %%a %1 release windows call .\run_cargo %%a %1 release windows
cd %cur_dir% cd %cur_dir%
) )
) )
for %%a in (%win_tools%) do ( for %%a in (%win_tools%) do (
call .\run_cargo %%a %1 release windows call .\run_cargo %%a %1 release windows
cd %cur_dir% cd %cur_dir%
) )
for %%a in (%linux_tools%) do ( for %%a in (%linux_tools%) do (
call .\run_cargo %%a %1 release linux call .\run_cargo %%a %1 release linux
cd %cur_dir% cd %cur_dir%
) )

View File

@ -2,11 +2,11 @@
# build_all {build|check|clean} # build_all {build|check|clean}
if [ $1 = clean ]; then if [ $1 = clean ]; then
all_project=$win_tools $linux_tools $clean_tools all_project="$win_tools $linux_tools $clean_tools"
else else
all_project=$win_tools $linux_tools all_project="$win_tools $linux_tools"
fi fi
for prj in ${all_project[@]}; do for prj in ${all_project[@]}; do
source run_cargo.sh $prj $1 release ./run_cargo.sh $prj $1 release
done done

View File

@ -1,58 +1,58 @@
@echo off @echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
rem run_cargo.bat project {build|check|clean} {debug|release} [linux|windows] rem run_cargo.bat project {build|check|clean} {debug|release} [linux|windows]
set org_dir=%cd% set org_dir=%cd%
set target=x86_64-pc-windows-msvc set target=x86_64-pc-windows-msvc
set wsl= set wsl=
IF %4 == linux ( IF %4 == linux (
wsl --shell-type login ./run_cargo.sh %1 %2 %3 wsl --shell-type login ./run_cargo.sh %1 %2 %3
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS% IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS%
cd %1 cd %1
IF %2 == build ( IF %2 == build (
echo cargo build %1 --%3 echo cargo build %1 --%3
%wsl%cargo build --%3 --target=%target% %wsl%cargo build --%3 --target=%target%
IF %ERRORLEVEL% == 0 ( IF %ERRORLEVEL% == 0 (
xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y
) )
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == run ( IF %2 == run (
echo cargo run %1 --%3 echo cargo run %1 --%3
%wsl%cargo run --%3 --target=%target% %run_args% %wsl%cargo run --%3 --target=%target% %run_args%
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == check ( IF %2 == check (
echo cargo check %1 --%3 echo cargo check %1 --%3
%wsl%cargo check --%3 --target=%target% %wsl%cargo check --%3 --target=%target%
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == clean ( IF %2 == clean (
echo cargo clean %1 echo cargo clean %1
%wsl%cargo clean %wsl%cargo clean
rem We do not delete the bin folder anymore - is kinda to much rem We do not delete the bin folder anymore - is kinda to much
rem @del %org_dir%\..\..\bin\%1%bin_ext% rem @del %org_dir%\..\..\bin\%1%bin_ext%
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
IF %2 == update ( IF %2 == update (
echo cargo update %1 echo cargo update %1
%wsl%cargo update %wsl%cargo update
exit /B %ERRORLEVEL% exit /B %ERRORLEVEL%
) )
echo "Unkown cargo command "%2" for project "%1" echo "Unkown cargo command "%2" for project "%1"