Add more robust error handling to all the sample build scripts

This commit is contained in:
Caelan Sayler
2025-06-27 10:35:42 +01:00
committed by Caelan
parent 72af62649f
commit 4ba75beea8
15 changed files with 49 additions and 8 deletions

View File

@@ -12,12 +12,17 @@ set "version=%~1"
echo. echo.
echo Compiling velopack_libc... echo Compiling velopack_libc...
cargo build -p velopack_libc cargo build -p velopack_libc
if errorlevel 1 exit /b 1
echo. echo.
echo Compiling VelopackCppWidgets with cmake... echo Compiling VelopackCppWidgets with cmake...
cmake -S . -B build-rel cmake -S . -B build-rel
if errorlevel 1 exit /b 1
cmake --build build-rel -j --config Release cmake --build build-rel -j --config Release
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
vpk pack -u VelopackCppWidgets -o %~dp0releases -p %~dp0build-rel\Release -e main.exe -v %* vpk pack -u VelopackCppWidgets -o %~dp0releases -p %~dp0build-rel\Release -e main.exe -v %*
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Find the absolute path of the script # Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

View File

@@ -15,6 +15,7 @@ if "%~1"=="" (
echo. echo.
echo Building Velopack C Lib with Cargo echo Building Velopack C Lib with Cargo
cargo build -p velopack_libc cargo build -p velopack_libc
if errorlevel 1 exit /b 1
cd %~dp0 cd %~dp0
@@ -39,9 +40,11 @@ echo.
echo Building CppWin32Sample echo Building CppWin32Sample
cd %~dp0 cd %~dp0
"%MSBUILD_PATH%" CppWin32Sample.sln "%MSBUILD_PATH%" CppWin32Sample.sln
if errorlevel 1 exit /b 1
echo #define UPDATE_URL "REPLACE_ME" > constants.h echo #define UPDATE_URL "REPLACE_ME" > constants.h
echo. echo.
echo Building Velopack Release v%~1 echo Building Velopack Release v%~1
vpk pack -u VelopackCppWin32Sample -o releases -p x64\Debug -v %* -e CppWin32Sample.exe vpk pack -u VelopackCppWin32Sample -o releases -p x64\Debug -v %* -e CppWin32Sample.exe
if errorlevel 1 exit /b 1

View File

@@ -12,7 +12,9 @@ set "version=%~1"
echo. echo.
echo Compiling VelopackCSharpAvalonia with dotnet... echo Compiling VelopackCSharpAvalonia with dotnet...
dotnet publish -c Release --no-self-contained -r win-x64 -o %~dp0publish dotnet publish -c Release --no-self-contained -r win-x64 -o %~dp0publish
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
vpk pack -u VelopackCSharpAvalonia -o %~dp0releases -p %~dp0publish -f net8-x64-desktop -v %* vpk pack -u VelopackCSharpAvalonia -o %~dp0releases -p %~dp0publish -f net8-x64-desktop -v %*
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Find the absolute path of the script # Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

View File

@@ -17,10 +17,12 @@ cd %~dp0..\..\..\
echo. echo.
echo Building Velopack Rust echo Building Velopack Rust
cargo build --features windows cargo build --features windows
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Vpk echo Building Velopack Vpk
dotnet build src/vpk/Velopack.Vpk/Velopack.Vpk.csproj dotnet build src/vpk/Velopack.Vpk/Velopack.Vpk.csproj
if errorlevel 1 exit /b 1
cd %~dp0.. cd %~dp0..
set "version=%~1" set "version=%~1"
@@ -28,7 +30,9 @@ set "version=%~1"
echo. echo.
echo Compiling VelopackCSharpAvalonia with dotnet... echo Compiling VelopackCSharpAvalonia with dotnet...
dotnet publish -c Release --self-contained -r win-x64 -o publish -p:UseLocalVelopack=true dotnet publish -c Release --self-contained -r win-x64 -o publish -p:UseLocalVelopack=true
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
%~dp0..\..\..\build\Debug\net8.0\vpk pack -u VelopackCSharpAvalonia -o releases -p publish -v %* %~dp0..\..\..\build\Debug\net8.0\vpk pack -u VelopackCSharpAvalonia -o releases -p publish -v %*
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Find the absolute path of the script # Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

View File

@@ -12,7 +12,9 @@ set "version=%~1"
echo. echo.
echo Compiling CSharpUno with dotnet... echo Compiling CSharpUno with dotnet...
dotnet publish -c Release --framework net9.0-desktop -o %~dp0UnoSample\publish UnoSample\UnoSample.csproj dotnet publish -c Release --framework net9.0-desktop -o %~dp0UnoSample\publish UnoSample\UnoSample.csproj
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
vpk pack -u CSharpUno -v %version% -o %~dp0UnoSample\releases -p %~dp0UnoSample\publish --mainExe UnoSample.exe vpk pack -u CSharpUno -v %version% -o %~dp0UnoSample\releases -p %~dp0UnoSample\publish --mainExe UnoSample.exe
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Check if version parameter is provided # Check if version parameter is provided
if [ "$#" -ne 1 ]; then if [ "$#" -ne 1 ]; then

View File

@@ -12,7 +12,9 @@ set "version=%~1"
echo. echo.
echo Compiling VelopackCSharpWinForms with dotnet... echo Compiling VelopackCSharpWinForms with dotnet...
dotnet publish -c Release -o %~dp0publish dotnet publish -c Release -o %~dp0publish
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
vpk pack -u VelopackCSharpWinForms -v %version% -o %~dp0releases -p %~dp0publish -f net8-x64-desktop vpk pack -u VelopackCSharpWinForms -v %version% -o %~dp0releases -p %~dp0publish -f net8-x64-desktop
if errorlevel 1 exit /b 1

View File

@@ -12,7 +12,9 @@ set "version=%~1"
echo. echo.
echo Compiling VelopackCSharpWpf with dotnet... echo Compiling VelopackCSharpWpf with dotnet...
dotnet publish -c Release -o %~dp0publish dotnet publish -c Release -o %~dp0publish
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%version% echo Building Velopack Release v%version%
vpk pack -u VelopackCSharpWpf -v %version% -o %~dp0releases -p %~dp0publish -f net8-x64-desktop vpk pack -u VelopackCSharpWpf -v %version% -o %~dp0releases -p %~dp0publish -f net8-x64-desktop
if errorlevel 1 exit /b 1

View File

@@ -14,33 +14,41 @@ cd %~dp0..\..\src\lib-nodejs
echo. echo.
echo Running npm install echo Running npm install
call npm install call npm install
if errorlevel 1 exit /b 1
echo. echo.
echo Cleaning lib-nodejs echo Cleaning lib-nodejs
call npm run clean call npm run clean
if errorlevel 1 exit /b 1
echo. echo.
echo Compiling lib-nodejs echo Compiling lib-nodejs
call npm run dev call npm run dev
if errorlevel 1 exit /b 1
echo. echo.
echo Packing lib-nodejs echo Packing lib-nodejs
call npm pack call npm pack
if errorlevel 1 exit /b 1
cd %~dp0 cd %~dp0
echo. echo.
echo Running npm install echo Running npm install
call npm install call npm install
if errorlevel 1 exit /b 1
echo. echo.
echo Installing lib-nodejs package echo Installing lib-nodejs package
call npm install ..\..\src\lib-nodejs\velopack-0.0.0.tgz call npm install ..\..\src\lib-nodejs\velopack-0.0.0.tgz
if errorlevel 1 exit /b 1
echo. echo.
echo Packing with electron-forge echo Packing with electron-forge
call npm run package call npm run package
if errorlevel 1 exit /b 1
echo. echo.
echo Creating Velopack Release echo Creating Velopack Release
call vpk pack -u VelopackElectronSample -v %version% -o %~dp0releases -p %~dp0out\VelopackElectronSample-win32-x64 call vpk pack -u VelopackElectronSample -v %version% -o %~dp0releases -p %~dp0out\VelopackElectronSample-win32-x64
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Find the absolute path of the script # Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

View File

@@ -12,9 +12,16 @@ cd %~dp0
echo. echo.
echo Building Iced/Rust echo Building Iced/Rust
cargo build cargo build
if errorlevel 1 exit /b 1
echo. echo.
echo Building Velopack Release v%~1 echo Building Velopack Release v%~1
mkdir publish mkdir publish
if errorlevel 1 exit /b 1
move target\debug\velorusticedsample.exe publish\velorusticedsample.exe move target\debug\velorusticedsample.exe publish\velorusticedsample.exe
vpk pack -u VeloRustIcedSample -o releases -p publish -v %* if errorlevel 1 exit /b 1
vpk pack -u VeloRustIcedSample -o releases -p publish -v %*
if errorlevel 1 exit /b 1

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
# Find the absolute path of the script # Find the absolute path of the script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"