From 15f49b6503734fb01c8ecdc4822bd4d8747bf859 Mon Sep 17 00:00:00 2001 From: Rey Date: Sat, 8 May 2021 18:11:17 +0300 Subject: [PATCH] Update batch scripts --- bat/7zip.bat | 2 ++ bat/7zip_update_files.bat | 2 +- bat/build_all.bat | 2 ++ bat/build_exe.bat | 2 ++ bat/build_installer.bat | 3 ++ bat/build_linux_servers.bat | 17 ++++++++-- bat/build_utils.bat | 22 +++++++++++- bat/clean_src.bat | 2 ++ bat/copy_post_pack.bat | 1 + bat/copy_pre_pack.bat | 2 ++ bat/create.bat | 32 +++++++++++++----- bat/create_beta.bat | 9 +++++ bat/get_kam_folder.bat | 7 ++-- bat/make_beta_and_installer.bat | 60 ++++++++++++++------------------- bat/make_beta_and_zip.bat | 14 ++++---- bat/prepare_for_installer.bat | 2 ++ bat/rx_pack.bat | 15 +++++++-- 17 files changed, 136 insertions(+), 58 deletions(-) create mode 100644 bat/build_installer.bat diff --git a/bat/7zip.bat b/bat/7zip.bat index 3475db9f7c..82c1768ba6 100644 --- a/bat/7zip.bat +++ b/bat/7zip.bat @@ -1,4 +1,6 @@ @REM +echo called 7z.bat + call get_kam_folder.bat REM ============================================================ diff --git a/bat/7zip_update_files.bat b/bat/7zip_update_files.bat index 406a965524..b47ed45ae3 100644 --- a/bat/7zip_update_files.bat +++ b/bat/7zip_update_files.bat @@ -1,4 +1,4 @@ - +echo called 7zip_update_files.bat call get_kam_folder.bat echo *************** diff --git a/bat/build_all.bat b/bat/build_all.bat index 09e638ca81..74ce5ad032 100644 --- a/bat/build_all.bat +++ b/bat/build_all.bat @@ -1,3 +1,5 @@ +echo called build_all.bat + @REM ============================================================ @REM Build everything in the project group @REM ============================================================ diff --git a/bat/build_exe.bat b/bat/build_exe.bat index 4cf28d8bde..fa25eb57d8 100644 --- a/bat/build_exe.bat +++ b/bat/build_exe.bat @@ -1,3 +1,5 @@ +echo called build_exe.bat + REM ============================================================ REM Build main exe REM ============================================================ diff --git a/bat/build_installer.bat b/bat/build_installer.bat new file mode 100644 index 0000000000..376133ca89 --- /dev/null +++ b/bat/build_installer.bat @@ -0,0 +1,3 @@ +echo called build_installer.bat + +call "%ISC_DIR%"\iscc.exe "..\Installer\InstallerFull.iss" > iscc.log 2>&1 diff --git a/bat/build_linux_servers.bat b/bat/build_linux_servers.bat index f154e96bd5..af3b00680c 100644 --- a/bat/build_linux_servers.bat +++ b/bat/build_linux_servers.bat @@ -1,3 +1,5 @@ +echo called build_linux_servers.bat + REM ============================================================ REM Build DedicatedServer for Linux REM ============================================================ @@ -7,7 +9,18 @@ call rsvars.bat REM Build x86 version call %LAZARUS_LINUX%/lazbuild.exe -q ../Utils/DedicatedServer/KaM_DedicatedServer_win32-linux_x86.lpi +if errorlevel 1 goto exit3 REM Build x86_64 (x64) version -call %LAZARUS_LINUX%/lazbuild.exe -q ../Utils/DedicatedServer/KaM_DedicatedServer_win32-linux_x86_64.lpi - \ No newline at end of file +call %LAZARUS_LINUX%/lazbuild.exe -q ../Utils/DedicatedServer/KaM_DedicatedServer_win32-linux_x86_64.lpi +if errorlevel 1 goto exit3 + +goto exit0 + +:exit3 +@echo off +exit /B 3 + +:exit0 +@echo off +exit /B 0 \ No newline at end of file diff --git a/bat/build_utils.bat b/bat/build_utils.bat index 62d56d2649..532026dbf2 100644 --- a/bat/build_utils.bat +++ b/bat/build_utils.bat @@ -1,25 +1,45 @@ +echo called build_utils.bat + call rsvars.bat @REM Build utils applications, included into the final build REM Build Campaign Builder msbuild "..\Utils\Campaign builder\CampaignBuilder.dproj" /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_campaign_builder.log" +if errorlevel 1 goto exit3 REM Build Dedicated Server (Console app) msbuild ..\Utils\DedicatedServer\KaM_DedicatedServer.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_dedicated_server.log" +if errorlevel 1 goto exit3 REM Build Dedicated Server (GUI app) msbuild ..\Utils\DedicatedServerGUI\KaM_DedicatedServerGUI.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_dedicated_server_gui.log" +if errorlevel 1 goto exit3 REM Build Script Validator msbuild ..\Utils\ScriptValidator\ScriptValidator.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_script_validator.log" +if errorlevel 1 goto exit3 REM Build Translation Manager msbuild ..\Utils\TranslationManager\TranslationManager.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_translation_manager.log" +if errorlevel 1 goto exit3 REM Build Scripting Editor if %IncludeScriptingEditor%==True ( -msbuild "%ScriptingEditorDir%"\ScriptingEditor.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_script_editor.log" + msbuild "%ScriptingEditorDir%"\ScriptingEditor.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_script_editor.log" + if errorlevel 1 goto exit3 ) call build_linux_servers.bat +if errorlevel 1 goto exit3 + +goto exit0 + +:exit3 +@echo off +exit /B 3 + +:exit0 +@echo off +exit /B 0 + diff --git a/bat/clean_src.bat b/bat/clean_src.bat index 876d406304..2fea96ce71 100644 --- a/bat/clean_src.bat +++ b/bat/clean_src.bat @@ -1,3 +1,5 @@ +echo called clean_src.bat + call rsvars.bat @echo off diff --git a/bat/copy_post_pack.bat b/bat/copy_post_pack.bat index e5fc407645..4349801f54 100644 --- a/bat/copy_post_pack.bat +++ b/bat/copy_post_pack.bat @@ -1,3 +1,4 @@ +echo called copy_post_pack.bat @REM ============================================================ @REM Copy music files from original KaM TPR game diff --git a/bat/copy_pre_pack.bat b/bat/copy_pre_pack.bat index 40d90e20f1..057e8a582b 100644 --- a/bat/copy_pre_pack.bat +++ b/bat/copy_pre_pack.bat @@ -1,3 +1,5 @@ +echo called copy_pre_pack.bat + REM Copy rx resorces from original game xcopy "%KaMDir%\data\gfx\res" ..\SpriteResource\ /y /r /s xcopy "%KaMDir%\data\gfx\*" ..\data\gfx /y /r diff --git a/bat/create.bat b/bat/create.bat index 0f95cb0043..dcf8cb9c7e 100644 --- a/bat/create.bat +++ b/bat/create.bat @@ -1,8 +1,11 @@ +echo called create.bat + REM ============================================================ REM Create new version package REM ============================================================ REM Clean before build to avoid any side-effects from old DCUs +@REM echo ###### create.bat ###### call get_kam_folder.bat @echo off @@ -11,34 +14,43 @@ if errorlevel 2 (goto exit2) echo "%kam_folder%" REM Clean target, so if anything fails we have a clear indication (dont pack old files by mistake) -rmdir /S /Q "%kam_folder%" +echo ###### Clean ###### +rmdir /S /Q "%kam_folder%" > clean.log 2>&1 REM Clean before build to avoid any side-effects from old DCUs -@call clean_src.bat +@call clean_src.bat >> clean.log 2>&1 -REM Copy_1 -call copy_pre_pack.bat +REM Copy pre pack +echo ###### Copy Pre Pack ###### +call copy_pre_pack.bat > copy_pre_pack.log 2>&1 REM Pack rx data -call rx_pack.bat +echo ###### RX Pack ###### +call rx_pack.bat > rx_pack.log 2>&1 +if errorlevel 3 (goto exit3) REM Build utility applications, included into the final build -call build_utils.bat +echo ###### Build utils ###### +call build_utils.bat > build_utils.log 2>&1 +if errorlevel 3 (goto exit3) @REM Build exe @REM call build_exe.bat +@REM if errorlevel 3 (goto exit3) @REM Patch exe @REM call patch_exe.bat -REM Copy_2 -call copy_post_pack.bat +REM Copy post pack +echo ###### Copy Post Pack ###### +call copy_post_pack.bat > copy_post_pack.log 2>&1 @REM Restore local rxx @REM call rxx_restore.bat @REM Archive into 7z @REM call 7zip.bat +@REM if errorlevel 3 (goto exit3) @REM Create Installer instructions @REM call prepare_installer.bat @@ -49,6 +61,10 @@ call copy_post_pack.bat goto exit0 +:exit3 +@echo off +exit /B 3 + :exit2 @echo off exit /B 2 diff --git a/bat/create_beta.bat b/bat/create_beta.bat index b4e558f51c..735043b155 100644 --- a/bat/create_beta.bat +++ b/bat/create_beta.bat @@ -1,4 +1,7 @@ @echo off + +echo called create_beta.bat +@REM echo ###### create_beta.bat ###### call get_kam_folder.bat if errorlevel 2 (goto exit2) @@ -6,9 +9,15 @@ if errorlevel 2 (goto exit2) @SET kam_folder=%build_full_kmr_dir% call create.bat +if errorlevel 3 (goto exit3) +echo ###### create beta Done ###### goto exit0 +:exit3 +@echo off +exit /B 3 + :exit2 @echo off exit /B 2 diff --git a/bat/get_kam_folder.bat b/bat/get_kam_folder.bat index 94f73de320..3954054653 100644 --- a/bat/get_kam_folder.bat +++ b/bat/get_kam_folder.bat @@ -1,8 +1,9 @@ - if defined KAM_FOLDER_INIT ( goto exit0 ) +echo called get_kam_folder.bat + @SET KAM_FOLDER_INIT=init @echo # # @@ -46,13 +47,13 @@ FOR /F "tokens=* USEBACKQ" %%F IN (`git rev-list --count HEAD`) DO ( @REM Now we can have a constant with the right folder name @SET build_full_kmr_dir=%BuildFullDir%\kmr%YYYY%-%MM%-%DD% (%kam_version% r%kam_revision%) -@SET installer_kmr_build_full_dir=..\Installer\BuildFull +@REM @SET installer_kmr_build_full_dir=..\Installer\BuildFull @REM default kam_folder is build full directory @SET kam_folder=%build_full_kmr_dir% echo # -echo kam_folder = `%kam_folder%` +echo kam_folder = "%kam_folder%" goto exit0 diff --git a/bat/make_beta_and_installer.bat b/bat/make_beta_and_installer.bat index 261144d598..7fb9c4687b 100644 --- a/bat/make_beta_and_installer.bat +++ b/bat/make_beta_and_installer.bat @@ -1,61 +1,51 @@ @echo off - +echo called make_beta_and_installer.bat @REM we could use timer util made by https://www.gammadyne.com/cmdline.htm#timer -@REM if "%~1"=="-timer" ( -@REM call timer.exe /nologo -@REM ) + +call timer.exe /nologo @REM or we could measure execution time in seconds via next calls @REM @set /A _tic=%time:~0,2%*3600^+%time:~3,1%*10*60^+%time:~4,1%*60^+%time:~6,1%*10^+%time:~7,1% >nul @REM let's use timecmd.bat to measure execution time -call timecmd.bat create_beta.bat -if errorlevel 2 (goto exit2) +@REM ########################## CREATE BETA +call timecmd.bat create_beta.bat +if errorlevel 3 (goto exit3) @REM @set /A _toc=%time:~0,2%*3600^+%time:~3,1%*10*60^+%time:~4,1%*60^+%time:~6,1%*10^+%time:~7,1% >nul @REM @set /A _elapsed=%_toc%-%_tic @REM @echo %_elapsed% seconds. +@REM echo Create Beta took: +@REM call "timer.exe" /nologo /r -@REM if "%~1"=="-timer" ( -@REM @echo # -@REM echo Create Beta took: -@REM call "timer.exe" /nologo /r -@REM -@REM @echo Create Beta took: > build_time.txt -@REM @call "timer.exe" /nologo /r >> build_time.txt -@REM ) +echo ###### Prepare for installer ###### +call prepare_for_installer.bat > prepare_for_installer.log 2>&1 -call prepare_for_installer.bat - -@echo # # -@echo #==========================================================# -@echo # Start Inno Setup compilation # -@echo #==========================================================# +@echo # # +@echo #=========================================================================# +@echo # Start Inno Setup compilation # +@echo #=========================================================================# @echo # @echo # -call timecmd.bat "%ISC_DIR%"\iscc.exe /Q "..\Installer\InstallerFull.iss" - -@REM if "%~1"=="-timer" ( -@REM echo Inno Setup compilation took: -@REM call "timer.exe" /nologo /S -@REM -@REM @echo # -@REM @echo --------------------------------------------------------- >> build_time.txt -@REM @echo # -@REM @echo Inno Setup compilation took: >> build_time.txt -@REM @call "timer.exe" /nologo /r >> build_time.txt -@REM ) +call timecmd.bat build_installer.bat +if errorlevel 3 (goto exit3) @echo # -@echo #----------------------------------------------------------# -@echo # Compilation completed ! # -@echo #----------------------------------------------------------# +@echo #-------------------------------------------------------------------------# +@echo # Compilation completed ! # +@echo #-------------------------------------------------------------------------# + +echo Total build time: +call "timer.exe" /nologo /S goto exit0 +:exit3 +exit /B 3 + :exit2 exit /B 2 diff --git a/bat/make_beta_and_zip.bat b/bat/make_beta_and_zip.bat index 62ef619245..c8ab960d7f 100644 --- a/bat/make_beta_and_zip.bat +++ b/bat/make_beta_and_zip.bat @@ -1,15 +1,17 @@ -@echo off -call create_beta.bat +echo called make_beta_and_zip.bat -if errorlevel 2 (goto exit2) +@echo off +call timecmd.bat create_beta.bat +if errorlevel 3 (goto exit3) REM Archive into 7z -call 7zip.bat +call timecmd.bat 7zip.bat +if errorlevel 3 (goto exit3) goto exit0 -:exit2 -exit /B 2 +:exit3 +exit /B 3 :exit0 @echo off diff --git a/bat/prepare_for_installer.bat b/bat/prepare_for_installer.bat index f61ef9ffaf..a5a7e312fa 100644 --- a/bat/prepare_for_installer.bat +++ b/bat/prepare_for_installer.bat @@ -1,3 +1,5 @@ +echo called prepare_for_installer.bat + call rsvars.bat call get_kam_folder.bat diff --git a/bat/rx_pack.bat b/bat/rx_pack.bat index 9c47de3ed9..d1df5b1014 100644 --- a/bat/rx_pack.bat +++ b/bat/rx_pack.bat @@ -1,8 +1,8 @@ - - +echo called rx_pack.bat REM build RXXPacker msbuild ..\Utils\RXXPacker\RXXPacker.dproj /p:Configuration=Release /t:Build /clp:ErrorsOnly /fl /flp:LogFile="build_rxxpacker.log" +if errorlevel 1 goto exit3 @REM Backup local rxx files @REM xcopy ..\data\Sprites ..\data\_Sprites\ /y /r /s @@ -12,5 +12,16 @@ msbuild ..\Utils\RXXPacker\RXXPacker.dproj /p:Configuration=Release /t:Build /cl REM Pack rx textures to rxx @REM call ..\Utils\RXXPacker\RXXPacker.exe gui guimain houses trees units call ..\Utils\RXXPacker\RXXPacker.exe all +if errorlevel 1 goto exit3 + +goto exit0 + +:exit3 +@echo off +exit /B 3 + +:exit0 +@echo off +exit /B 0