Skip to content

Commit

Permalink
adapted build script
Browse files Browse the repository at this point in the history
  • Loading branch information
davidp57 committed Jan 9, 2020
1 parent af82ed3 commit 884bedd
Showing 1 changed file with 60 additions and 17 deletions.
77 changes: 60 additions & 17 deletions buildMission.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,92 @@ set MISSION_NAME=Test
set MISSION_PATH=..\VEAF-Demo-Mission
set SECURITY_DISABLED_FLAG=true
set VERBOSE_LOG_FLAG=true

echo ------------------------------
echo building Test
echo ------------------------------

rem -- prepare the folders
echo preparing the folders
rd /s /q .\build
mkdir .\build
mkdir .\build\tempsrc
set LUA_SCRIPTS_DEBUG_PARAMETER=-debug
echo.
echo ----------------------------------------
echo building %MISSION_NAME%
echo ----------------------------------------
echo.

rem -- default options values
echo options values :
echo This script can use these environment variables to customize its behavior :
echo ----------------------------------------
echo VERBOSE_LOG_FLAG if set to "true", will create a mission with tracing enabled (meaning that, when run, it will log a lot of details in the dcs log file)
echo defaults to "false"
IF [%VERBOSE_LOG_FLAG%] == [] GOTO DefineDefaultVERBOSE_LOG_FLAG
goto DontDefineDefaultVERBOSE_LOG_FLAG
:DefineDefaultVERBOSE_LOG_FLAG
set VERBOSE_LOG_FLAG=false
:DontDefineDefaultVERBOSE_LOG_FLAG
echo VERBOSE_LOG_FLAG = %VERBOSE_LOG_FLAG%
echo current value is "%VERBOSE_LOG_FLAG%"

echo ----------------------------------------
echo LUA_SCRIPTS_DEBUG_PARAMETER can be set to "-debug" or "-trace" (or not set) ; this will be passed to the lua helper scripts (e.g. veafMissionRadioPresetsEditor and veafMissionNormalizer)
echo defaults to not set
IF [%LUA_SCRIPTS_DEBUG_PARAMETER%] == [] GOTO DefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER
goto DontDefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER
:DefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER
set LUA_SCRIPTS_DEBUG_PARAMETER=
:DontDefineDefaultLUA_SCRIPTS_DEBUG_PARAMETER
echo current value is "%LUA_SCRIPTS_DEBUG_PARAMETER%"

echo ----------------------------------------
echo SECURITY_DISABLED_FLAG if set to "true", will create a mission with security disabled (meaning that no password is ever required)
echo defaults to "false"
IF [%SECURITY_DISABLED_FLAG%] == [] GOTO DefineDefaultSECURITY_DISABLED_FLAG
goto DontDefineDefaultSECURITY_DISABLED_FLAG
:DefineDefaultSECURITY_DISABLED_FLAG
set SECURITY_DISABLED_FLAG=false
:DontDefineDefaultSECURITY_DISABLED_FLAG
echo SECURITY_DISABLED_FLAG = %SECURITY_DISABLED_FLAG%
echo current value is "%SECURITY_DISABLED_FLAG%"

echo ----------------------------------------
echo MISSION_FILE_SUFFIX (a string) will be appended to the mission file name to make it more unique
echo defaults to the current iso date
IF [%MISSION_FILE_SUFFIX%] == [] GOTO DefineDefaultMISSION_FILE_SUFFIX
goto DontDefineDefaultMISSION_FILE_SUFFIX
:DefineDefaultMISSION_FILE_SUFFIX
set TIMEBUILD=%TIME: =0%
set MISSION_FILE_SUFFIX=%date:~-4,4%%date:~-7,2%%date:~-10,2%
:DontDefineDefaultMISSION_FILE_SUFFIX
set MISSION_FILE=.\build\%MISSION_NAME%_%MISSION_FILE_SUFFIX%
echo MISSION_FILE = %MISSION_FILE%.miz
echo current value is "%MISSION_FILE_SUFFIX%"

echo ----------------------------------------
echo SEVENZIP (a string) points to the 7za executable
echo defaults "7za", so it needs to be in the path
IF [%SEVENZIP%] == [] GOTO DefineDefaultSEVENZIP
goto DontDefineDefaultSEVENZIP
:DefineDefaultSEVENZIP
set SEVENZIP=7za
:DontDefineDefaultSEVENZIP
echo SEVENZIP = %SEVENZIP%
echo current value is "%SEVENZIP%"

echo ----------------------------------------
echo LUA (a string) points to the lua executable
echo defaults "lua", so it needs to be in the path
IF [%LUA%] == [] GOTO DefineDefaultLUA
goto DontDefineDefaultLUA
:DefineDefaultLUA
set LUA=lua
:DontDefineDefaultLUA
echo current value is "%LUA%"
echo ----------------------------------------
rem -- prepare the folders
echo preparing the folders
rd /s /q .\build
mkdir .\build
mkdir .\build\tempsrc
echo building the mission
rem -- copy all the source mission files and mission-specific scripts
xcopy /y /e %MISSION_PATH%\src\mission .\build\tempsrc\ >nul 2>&1
copy %MISSION_PATH%\src\scripts\*.lua .\build\tempsrc\l10n\Default >nul 2>&1
xcopy /y /e %MISSION_PATH%\src\scripts\*.lua .\build\tempsrc\l10n\Default\ >nul 2>&1

rem -- set the radio presets according to the settings file
echo set the radio presets according to the settings file
pushd scripts\veaf
%LUA% veafMissionRadioPresetsEditor.lua ..\..\build\tempsrc ..\..\%MISSION_PATH%\src\radioSettings.lua %LUA_SCRIPTS_DEBUG_PARAMETER%
popd

rem -- copy the documentation images to the kneeboard
xcopy /y /e %MISSION_PATH%\doc\*.png .\build\tempsrc\KNEEBOARD\IMAGES >nul 2>&1
Expand All @@ -68,7 +108,10 @@ rem -- compile the mission
"%SEVENZIP%" a -r -tzip %MISSION_FILE%.miz .\build\tempsrc\* -mem=AES256 >nul 2>&1

rem -- cleanup
rd /s /q .\build\tempsrc
rd /s /q .\build\tempsrc

echo.
echo ----------------------------------------
rem -- done !
echo Built %MISSION_FILE%.miz
echo ----------------------------------------

0 comments on commit 884bedd

Please sign in to comment.