From 0b49bd333801557003c5b65309281d06e0c1b60f Mon Sep 17 00:00:00 2001 From: otavepto Date: Tue, 19 Dec 2023 19:58:41 +0200 Subject: [PATCH] + fixed error propagation in Windows build script, apparently set /a var+=another_var works only if another_var is a defined env var but NOT one of the "magic" builtins like errorlevel + output niceness when running protob compiler in Linux build --- build_linux.sh | 6 ++-- build_win.bat | 87 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 55 insertions(+), 38 deletions(-) diff --git a/build_linux.sh b/build_linux.sh index 7f5deeb3..759135e1 100644 --- a/build_linux.sh +++ b/build_linux.sh @@ -374,6 +374,7 @@ rm -f dll/net.pb.cc rm -f dll/net.pb.h echo // invoking protobuf compiler - 32 "$protoc_exe_32" -I./dll/ --cpp_out=./dll/ ./dll/*.proto +echo ; echo ; if [[ "$BUILD_LIB32" = "1" ]]; then echo // building shared lib libsteam_api.so - 32 @@ -399,8 +400,6 @@ if [[ "$BUILD_TOOL_LOBBY32" = "1" ]]; then last_code=$((last_code + $?)) fi -echo; echo - ### x64 build rm -f dll/net.pb.cc @@ -409,6 +408,7 @@ rm -f -r -d "$build_temp_dir" mkdir -p "$build_temp_dir" echo // invoking protobuf compiler - 64 "$protoc_exe_64" -I./dll/ --cpp_out=./dll/ ./dll/*.proto +echo ; echo ; if [[ "$BUILD_LIB64" = "1" ]]; then echo // building shared lib libsteam_api.so - 64 @@ -434,8 +434,6 @@ if [[ "$BUILD_TOOL_LOBBY64" = "1" ]]; then last_code=$((last_code + $?)) fi -echo; echo - # cleanup rm -f dll/net.pb.cc diff --git a/build_win.bat b/build_win.bat index cc83b02a..9e97723c 100644 --- a/build_win.bat +++ b/build_win.bat @@ -257,50 +257,58 @@ call build_win_set_env.bat 32 || ( ) echo // invoking protobuf compiler - 32 -"%protoc_exe_32%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -set /a last_code+=errorlevel +"%protoc_exe_32%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto || ( + set /a last_code+=1 +) echo: & echo: if %BUILD_LIB32% equ 1 ( - call :compile_lib32 - set /a last_code+=errorlevel + call :compile_lib32 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXP_LIB32% equ 1 ( - call :compile_experimental_lib32 - set /a last_code+=errorlevel + call :compile_experimental_lib32 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXP_CLIENT32% equ 1 ( - call :compile_experimental_client32 - set /a last_code+=errorlevel + call :compile_experimental_client32 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXPCLIENT32% equ 1 ( - call :compile_experimentalclient_32 - set /a last_code+=errorlevel + call :compile_experimentalclient_32 || ( + set /a last_code+=1 + ) echo: & echo: ) :: steamclient_loader if %BUILD_EXPCLIENT_LDR% equ 1 ( - call :compile_experimentalclient_ldr - set /a last_code+=errorlevel + call :compile_experimentalclient_ldr || ( + set /a last_code+=1 + ) echo: & echo: ) :: tools (x32) if %BUILD_TOOL_FIND_ITFS% equ 1 ( - call :compile_tool_itf - set /a last_code+=errorlevel + call :compile_tool_itf || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_TOOL_LOBBY% equ 1 ( - call :compile_tool_lobby - set /a last_code+=errorlevel + call :compile_tool_lobby || ( + set /a last_code+=1 + ) echo: & echo: ) @@ -326,31 +334,36 @@ call build_win_set_env.bat 64 || ( ) echo // invoking protobuf compiler - 64 -"%protoc_exe_64%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto -set /a last_code+=errorlevel +"%protoc_exe_64%" -I.\dll\ --cpp_out=.\dll\ .\dll\net.proto || ( + set /a last_code+=1 +) echo: & echo: if %BUILD_LIB64% equ 1 ( - call :compile_lib64 - set /a last_code+=errorlevel + call :compile_lib64 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXP_LIB64% equ 1 ( - call :compile_experimental_lib64 - set /a last_code+=errorlevel + call :compile_experimental_lib64 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXP_CLIENT64% equ 1 ( - call :compile_experimental_client64 - set /a last_code+=errorlevel + call :compile_experimental_client64 || ( + set /a last_code+=1 + ) echo: & echo: ) if %BUILD_EXPCLIENT64% equ 1 ( - call :compile_experimentalclient_64 - set /a last_code+=errorlevel + call :compile_experimentalclient_64 || ( + set /a last_code+=1 + ) echo: & echo: ) @@ -358,14 +371,19 @@ endlocal & set /a last_code=%last_code% :: copy configs + examples -echo // copying readmes + files examples -xcopy /y /s "files_example\*" "%build_root_dir%\" -copy /y steamclient_loader\ColdClientLoader.ini "%steamclient_dir%\" -copy /y Readme_release.txt "%build_root_dir%\Readme.txt" -copy /y Readme_experimental.txt "%experimental_dir%\Readme.txt" -copy /y Readme_experimental_steamclient.txt "%steamclient_dir%\Readme.txt" -copy /y Readme_generate_interfaces.txt "%find_interfaces_dir%\Readme.txt" -copy /y Readme_lobby_connect.txt "%lobby_connect_dir%\Readme.txt" +if %last_code% equ 0 ( + echo // copying readmes + files examples + xcopy /y /s "files_example\*" "%build_root_dir%\" + copy /y steamclient_loader\ColdClientLoader.ini "%steamclient_dir%\" + copy /y Readme_release.txt "%build_root_dir%\Readme.txt" + copy /y Readme_experimental.txt "%experimental_dir%\Readme.txt" + copy /y Readme_experimental_steamclient.txt "%steamclient_dir%\Readme.txt" + copy /y Readme_generate_interfaces.txt "%find_interfaces_dir%\Readme.txt" + copy /y Readme_lobby_connect.txt "%lobby_connect_dir%\Readme.txt" +) else ( + call :err_msg "Not copying readmes or files examples due to previous errors" +) +echo: & echo: :: cleanup @@ -374,6 +392,7 @@ call build_win_clean.bat for %%A in ("ilk" "lib" "exp") do ( del /f /s /q "%build_root_dir%\*.%%~A" >nul 2>&1 ) +echo: & echo: goto :end_script