From 597278e0d17a6ee1e750b26d67043118ed531ba6 Mon Sep 17 00:00:00 2001 From: jaby Date: Mon, 9 Oct 2023 21:49:40 +0200 Subject: [PATCH] Use new build scripts --- src/Tools/Tools.code-workspace | 208 +++++++++++++++++---------------- src/Tools/build_all.bat | 38 +++--- src/Tools/build_all.sh | 6 +- src/Tools/run_cargo.bat | 114 +++++++++--------- 4 files changed, 188 insertions(+), 178 deletions(-) diff --git a/src/Tools/Tools.code-workspace b/src/Tools/Tools.code-workspace index 98b8f191..f45ceabe 100644 --- a/src/Tools/Tools.code-workspace +++ b/src/Tools/Tools.code-workspace @@ -1,100 +1,110 @@ -{ - "folders": [ - { - "path": "." - } - ], - "settings": { - }, - "tasks": { - "version": "2.0.0", - "tasks": [ - { - "label": "all", - "type": "shell", - "command": "./build_all.bat ${input:cargo cmd}", - "group": { - "kind": "build" - }, - "options": { - "env": { - "win_tools": "psxcdgen psxcdgen_ex psxcdread psxreadmap wslpath", - "linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay wslpath", - "clean_tools": "cdtypes tool_helper" - } - } - }, - { - "label": "cargo", - "type": "shell", - "command": "./run_cargo ${input:project} ${input:cargo cmd} ${input:build cfg} ${input:cargo target}", - "group": { - "kind": "build", - }, - "options": { - "env": { - "CARGO_RUN_ARGS": "${input:cargo run args}" - } - } - }, - { - "label": "cargo test", - "type": "shell", - "command": "./run_cargo ${input:project} test release ${input:cargo target}" - }, - { - "label": "run test make", - "type": "shell", - "command": "wsl make -f Test.mk test_${input:project}", - "group": { - "kind": "build", - }, - "options": { - "cwd": "${workspaceFolder}/Tests" - }, - "dependsOn": ["cargo test"], - "dependsOrder": "sequence" - } - ], - "inputs": [ - { - "id": "build cfg", - "type": "pickString", - "options": ["debug", "release"], - "default": "release", - "description": "build configuration" - }, - { - "id": "project", - "type": "pickString", - "options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"], - "description": "project to build" - }, - { - "id": "cargo cmd", - "type":"pickString", - "options": ["build", "check", "update", "clean", "run"], - "default": "build", - "description": "cargo command to run" - }, - { - "id": "cargo target", - "type": "pickString", - "options": ["windows", "linux"], - "description": "The target for the tool to build" - }, - { - "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" - } - ] - } +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + }, + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "label": "all", + "type": "shell", + "windows": { + "command": "./build_all.bat ${input:cargo cmd}" + }, + "linux": { + "command": "./build_all.sh ${input:cargo cmd}" + }, + "group": { + "kind": "build" + }, + "options": { + "env": { + "win_tools": "psxcdgen_ex psxcdread psxreadmap wslpath", + "linux_tools": "cpp_out psxcdgen_ex jaby_engine_fconv mkoverlay", + "clean_tools": "cdtypes tool_helper" + } + } + }, + { + "label": "cargo", + "type": "shell", + "windows": { + "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}", + }, + "group": { + "kind": "build", + }, + "options": { + "env": { + "CARGO_RUN_ARGS": "${input:cargo run args}" + } + } + }, + { + "label": "cargo test", + "type": "shell", + "command": "./run_cargo ${input:project} test release ${input:cargo target}" + }, + { + "label": "run test make", + "type": "shell", + "command": "wsl make -f Test.mk test_${input:project}", + "group": { + "kind": "build", + }, + "options": { + "cwd": "${workspaceFolder}/Tests" + }, + "dependsOn": ["cargo test"], + "dependsOrder": "sequence" + } + ], + "inputs": [ + { + "id": "build cfg", + "type": "pickString", + "options": ["debug", "release"], + "default": "release", + "description": "build configuration" + }, + { + "id": "project", + "type": "pickString", + "options": ["cdtypes", "cpp_out", "jaby_engine_fconv", "mkoverlay", "psxreadmap", "psxcdgen", "psxcdgen_ex", "psxcdread", "tool_helper", "wslpath"], + "description": "project to build" + }, + { + "id": "cargo cmd", + "type":"pickString", + "options": ["build", "check", "update", "clean", "run"], + "default": "build", + "description": "cargo command to run" + }, + { + "id": "cargo target", + "type": "pickString", + "options": ["windows", "linux"], + "description": "The target for the tool to build" + }, + { + "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" + } + ] + } } \ No newline at end of file diff --git a/src/Tools/build_all.bat b/src/Tools/build_all.bat index d50a8647..fd823904 100644 --- a/src/Tools/build_all.bat +++ b/src/Tools/build_all.bat @@ -1,20 +1,20 @@ -@echo off -setlocal EnableDelayedExpansion -rem build_all {build|check|clean} - -if %1 == clean ( - for %%a in (%clean_tools%) do ( - call .\run_cargo %%a %1 release windows - cd %cur_dir% - ) -) - -for %%a in (%win_tools%) do ( - call .\run_cargo %%a %1 release windows - cd %cur_dir% -) - -for %%a in (%linux_tools%) do ( - call .\run_cargo %%a %1 release linux - cd %cur_dir% +@echo off +setlocal EnableDelayedExpansion +rem build_all {build|check|clean} + +if %1 == clean ( + for %%a in (%clean_tools%) do ( + call .\run_cargo %%a %1 release windows + cd %cur_dir% + ) +) + +for %%a in (%win_tools%) do ( + call .\run_cargo %%a %1 release windows + cd %cur_dir% +) + +for %%a in (%linux_tools%) do ( + call .\run_cargo %%a %1 release linux + cd %cur_dir% ) \ No newline at end of file diff --git a/src/Tools/build_all.sh b/src/Tools/build_all.sh index e8fbd571..03d49384 100644 --- a/src/Tools/build_all.sh +++ b/src/Tools/build_all.sh @@ -2,11 +2,11 @@ # build_all {build|check|clean} if [ $1 = clean ]; then - all_project=$win_tools $linux_tools $clean_tools + all_project="$win_tools $linux_tools $clean_tools" else - all_project=$win_tools $linux_tools + all_project="$win_tools $linux_tools" fi for prj in ${all_project[@]}; do - source run_cargo.sh $prj $1 release + ./run_cargo.sh $prj $1 release done \ No newline at end of file diff --git a/src/Tools/run_cargo.bat b/src/Tools/run_cargo.bat index 301fb7ba..4dc7601a 100644 --- a/src/Tools/run_cargo.bat +++ b/src/Tools/run_cargo.bat @@ -1,58 +1,58 @@ -@echo off -setlocal EnableDelayedExpansion -rem run_cargo.bat project {build|check|clean} {debug|release} [linux|windows] - -set org_dir=%cd% -set target=x86_64-pc-windows-msvc -set wsl= - -IF %4 == linux ( - wsl --shell-type login ./run_cargo.sh %1 %2 %3 - exit /B %ERRORLEVEL% -) - -IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS% - -cd %1 -IF %2 == build ( - echo cargo build %1 --%3 - %wsl%cargo build --%3 --target=%target% - - IF %ERRORLEVEL% == 0 ( - xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y - ) - - exit /B %ERRORLEVEL% -) - -IF %2 == run ( - echo cargo run %1 --%3 - %wsl%cargo run --%3 --target=%target% %run_args% - - exit /B %ERRORLEVEL% -) - -IF %2 == check ( - echo cargo check %1 --%3 - %wsl%cargo check --%3 --target=%target% - - exit /B %ERRORLEVEL% -) - -IF %2 == clean ( - echo cargo clean %1 - %wsl%cargo clean - rem We do not delete the bin folder anymore - is kinda to much - rem @del %org_dir%\..\..\bin\%1%bin_ext% - - exit /B %ERRORLEVEL% -) - -IF %2 == update ( - echo cargo update %1 - %wsl%cargo update - - exit /B %ERRORLEVEL% -) - +@echo off +setlocal EnableDelayedExpansion +rem run_cargo.bat project {build|check|clean} {debug|release} [linux|windows] + +set org_dir=%cd% +set target=x86_64-pc-windows-msvc +set wsl= + +IF %4 == linux ( + wsl --shell-type login ./run_cargo.sh %1 %2 %3 + exit /B %ERRORLEVEL% +) + +IF defined CARGO_RUN_ARGS set run_args=-- %CARGO_RUN_ARGS% + +cd %1 +IF %2 == build ( + echo cargo build %1 --%3 + %wsl%cargo build --%3 --target=%target% + + IF %ERRORLEVEL% == 0 ( + xcopy target\%target%\%3\%1.exe %org_dir%\..\..\bin /y + ) + + exit /B %ERRORLEVEL% +) + +IF %2 == run ( + echo cargo run %1 --%3 + %wsl%cargo run --%3 --target=%target% %run_args% + + exit /B %ERRORLEVEL% +) + +IF %2 == check ( + echo cargo check %1 --%3 + %wsl%cargo check --%3 --target=%target% + + exit /B %ERRORLEVEL% +) + +IF %2 == clean ( + echo cargo clean %1 + %wsl%cargo clean + rem We do not delete the bin folder anymore - is kinda to much + rem @del %org_dir%\..\..\bin\%1%bin_ext% + + exit /B %ERRORLEVEL% +) + +IF %2 == update ( + echo cargo update %1 + %wsl%cargo update + + exit /B %ERRORLEVEL% +) + echo "Unkown cargo command "%2" for project "%1" \ No newline at end of file