diff --git a/etc/Deployment/_build.bat b/etc/Deployment/_build.bat index f4effdcb..70d34cdb 100644 --- a/etc/Deployment/_build.bat +++ b/etc/Deployment/_build.bat @@ -1,23 +1,45 @@ @echo off -set "LAMEXP_ERROR=1" + +echo. echo ---------------------------------------------------------------- echo Solution File: %1 echo Configuration: %~2 echo ---------------------------------------------------------------- +echo. + +:: --------------------------------------------------------------------------- +:: SETUP PATHS +:: --------------------------------------------------------------------------- + call "%~dp0\_paths.bat" -if not "%LAMEXP_ERROR%"=="0" GOTO:EOF -REM ----------------------------------------------------------------- call "%PATH_MSCDIR%\VC\bin\vcvars32.bat" x86 -if exist "%PATH_QTMSVC%\bin\qtenv2.bat" call "%PATH_QTMSVC%\bin\qtenv2.bat" -if exist "%PATH_QTMSVC%\bin\qtvars.bat" call "%PATH_QTMSVC%\bin\qtvars.bat" -REM ----------------------------------------------------------------- -set "LAMEXP_ERROR=1" -msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Clean /verbosity:normal %1 -if not "%ERRORLEVEL%"=="0" GOTO:EOF -echo ---------------------------------------------------------------- -set "LAMEXP_ERROR=1" + +if exist "%PATH_QTMSVC%\bin\qtenv2.bat" ( + call "%PATH_QTMSVC%\bin\qtenv2.bat" +) + +if exist "%PATH_QTMSVC%\bin\qtvars.bat" ( + call "%PATH_QTMSVC%\bin\qtvars.bat" +) + +:: --------------------------------------------------------------------------- +:: BUILD THE PROJECT +:: --------------------------------------------------------------------------- + +msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Clean /verbosity:normal %1 +if not "%ERRORLEVEL%"=="0" ( + echo. && echo Build process has failed! + echo. && pause && exit +) + msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Rebuild /verbosity:normal %1 -msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Build /verbosity:normal %1 -if not "%ERRORLEVEL%"=="0" GOTO:EOF -echo ---------------------------------------------------------------- -set "LAMEXP_ERROR=0" +if not "%ERRORLEVEL%"=="0" ( + echo. && echo Build process has failed! + echo. && pause && exit +) + +msbuild.exe /property:Configuration=%2 /property:Platform=Win32 /target:Build /verbosity:normal %1 +if not "%ERRORLEVEL%"=="0" ( + echo. && echo Build process has failed! + echo. && pause && exit +) diff --git a/etc/Deployment/_date.bat b/etc/Deployment/_date.bat index d0151857..8d35d6be 100644 --- a/etc/Deployment/_date.bat +++ b/etc/Deployment/_date.bat @@ -1,12 +1,22 @@ @echo off + +:: --------------------------------------------------------------------------- +:: SETUP BUILD DATE +:: --------------------------------------------------------------------------- + set "ISO_DATE=" -set "LAMEXP_ERROR=1" -REM ------------------------------------------ -if not exist "%~dp0\..\Utilities\Date.exe" GOTO:EOF -for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Utilities\Date.exe" +ISODATE:%%Y-%%m-%%d') do ( - if "%%a"=="ISODATE" set "ISO_DATE=%%b" + +if exist "%~dp0\..\Utilities\Date.exe" ( + for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\Utilities\Date.exe" +ISODATE:%%Y-%%m-%%d') do ( + if "%%a"=="ISODATE" set "ISO_DATE=%%b" + ) ) -if "%ISO_DATE%"=="" GOTO:EOF -REM ------------------------------------------ -echo %ISO_DATE% -set "LAMEXP_ERROR=0" + +if "%ISO_DATE%"=="" ( + echo. && echo "Failed to set up build date!" + echo. && pause && exit +) + +echo. +echo Build Date: %ISO_DATE% +echo. diff --git a/etc/Deployment/_deploy.bat b/etc/Deployment/_deploy.bat index a2a3f911..800636d7 100644 --- a/etc/Deployment/_deploy.bat +++ b/etc/Deployment/_deploy.bat @@ -1,43 +1,41 @@ @echo off setlocal ENABLEDELAYEDEXPANSION -REM ------------------------------------------ -REM :: SETUP ENVIRONMENT :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: SETUP ENVIRONMENT +:: --------------------------------------------------------------------------- + +set "_LAMEXP_PATHS_INITIALIZED_=" + call "%~dp0\_paths.bat" -if not "%LAMEXP_ERROR%"=="0" ( - call "%~dp0\_error.bat" "FAILD TO SETUP PATHS. CHECK YOUR 'BUILDENV.TXT' FILE" - GOTO:EOF -) -REM ------------------------------------------ +call "%~dp0\_date.bat" + if "%LAMEXP_CONFIG%"=="" ( set "LAMEXP_CONFIG=Release" ) + if not "%LAMEXP_REDIST%"=="0" ( set "LAMEXP_REDIST=1" ) -REM ------------------------------------------ -REM :: SETUP BUILD DATE :: -REM ------------------------------------------ -call "%~dp0\_date.bat" -if not "%LAMEXP_ERROR%"=="0" ( - call "%~dp0\_error.bat" "FAILD TO SETUP BUILD-DATE" - GOTO:EOF -) -REM ------------------------------------------ -REM :: SETUP PATHS :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: SETUP PATHS +:: --------------------------------------------------------------------------- + set "OUT_PATH=%~dp0\..\..\bin\%LAMEXP_CONFIG%" set "TMP_PATH=%TEMP%\~LameXP.%LAMEXP_CONFIG%.%ISO_DATE%.%RANDOM%.tmp" set "OBJ_PATH=%~dp0\..\..\obj\%LAMEXP_CONFIG%" set "MOC_PATH=%~dp0\..\..\tmp" set "IPC_PATH=%~dp0\..\..\ipch" -REM ------------------------------------------ + if "%LAMEXP_SKIP_BUILD%"=="YES" ( goto SkipBuildThisTime ) -REM ------------------------------------------ -REM :: CLEAN UP :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: CLEAN UP +:: --------------------------------------------------------------------------- + del /Q "%OUT_PATH%\*.exe" del /Q "%OUT_PATH%\*.dll" del /Q "%OBJ_PATH%\*.obj" @@ -52,102 +50,107 @@ del /Q "%OBJ_PATH%\*.dep" del /Q "%MOC_PATH%\*.cpp" del /Q "%MOC_PATH%\*.h" del /Q /S "%IPC_PATH%\*.*" -REM ------------------------------------------ -REM :: BUILD BINARIES :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: UPDATE LANGUAGE FILES AND DCOS +:: --------------------------------------------------------------------------- + +call "%~dp0\_mkdocs.bat" call "%~dp0\_lupdate.bat" + +:: --------------------------------------------------------------------------- +:: BUILD THE BINARIES +:: --------------------------------------------------------------------------- + call "%~dp0\_build.bat" "%~dp0\..\..\%PATH_VCPROJ%" "%LAMEXP_CONFIG%" -if not "%LAMEXP_ERROR%"=="0" ( - call "%~dp0\_error.bat" "BUILD HAS FAILED" - GOTO:EOF -) -REM ------------------------------------------ + :SkipBuildThisTime -REM ------------------------------------------ -REM :: READ VERSION INFO :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: READ VERSION INFO +:: --------------------------------------------------------------------------- + call "%~dp0\_version.bat" -if not "%LAMEXP_ERROR%"=="0" ( - call "%~dp0\_error.bat" "FAILD TO READ VERSION INFO!" - GOTO:EOF -) -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: GENERATE OUTPUT FILE NAME +:: --------------------------------------------------------------------------- + mkdir "%~dp0\..\..\out" 2> NUL set "OUT_FILE=%~dp0\..\..\out\%VER_LAMEXP_BASENAME%.%ISO_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%" for /L %%n in (1, 1, 99) do ( if exist "!OUT_FILE!.exe" set "OUT_FILE=%~dp0\..\..\out\%VER_LAMEXP_BASENAME%.%ISO_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n" if exist "!OUT_FILE!.zip" set "OUT_FILE=%~dp0\..\..\out\%VER_LAMEXP_BASENAME%.%ISO_DATE%.%LAMEXP_CONFIG:_=-%.Build-%VER_LAMEXP_BUILD%.Update-%%n" ) -REM ------------------------------------------ -REM :: DELETE OLD OUTPUT FILE :: -REM ------------------------------------------ -del "%OUT_FILE%.exe" -del "%OUT_FILE%.sfx" -del "%OUT_FILE%.zip" -del "%OUT_FILE%.txt" -REM ------------------------------------------ -if exist "%OUT_FILE%.exe" ( - call "%~dp0\_error.bat" "FAILD TO DELET EXISTING FILE" - GOTO:EOF + +:: --------------------------------------------------------------------------- +:: DELETE OLD OUTPUT FILE +:: --------------------------------------------------------------------------- + +for %%i in (exe,sfx,zip,txt) do ( + del "%OUT_FILE%.%%i" 2> NUL + if exist "%OUT_FILE%.%%i" ( + echo. && echo Failed to delete existing output file^^! + echo. && pause && exit + ) ) -if exist "%OUT_FILE%.zip" ( - call "%~dp0\_error.bat" "FAILD TO DELET EXISTING FILE" - GOTO:EOF -) -REM ------------------------------------------ -REM :: POST BUILD :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: POST BUILD OPERATIONS +:: --------------------------------------------------------------------------- + rd /S /Q "%TMP_PATH%" mkdir "%TMP_PATH%" -copy "%OUT_PATH%\*.exe" "%TMP_PATH%" -REM ------------------------------------------ + +for %%i in (exe,dll) do ( + copy "%OUT_PATH%\*.%%i" "%TMP_PATH%" +) + if "%LAMEXP_REDIST%"=="1" ( - copy "%QTDIR%\bin\QtCore4.dll" "%TMP_PATH%" - copy "%QTDIR%\bin\QtGui4.dll" "%TMP_PATH%" - copy "%QTDIR%\bin\QtXml4.dll" "%TMP_PATH%" - copy "%QTDIR%\bin\QtSvg4.dll" "%TMP_PATH%" mkdir "%TMP_PATH%\imageformats" + for %%i in (Core,Gui,Network,Xml,Svg) do ( + copy "%QTDIR%\bin\Qt%%i4.dll" "%TMP_PATH%" + ) copy "%QTDIR%\plugins\imageformats\q???4.dll" "%TMP_PATH%\imageformats" + for %%i in (100,110,120) do ( + if exist %PATH_MSCDIR%\VC\redist\x86\Microsoft.VC%%i.CRT\*.dll" ( + copy "%PATH_MSCDIR%\VC\redist\x86\Microsoft.VC%%i.CRT\*.dll" "%TMP_PATH%" + ) + ) ) -REM ------------------------------------------ -if "%LAMEXP_SKIP_BUILD%"=="YES" ( - goto SkipPackingThisTime + +for %%e in (exe,dll) do ( + for %%f in (%TMP_PATH%\*.%%e) do ( + "%PATH_UPXBIN%\upx.exe" --best "%%f" + ) ) -REM ------------------------------------------ -for %%f in ("%TMP_PATH%\*.exe") do ( - "%PATH_UPXBIN%\upx.exe" --best "%%f" -) -for %%f in ("%TMP_PATH%\*.dll") do ( - "%PATH_UPXBIN%\upx.exe" --best "%%f" -) -REM ------------------------------------------ -:SkipPackingThisTime -REM ------------------------------------------ + if exist "%~dp0\_postproc.bat" ( call "%~dp0\_postproc.bat" "%TMP_PATH%" ) -REM ------------------------------------------ -if "%LAMEXP_REDIST%"=="1" ( - copy "..\Redist\*.*" "%TMP_PATH%" -) -copy "%~dp0\..\..\ReadMe.txt" "%TMP_PATH%" -copy "%~dp0\..\..\License.txt" "%TMP_PATH%" -copy "%~dp0\..\..\Copying.txt" "%TMP_PATH%" + +copy "%~dp0\..\..\ReadMe.txt" "%TMP_PATH%" +copy "%~dp0\..\..\License.txt" "%TMP_PATH%" +copy "%~dp0\..\..\Copying.txt" "%TMP_PATH%" copy "%~dp0\..\..\doc\Changelog.html" "%TMP_PATH%" copy "%~dp0\..\..\doc\Translate.html" "%TMP_PATH%" -copy "%~dp0\..\..\doc\Manual.html" "%TMP_PATH%" -copy "%~dp0\..\..\doc\FAQ.html" "%TMP_PATH%" +copy "%~dp0\..\..\doc\Manual.html" "%TMP_PATH%" +copy "%~dp0\..\..\doc\FAQ.html" "%TMP_PATH%" + if not "%VER_LAMEXP_TYPE%" == "Final" ( if not "%VER_LAMEXP_TYPE%" == "Hotfix" ( copy "%~dp0\..\..\doc\PRE_RELEASE_INFO.txt" "%TMP_PATH%" ) ) + attrib +R "%TMP_PATH%\*.txt" attrib +R "%TMP_PATH%\*.html" attrib +R "%TMP_PATH%\*.exe" -REM ------------------------------------------ -REM :: CREATE PACKAGES :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: CREATE PACKAGES +:: --------------------------------------------------------------------------- + "%~dp0\..\Utilities\Echo.exe" LameXP - Audio Encoder Front-End > "%OUT_FILE%.txt" "%~dp0\..\Utilities\Echo.exe" v%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO% %VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH% (Build #%VER_LAMEXP_BUILD%)\n >> "%OUT_FILE%.txt" "%~dp0\..\Utilities\Echo.exe" Built on %ISO_DATE% at %TIME%\n\n >> "%OUT_FILE%.txt" @@ -155,39 +158,43 @@ REM ------------------------------------------ "%~dp0\..\Utilities\Cat.exe" "%~dp0\..\..\ReadMe.txt" >> "%OUT_FILE%.txt" "%~dp0\..\Utilities\Echo.exe" \n\n---------------------------\nLICENSE.TXT\n---------------------------\n >> "%OUT_FILE%.txt" "%~dp0\..\Utilities\Cat.exe" "%~dp0\..\..\License.txt" >> "%OUT_FILE%.txt" -REM ------------------------------------------ + pushd "%TMP_PATH%" "%~dp0\..\Utilities\Zip.exe" -r -9 -z "%OUT_FILE%.zip" "*.*" < "%OUT_FILE%.txt" popd -REM ------------------------------------------ + "%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_UPX_PATH=%PATH_UPXBIN%" "/DLAMEXP_DATE=%ISO_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_INSTTYPE=%VER_LAMEXP_TYPE%" "/DLAMEXP_PATCH=%VER_LAMEXP_PATCH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.sfx" "/DLAMEXP_SOURCE_PATH=%TMP_PATH%" "%~dp0\..\NSIS\setup.nsi" "%PATH_MKNSIS%\makensis.exe" "/DLAMEXP_UPX_PATH=%PATH_UPXBIN%" "/DLAMEXP_DATE=%ISO_DATE%" "/DLAMEXP_VERSION=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%" "/DLAMEXP_BUILD=%VER_LAMEXP_BUILD%" "/DLAMEXP_INSTTYPE=%VER_LAMEXP_TYPE%" "/DLAMEXP_PATCH=%VER_LAMEXP_PATCH%" "/DLAMEXP_OUTPUT_FILE=%OUT_FILE%.exe" "/DLAMEXP_SOURCE_FILE=%OUT_FILE%.sfx" "%~dp0\..\NSIS\wrapper.nsi" -REM ------------------------------------------ + attrib -R "%TMP_PATH%\*.txt" attrib -R "%TMP_PATH%\*.html" attrib -R "%TMP_PATH%\*.exe" rd /S /Q "%TMP_PATH%" -REM ------------------------------------------ -if not exist "%OUT_FILE%.zip" ( - call "%~dp0\_error.bat" "PACKAGING HAS FAILED" - GOTO:EOF + +for %%i in (zip,exe) do ( + if not exist "%OUT_FILE%.zip" ( + echo. && echo Failed to create release packages^^! + echo. && pause && exit + ) ) -if not exist "%OUT_FILE%.exe" ( - call "%~dp0\_error.bat" "PACKAGING HAS FAILED" - GOTO:EOF -) -REM ------------------------------------------ + attrib +R "%OUT_FILE%.zip" attrib +R "%OUT_FILE%.sfx" attrib +R "%OUT_FILE%.exe" -REM ------------------------------------------ -REM :: CREATE SIGNATURE :: -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: SIGN OUTPUT FILE +:: --------------------------------------------------------------------------- + "%PATH_GNUPG1%\gpg.exe" --detach-sign "%OUT_FILE%.exe" attrib +R "%OUT_FILE%.exe.sig" -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: COMPLETED +:: --------------------------------------------------------------------------- + echo. echo BUIDL COMPLETED SUCCESSFULLY :-) echo. -REM ------------------------------------------ + pause diff --git a/etc/Deployment/_error.bat b/etc/Deployment/_error.bat deleted file mode 100644 index b0d64255..00000000 --- a/etc/Deployment/_error.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -echo. -echo %~1 !!! -echo. -pause diff --git a/etc/Deployment/_lupdate.bat b/etc/Deployment/_lupdate.bat index c9b7eb8d..fceac545 100644 --- a/etc/Deployment/_lupdate.bat +++ b/etc/Deployment/_lupdate.bat @@ -1,43 +1,69 @@ @echo off -set "LAMEXP_ERROR=1" +setlocal ENABLEDELAYEDEXPANSION + +echo. echo ---------------------------------------------------------------- -echo Updating Translation files +echo Updating Translation Files echo ---------------------------------------------------------------- +echo. + +:: --------------------------------------------------------------------------- +:: SETUP PATHS +:: --------------------------------------------------------------------------- + call "%~dp0\_paths.bat" -if not "%LAMEXP_ERROR%"=="0" GOTO:EOF -REM ----------------------------------------------------------------- -set "LAMEXP_ERROR=1" -REM ----------------------------------------------------------------- call "%PATH_MSCDIR%\VC\bin\vcvars32.bat" x86 -if exist "%PATH_QTMSVC%\bin\qtenv2.bat" call "%PATH_QTMSVC%\bin\qtenv2.bat" -if exist "%PATH_QTMSVC%\bin\qtvars.bat" call "%PATH_QTMSVC%\bin\qtvars.bat" -REM ----------------------------------------------------------------- -set "LAMEXP_ERROR=1" + +if exist "%PATH_QTMSVC%\bin\qtenv2.bat" ( + call "%PATH_QTMSVC%\bin\qtenv2.bat" +) + +if exist "%PATH_QTMSVC%\bin\qtvars.bat" ( + call "%PATH_QTMSVC%\bin\qtvars.bat" +) + +:: --------------------------------------------------------------------------- +:: GENERATE THE FILE LIST +:: --------------------------------------------------------------------------- + set "LST_FILE=%TEMP%\~list.%RANDOM%%RANDOM%.tmp" echo %LST_FILE% -REM ----------------------------------------------------------------- del "%LST_FILE%" 2> NUL + for %%f in ("%~dp0\..\..\gui\*.ui") do ( echo %%f >> "%LST_FILE%" ) -for %%f in ("%~dp0\..\..\src\*.cpp") do ( - echo %%f >> "%LST_FILE%" +for %%e in (cpp,h) do ( + for %%f in ("%~dp0\..\..\src\*.%%e") do ( + echo %%f >> "%LST_FILE%" + ) ) -for %%f in ("%~dp0\..\..\src\*.h") do ( - echo %%f >> "%LST_FILE%" -) -REM ----------------------------------------------------------------- + +:: --------------------------------------------------------------------------- +:: UPDATE TS FILES +:: --------------------------------------------------------------------------- + for %%f in ("%~dp0\..\Translation\*.ts") do ( del %%f.bak 2> NUL copy %%f %%f.bak lupdate.exe "@%LST_FILE%" -no-obsolete -ts %%f + if not "!ERRORLEVEL!"=="0" ( + echo. && echo Something went wrong^^! + echo. && pause && exit + ) ) + lupdate.exe "@%LST_FILE%" -no-obsolete -pluralonly -ts "%~dp0\..\Translation\LameXP_EN.ts" del "%LST_FILE%" -echo ---------------------------------------------------------------- + +:: --------------------------------------------------------------------------- +:: GENERATE QM FILES +:: --------------------------------------------------------------------------- + for %%f in ("%~dp0\..\Translation\LameXP_??.ts") do ( lrelease.exe %%f -qm "%~dp0\..\..\res\localization\%%~nf.qm" + if not "!ERRORLEVEL!"=="0" ( + echo. && echo Something went wrong^^! + echo. && pause && exit + ) ) -echo ---------------------------------------------------------------- -set "LST_FILE=" -set "LAMEXP_ERROR=0" diff --git a/etc/Deployment/_mkdocs.bat b/etc/Deployment/_mkdocs.bat index 70d2db40..302d44f7 100644 --- a/etc/Deployment/_mkdocs.bat +++ b/etc/Deployment/_mkdocs.bat @@ -1,6 +1,12 @@ @echo off setlocal EnableDelayedExpansion +echo. +echo ---------------------------------------------------------------- +echo Building software documentation +echo ---------------------------------------------------------------- +echo. + :: ------------------------------------------ :: Setup Paths :: ------------------------------------------ @@ -11,16 +17,14 @@ call "%~dp0\_paths.bat" :: Create Documents :: ------------------------------------------ -echo ---------------------------------------------------------------- -echo Building software documentation -echo ---------------------------------------------------------------- -echo. - for %%i in ("%~dp0\..\..\doc\*.md") do ( echo PANDOC: %%~nxi "%PATH_PANDOC%\pandoc.exe" --from markdown_github+pandoc_title_block --to html5 --toc -N --standalone -H "%~dp0\..\Style\style.css" "%%~i" --output "%%~dpni.html" echo. - if not "!ERRORLEVEL!"=="0" goto:eof + if "!ERRORLEVEL!"=="0" ( + echo. && echo Creating the document has failed^^! + echo. && pause && exit + ) ) echo. diff --git a/etc/Deployment/_version.bat b/etc/Deployment/_version.bat index 739aef26..8670d1a2 100644 --- a/etc/Deployment/_version.bat +++ b/etc/Deployment/_version.bat @@ -1,6 +1,9 @@ @echo off -set "LAMEXP_ERROR=1" -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: CLEAR +:: --------------------------------------------------------------------------- + set "VER_LAMEXP_MAJOR=" set "VER_LAMEXP_MINOR_HI=" set "VER_LAMEXP_MINOR_LO=" @@ -8,31 +11,52 @@ set "VER_LAMEXP_BUILD=" set "VER_LAMEXP_TYPE=" set "VER_LAMEXP_PATCH=" set "VER_LAMEXP_BASENAME=" -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: PARSE CONFIG FILE +:: --------------------------------------------------------------------------- + for /f "tokens=2,*" %%s in (%~dp0\..\..\src\Config.h) do ( - if "%%s"=="VER_LAMEXP_MAJOR" set "VER_LAMEXP_MAJOR=%%~t" + if "%%s"=="VER_LAMEXP_MAJOR" set "VER_LAMEXP_MAJOR=%%~t" if "%%s"=="VER_LAMEXP_MINOR_HI" set "VER_LAMEXP_MINOR_HI=%%~t" if "%%s"=="VER_LAMEXP_MINOR_LO" set "VER_LAMEXP_MINOR_LO=%%~t" - if "%%s"=="VER_LAMEXP_BUILD" set "VER_LAMEXP_BUILD=%%~t" - if "%%s"=="VER_LAMEXP_TYPE" set "VER_LAMEXP_TYPE=%%~t" - if "%%s"=="VER_LAMEXP_PATCH" set "VER_LAMEXP_PATCH=%%~t" + if "%%s"=="VER_LAMEXP_BUILD" set "VER_LAMEXP_BUILD=%%~t" + if "%%s"=="VER_LAMEXP_TYPE" set "VER_LAMEXP_TYPE=%%~t" + if "%%s"=="VER_LAMEXP_PATCH" set "VER_LAMEXP_PATCH=%%~t" ) -REM ------------------------------------------ -set "LAMEXP_ERROR=1" -if "%VER_LAMEXP_MAJOR%"=="" GOTO:EOF -if "%VER_LAMEXP_MINOR_HI%"=="" GOTO:EOF -if "%VER_LAMEXP_MINOR_LO%"=="" GOTO:EOF -if "%VER_LAMEXP_BUILD%"=="" GOTO:EOF -if "%VER_LAMEXP_TYPE%"=="" GOTO:EOF -if "%VER_LAMEXP_PATCH%"=="" GOTO:EOF -REM ------------------------------------------ + +:: --------------------------------------------------------------------------- +:: CHECK RESULT +:: --------------------------------------------------------------------------- + +if "%VER_LAMEXP_MAJOR%"=="" goto:version_failure +if "%VER_LAMEXP_MINOR_HI%"=="" goto:version_failure +if "%VER_LAMEXP_MINOR_LO%"=="" goto:version_failure +if "%VER_LAMEXP_BUILD%"=="" goto:version_failure +if "%VER_LAMEXP_TYPE%"=="" goto:version_failure +if "%VER_LAMEXP_PATCH%"=="" goto:version_failure + +goto:version_success + +:version_failure +echo. && echo "Failed to set up build date!" +echo. && pause && exit + +:: --------------------------------------------------------------------------- +:: GET RELEASE TYPE +:: --------------------------------------------------------------------------- + +:version_success + set "VER_LAMEXP_BASENAME=LameXP" if "%VER_LAMEXP_TYPE%" == "Alpha" set "VER_LAMEXP_BASENAME=LameXP-ALPHA" -if "%VER_LAMEXP_TYPE%" == "Beta" set "VER_LAMEXP_BASENAME=LameXP-BETA" -if "%VER_LAMEXP_TYPE%" == "RC" set "VER_LAMEXP_BASENAME=LameXP-RC%VER_LAMEXP_PATCH%" -REM ------------------------------------------ -echo LameXP Version: -echo %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%, Build #%VER_LAMEXP_BUILD% (%VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%) +if "%VER_LAMEXP_TYPE%" == "Beta" set "VER_LAMEXP_BASENAME=LameXP-BETA" +if "%VER_LAMEXP_TYPE%" == "RC" set "VER_LAMEXP_BASENAME=LameXP-RC%VER_LAMEXP_PATCH%" + +:: --------------------------------------------------------------------------- +:: OUTPUT RESULT +:: --------------------------------------------------------------------------- + +echo. +echo LameXP Version: %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%, Build #%VER_LAMEXP_BUILD% (%VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%) echo. -REM ------------------------------------------ -set "LAMEXP_ERROR=0"