From 2ca225b41f515474c70b09f325b0e88f6e836992 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Thu, 19 Apr 2018 23:35:38 +0200 Subject: [PATCH] Some improvements to the deployment script. --- ReadMe.txt | 36 ++++++++------- etc/Deployment/_date.bat | 13 ++++-- etc/Deployment/_paths.bat | 14 +++--- etc/Deployment/_revision.bat | 65 ++++++++++++++++++++++++++++ etc/Deployment/buildenv.template.txt | 1 + etc/Deployment/make.bat | 38 ++++++++++++---- etc/NSIS/setup.nsi | 1 + src/Config.h | 2 +- 8 files changed, 133 insertions(+), 37 deletions(-) create mode 100644 etc/Deployment/_revision.bat diff --git a/ReadMe.txt b/ReadMe.txt index 132cac84..3310c2ca 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,25 +1,23 @@ +LameXP - Audio Encoder Front-End +Copyright (C) 2004-2018 LoRd_MuldeR +http://www.muldersoft.com/ - LameXP - Audio Encoder Front-End - Copyright (C) 2004-2018 LoRd_MuldeR - http://www.muldersoft.com/ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version, but always including the *additional* +restrictions defined in the "License.txt" file. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version, but always including the *additional* - restrictions defined in the "License.txt" file. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - http://www.gnu.org/licenses/gpl-2.0.txt +http://www.gnu.org/licenses/gpl-2.0.txt - - For more information, please see the LameXP manual at: doc/Manual.html +For more information, please see the LameXP manual at: doc/Manual.html diff --git a/etc/Deployment/_date.bat b/etc/Deployment/_date.bat index d68d93ce..32c2a0a1 100644 --- a/etc/Deployment/_date.bat +++ b/etc/Deployment/_date.bat @@ -5,10 +5,12 @@ :: --------------------------------------------------------------------------- set "ISO_DATE=" +set "ISO_TIME=" if exist "%~dp0\..\..\..\Prerequisites\GnuWin32\date.exe" ( - for /F "tokens=1,2 delims=:" %%a in ('"%~dp0\..\..\..\Prerequisites\GnuWin32\date.exe" +ISODATE:%%Y-%%m-%%d') do ( - if "%%a"=="ISODATE" set "ISO_DATE=%%b" + for /F "usebackq tokens=1,2" %%a in (`start /B "date" "%~dp0\..\..\..\Prerequisites\GnuWin32\date.exe" +"%%Y-%%m-%%d %%H:%%M:%%S"`) do ( + set "ISO_DATE=%%a" + set "ISO_TIME=%%b" ) ) @@ -17,6 +19,11 @@ if "%ISO_DATE%"=="" ( pause && exit ) +if "%ISO_TIME%"=="" ( + "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" red "\nFailed to set up build time!\n" + pause && exit +) + echo. -echo Build Date: %ISO_DATE% +echo Build Date/Time: %ISO_DATE% %ISO_TIME% echo. diff --git a/etc/Deployment/_paths.bat b/etc/Deployment/_paths.bat index 10857aa0..49087d33 100644 --- a/etc/Deployment/_paths.bat +++ b/etc/Deployment/_paths.bat @@ -4,7 +4,7 @@ :: Paths already initialized? :: ------------------------------------------ -if "%_LAMEXP_PATHS_INITIALIZED_%"=="%DATE%" ( +if "%_LAMEXP_PATH_INIT%"=="%DATE%" ( goto:eof ) @@ -14,6 +14,7 @@ if "%_LAMEXP_PATHS_INITIALIZED_%"=="%DATE%" ( set "PATH_MSCDIR=" set "PATH_QTMSVC=" +set "PATH_GITWIN=" set "PATH_VCTOOL=" set "PATH_VCPROJ=" @@ -38,6 +39,7 @@ if not exist "%BUILDENV_TXT%" ( for /f "tokens=2,*" %%s in (%BUILDENV_TXT%) do ( if "%%s"=="PATH_MSCDIR" set "PATH_MSCDIR=%%~t" if "%%s"=="PATH_QTMSVC" set "PATH_QTMSVC=%%~t" + if "%%s"=="PATH_GITWIN" set "PATH_GITWIN=%%~t" if "%%s"=="PATH_VCTOOL" set "PATH_VCTOOL=%%~t" if "%%s"=="PATH_VCPROJ" set "PATH_VCPROJ=%%~t" ) @@ -51,6 +53,7 @@ set "BUILDENV_TXT=" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "\n========== BEGIN PATHS ==========" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "PATH_MSCDIR = \"%PATH_MSCDIR:\=\\%\"" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "PATH_QTMSVC = \"%PATH_QTMSVC:\=\\%\"" +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "PATH_GITWIN = \"%PATH_GITWIN:\=\\%\"" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "PATH_VCTOOL = \"%PATH_VCTOOL:\=\\%\"" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "PATH_VCPROJ = \"%PATH_VCPROJ:\=\\%\"" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "=========== END PATHS ===========\n" @@ -63,14 +66,15 @@ call:validate_path PATH_MSCDIR "%PATH_MSCDIR%\vcvarsall.bat" call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\uic.exe" call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\moc.exe" call:validate_path PATH_QTMSVC "%PATH_QTMSVC%\bin\rcc.exe" +call:validate_path PATH_GITWIN "%PATH_GITWIN%\bin\git.exe" call:validate_path PATH_VCPROJ "%~dp0\..\..\%PATH_VCPROJ%" :: ------------------------------------------ :: Locate Qt Path :: ------------------------------------------ -if exist "%PATH_QTMSVC%\bin\qtvars.bat" goto:exit_success -if exist "%PATH_QTMSVC%\bin\qtenv2.bat" goto:exit_success +if exist "%PATH_QTMSVC%\bin\qtvars.bat" goto:path_success +if exist "%PATH_QTMSVC%\bin\qtenv2.bat" goto:path_success "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" red "\nCould not find \"qtvars.bat\" or \"qtenv2.bat\" in your Qt path!\n\nPlease check your PATH_QTMSVC path variable and try again...\n" pause && exit @@ -90,5 +94,5 @@ goto:eof :: Completed :: ------------------------------------------ -:exit_success -set "_LAMEXP_PATHS_INITIALIZED_=%DATE%" +:path_success +set "_LAMEXP_PATH_INIT=%DATE%" diff --git a/etc/Deployment/_revision.bat b/etc/Deployment/_revision.bat new file mode 100644 index 00000000..a431124c --- /dev/null +++ b/etc/Deployment/_revision.bat @@ -0,0 +1,65 @@ +@echo off + +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" cyan "\n===========================================================================" +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" cyan "Detecting Git revision..." +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" cyan "===========================================================================\n" + +:: --------------------------------------------------------------------------- +:: SETUP PATHS +:: --------------------------------------------------------------------------- + +call "%~dp0\_paths.bat" +cd /d "%~dp0" + +:: --------------------------------------------------------------------------- +:: CLEAR VARIABLES +:: --------------------------------------------------------------------------- + +set "GIT_REV_NAME=" +set "GIT_REV_HASH=" +set "GIT_REV_NMBR=" +set "GIT_REV_DATE=" +set "GIT_REV_TIME=" + +:: --------------------------------------------------------------------------- +:: DETECT THE GIT REVISION +:: --------------------------------------------------------------------------- + +for /f "usebackq tokens=1" %%i in (`"%PATH_GITWIN%\bin\git.exe" rev-parse --abbrev-ref HEAD`) do ( + set "GIT_REV_NAME=%%~i" +) + +for /f "usebackq tokens=1" %%i in (`"%PATH_GITWIN%\bin\git.exe" rev-parse --short HEAD`) do ( + set "GIT_REV_HASH=%%~i" +) + +for /f "usebackq tokens=1" %%i in (`"%PATH_GITWIN%\bin\git.exe" rev-list --count HEAD`) do ( + set "GIT_REV_NMBR=%%~i" +) + +for /f "usebackq tokens=1,2" %%i in (`"%PATH_GITWIN%\bin\git.exe" log -1 --format^=%%ci HEAD`) do ( + set "GIT_REV_DATE=%%~i" + set "GIT_REV_TIME=%%~j" +) + +:: ------------------------------------------ +:: VALIDATE RESULT +:: ------------------------------------------ + +if "%GIT_REV_NAME%"=="" goto git_rev_incomplete +if "%GIT_REV_HASH%"=="" goto git_rev_incomplete +if "%GIT_REV_NMBR%"=="" goto git_rev_incomplete +if "%GIT_REV_DATE%"=="" goto git_rev_incomplete +if "%GIT_REV_TIME%"=="" goto git_rev_incomplete +goto git_rev_complete + +:git_rev_incomplete +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" red "\nFailed to determine the current Git revision!\n" +pause && exit + +:: ------------------------------------------ +:: Completed +:: ------------------------------------------ + +:git_rev_complete +"%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" yellow "Git revision: %GIT_REV_NAME%+%GIT_REV_NMBR%-%GIT_REV_HASH% [%GIT_REV_DATE%]" diff --git a/etc/Deployment/buildenv.template.txt b/etc/Deployment/buildenv.template.txt index 3c9799b0..79b14e4a 100644 --- a/etc/Deployment/buildenv.template.txt +++ b/etc/Deployment/buildenv.template.txt @@ -1,4 +1,5 @@ #define PATH_MSCDIR "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build" #define PATH_QTMSVC "C:\QtSDK\Desktop\Qt\4.8.7" +#define PATH_GITWIN "C:\Program Files\Git" #define PATH_VCTOOL "141" #define PATH_VCPROJ "LameXP_VS2017.sln" diff --git a/etc/Deployment/make.bat b/etc/Deployment/make.bat index fabf92a2..96ea9942 100644 --- a/etc/Deployment/make.bat +++ b/etc/Deployment/make.bat @@ -65,6 +65,7 @@ call "%~dp0\_build.bat" "%~dp0\..\..\%PATH_VCPROJ%" "%LAMEXP_PLATFORM%" "%LAMEXP :: --------------------------------------------------------------------------- call "%~dp0\_version.bat" +call "%~dp0\_revision.bat" :: --------------------------------------------------------------------------- :: GENERATE OUTPUT FILE NAME @@ -149,12 +150,39 @@ if exist "%~dp0\_postproc.bat" ( call "%~dp0\_postproc.bat" "%TMP_PATH%" ) +echo Release: %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO%.%VER_LAMEXP_BUILD%> "%TMP_PATH%\LameXP.tag" +echo Git-%GIT_REV_NAME%-r%GIT_REV_NMBR%-%GIT_REV_HASH% [%GIT_REV_DATE%] [%GIT_REV_TIME%]>> "%TMP_PATH%\LameXP.tag" + attrib +R "%TMP_PATH%\*.txt" attrib +R "%TMP_PATH%\*.html" attrib +R "%TMP_PATH%\*.exe" attrib +R "%TMP_PATH%\*.dll" +attrib +R "%TMP_PATH%\*.tag" attrib +R "%TMP_PATH%\*.xml" +:: --------------------------------------------------------------------------- +:: CREATE TAG +:: --------------------------------------------------------------------------- + +echo LameXP - Audio Encoder Front-End> "%OUT_FILE%.txt" +echo Release: %VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%%VER_LAMEXP_MINOR_LO% %VER_LAMEXP_TYPE%-%VER_LAMEXP_PATCH%, Build #%VER_LAMEXP_BUILD% [%ISO_DATE%] [%ISO_TIME%]>> "%OUT_FILE%.txt" +echo Git-%GIT_REV_NAME%-r%GIT_REV_NMBR%-%GIT_REV_HASH% [%GIT_REV_DATE%] [%GIT_REV_TIME%]>> "%OUT_FILE%.txt" +echo.>> "%OUT_FILE%.txt" + +echo ------------------------------------------------------------------------------>> "%OUT_FILE%.txt" +echo README.TXT>> "%OUT_FILE%.txt" +echo ------------------------------------------------------------------------------>> "%OUT_FILE%.txt" +echo.>> "%OUT_FILE%.txt" +"%~dp0\..\..\..\Prerequisites\GnuWin32\cat.exe" "%~dp0\..\..\ReadMe.txt" >> "%OUT_FILE%.txt" +echo.>> "%OUT_FILE%.txt" + +echo ------------------------------------------------------------------------------>> "%OUT_FILE%.txt" +echo LICENSE.TXT>> "%OUT_FILE%.txt" +echo ------------------------------------------------------------------------------>> "%OUT_FILE%.txt" +echo.>> "%OUT_FILE%.txt" +"%~dp0\..\..\..\Prerequisites\GnuWin32\cat.exe" "%~dp0\..\..\License.txt" >> "%OUT_FILE%.txt" +echo.>> "%OUT_FILE%.txt" + :: --------------------------------------------------------------------------- :: BUILD INSTALLER :: --------------------------------------------------------------------------- @@ -163,14 +191,6 @@ attrib +R "%TMP_PATH%\*.xml" "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" cyan "Creating release packages..." "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" cyan "===========================================================================\n" -"%~dp0\..\..\..\Prerequisites\GnuWin32\echo.exe" " LameXP - Audio Encoder Front-End > "%OUT_FILE%.txt" -"%~dp0\..\..\..\Prerequisites\GnuWin32\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\..\..\..\Prerequisites\GnuWin32\echo.exe" " Built on %ISO_DATE% at %TIME%\n\n >> "%OUT_FILE%.txt" -"%~dp0\..\..\..\Prerequisites\GnuWin32\echo.exe" " ---------------------------\nREADME.TXT\n--------------------------- >> "%OUT_FILE%.txt" -"%~dp0\..\..\..\Prerequisites\GnuWin32\cat.exe" "%~dp0\..\..\ReadMe.txt" >> "%OUT_FILE%.txt" -"%~dp0\..\..\..\Prerequisites\GnuWin32\echo.exe" "\n\n---------------------------\nLICENSE.TXT\n---------------------------\n >> "%OUT_FILE%.txt" -"%~dp0\..\..\..\Prerequisites\GnuWin32\cat.exe" "%~dp0\..\..\License.txt" >> "%OUT_FILE%.txt" - pushd "%TMP_PATH%" "%~dp0\..\..\..\Prerequisites\GnuWin32\zip.exe" -r -9 -z "%OUT_FILE%.zip" "*.*" < "%OUT_FILE%.txt" popd @@ -195,7 +215,7 @@ if %ERRORLEVEL% NEQ 0 ( set "VER_FILEVER=%VER_LAMEXP_MAJOR%.%VER_LAMEXP_MINOR_HI%.%VER_LAMEXP_MINOR_LO%.%VER_LAMEXP_PATCH%" set "VER_PRODUCT=LameXP - Audio Encoder Front-End" -"%~dp0\..\..\..\Prerequisites\VerPatch\verpatch.exe" "%OUT_FILE%.exe" "%VER_FILEVER%" /pv "%VER_FILEVER%" /fn /s desc "%VER_PRODUCT%" /s product "%VER_PRODUCT%" /s title "LameXP Installer SFX" /s copyright "Copyright (C) LoRd_MuldeR" /s company "Free Software Foundation" +"%~dp0\..\..\..\Prerequisites\VerPatch\verpatch.exe" "%OUT_FILE%.exe" "%VER_FILEVER%" /pv "%VER_FILEVER%" /fn /s desc "%VER_PRODUCT%" /s product "%VER_PRODUCT%" /s title "LameXP Installer SFX" /s copyright "Copyright (C) LoRd_MuldeR" /s company "Free Software Foundation" /sc "Git-%GIT_REV_NAME%-r%GIT_REV_NMBR%-%GIT_REV_HASH% [%GIT_REV_DATE%] [%GIT_REV_TIME%]" if %ERRORLEVEL% NEQ 0 ( "%~dp0\..\..\..\Prerequisites\CEcho\cecho.exe" red "\nFailed to build installer^!\n" pause && exit diff --git a/etc/NSIS/setup.nsi b/etc/NSIS/setup.nsi index 44946360..5cc23570 100644 --- a/etc/NSIS/setup.nsi +++ b/etc/NSIS/setup.nsi @@ -576,6 +576,7 @@ Section "!Install Files" ${StdUtils.GetFileNamePart} $R1 "$R0" File /a `/oname=$R1.VisualElementsManifest.xml` `${LAMEXP_SOURCE_PATH}\LameXP.VisualElementsManifest.xml` + File /a `/oname=$R1.tag` `${LAMEXP_SOURCE_PATH}\LameXP.tag` File /a /r `${LAMEXP_SOURCE_PATH}\*.txt` File /a /r `${LAMEXP_SOURCE_PATH}\*.html` diff --git a/src/Config.h b/src/Config.h index 602080f6..9accd686 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_TYPE RC #define VER_LAMEXP_PATCH 5 -#define VER_LAMEXP_BUILD 2126 +#define VER_LAMEXP_BUILD 2128 #define VER_LAMEXP_CONFG 2002 ///////////////////////////////////////////////////////////////////////////////