Skip to content

Commit

Permalink
Update batch scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
reyandme committed May 8, 2021
1 parent a186872 commit 15f49b6
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 58 deletions.
2 changes: 2 additions & 0 deletions bat/7zip.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@REM
echo called 7z.bat

call get_kam_folder.bat

REM ============================================================
Expand Down
2 changes: 1 addition & 1 deletion bat/7zip_update_files.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

echo called 7zip_update_files.bat
call get_kam_folder.bat

echo ***************
Expand Down
2 changes: 2 additions & 0 deletions bat/build_all.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
echo called build_all.bat

@REM ============================================================
@REM Build everything in the project group
@REM ============================================================
Expand Down
2 changes: 2 additions & 0 deletions bat/build_exe.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
echo called build_exe.bat

REM ============================================================
REM Build main exe
REM ============================================================
Expand Down
3 changes: 3 additions & 0 deletions bat/build_installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
echo called build_installer.bat

call "%ISC_DIR%"\iscc.exe "..\Installer\InstallerFull.iss" > iscc.log 2>&1
17 changes: 15 additions & 2 deletions bat/build_linux_servers.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
echo called build_linux_servers.bat

REM ============================================================
REM Build DedicatedServer for Linux
REM ============================================================
Expand All @@ -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

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
22 changes: 21 additions & 1 deletion bat/build_utils.bat
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions bat/clean_src.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
echo called clean_src.bat

call rsvars.bat

@echo off
Expand Down
1 change: 1 addition & 0 deletions bat/copy_post_pack.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
echo called copy_post_pack.bat

@REM ============================================================
@REM Copy music files from original KaM TPR game
Expand Down
2 changes: 2 additions & 0 deletions bat/copy_pre_pack.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
32 changes: 24 additions & 8 deletions bat/create.bat
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -49,6 +61,10 @@ call copy_post_pack.bat

goto exit0

:exit3
@echo off
exit /B 3

:exit2
@echo off
exit /B 2
Expand Down
9 changes: 9 additions & 0 deletions bat/create_beta.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
@echo off

echo called create_beta.bat
@REM echo ###### create_beta.bat ######
call get_kam_folder.bat

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
Expand Down
7 changes: 4 additions & 3 deletions bat/get_kam_folder.bat
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

if defined KAM_FOLDER_INIT (
goto exit0
)

echo called get_kam_folder.bat

@SET KAM_FOLDER_INIT=init

@echo # #
Expand Down Expand Up @@ -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
Expand Down
60 changes: 25 additions & 35 deletions bat/make_beta_and_installer.bat
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 8 additions & 6 deletions bat/make_beta_and_zip.bat
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions bat/prepare_for_installer.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
echo called prepare_for_installer.bat

call rsvars.bat
call get_kam_folder.bat

Expand Down
15 changes: 13 additions & 2 deletions bat/rx_pack.bat
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


0 comments on commit 15f49b6

Please sign in to comment.