mirror of https://github.com/infosecn1nja/C3.git
Update versioning header and build script
parent
a54ba7cf76
commit
3d2d44a24c
|
@ -1,17 +1,33 @@
|
||||||
@REM This script requires MSBuild in PATH.
|
@REM This script requires MSBuild in PATH.
|
||||||
|
|
||||||
@REM Adjust values below before running this script.
|
|
||||||
@SETLOCAL
|
@SETLOCAL
|
||||||
@SET BUILD_MAJOR_NO=1
|
|
||||||
@SET BUILD_MINOR_NO=1
|
|
||||||
@SET BUILD_REVISION_NO=0
|
|
||||||
@SET BUILD_PREFIX=C3
|
|
||||||
@SET BUILD_HEADER_FILE=Src\Common\C3_BUILD_VERSION_HASH_PART.hxx
|
@SET BUILD_HEADER_FILE=Src\Common\C3_BUILD_VERSION_HASH_PART.hxx
|
||||||
@SET BUILDS_PATH=Builds
|
@SET BUILDS_PATH=Builds
|
||||||
|
|
||||||
|
@REM set C3_BUILD_LABEL variable before running this script or edit here and uncomment
|
||||||
|
@REM @SET C3_BUILD_LABEL=
|
||||||
|
|
||||||
@REM Script part starts here.
|
@REM Script part starts here.
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Search BUILD_HEADER_FILE to find a line with build number
|
||||||
|
FOR /F "tokens=* USEBACKQ" %%F IN (`findstr C3_BUILD_VERSION %BUILD_HEADER_FILE%`) DO (
|
||||||
|
SET HeaderLine=%%F
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Retreive version string
|
||||||
|
FOR /F "tokens=3" %%a IN ("%HeaderLine%") DO (
|
||||||
|
SET VersionFromHeader=%%~a
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Parse version stirng (following semver schema x.y.z-label)
|
||||||
|
FOR /F "tokens=1,2,3,4 delims=-." %%a IN ("%VersionFromHeader%") DO (
|
||||||
|
SET BUILD_PREFIX=%%a
|
||||||
|
SET BUILD_MAJOR_NO=%%b
|
||||||
|
SET BUILD_MINOR_NO=%%c
|
||||||
|
SET BUILD_REVISION_NO=%%d
|
||||||
|
)
|
||||||
|
|
||||||
ECHO Cleaning from temporary files...
|
ECHO Cleaning from temporary files...
|
||||||
@CALL CleanTempFiles.cmd >nul 2>nul
|
@CALL CleanTempFiles.cmd >nul 2>nul
|
||||||
|
|
||||||
|
@ -20,6 +36,7 @@ IF EXIST "%BUILDS_PATH%" (RMDIR /s /q "%BUILDS_PATH%")
|
||||||
MKDIR %BUILDS_PATH%
|
MKDIR %BUILDS_PATH%
|
||||||
|
|
||||||
SET BUILD_FULL_SIGNATURE=%BUILD_PREFIX%-%BUILD_MAJOR_NO%.%BUILD_MINOR_NO%.%BUILD_REVISION_NO%
|
SET BUILD_FULL_SIGNATURE=%BUILD_PREFIX%-%BUILD_MAJOR_NO%.%BUILD_MINOR_NO%.%BUILD_REVISION_NO%
|
||||||
|
IF DEFINED C3_BUILD_LABEL SET BUILD_FULL_SIGNATURE=%BUILD_FULL_SIGNATURE%-%C3_BUILD_LABEL%
|
||||||
|
|
||||||
ECHO Creating build folder - '%BUILD_FULL_SIGNATURE%'...
|
ECHO Creating build folder - '%BUILD_FULL_SIGNATURE%'...
|
||||||
IF EXIST %BUILDS_PATH%\\%BUILD_FULL_SIGNATURE% (RMDIR /s /q "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%")
|
IF EXIST %BUILDS_PATH%\\%BUILD_FULL_SIGNATURE% (RMDIR /s /q "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%")
|
||||||
|
@ -27,8 +44,8 @@ MKDIR %BUILDS_PATH%\\%BUILD_FULL_SIGNATURE% || GOTO :ERROR
|
||||||
|
|
||||||
ECHO Creating build versioning header...
|
ECHO Creating build versioning header...
|
||||||
SET BuildDefinition=#define C3_BUILD_VERSION
|
SET BuildDefinition=#define C3_BUILD_VERSION
|
||||||
ECHO #include "StdAfx.h" > %BUILD_HEADER_FILE% || GOTO :ERROR
|
ECHO #include "StdAfx.h"> %BUILD_HEADER_FILE% || GOTO :ERROR
|
||||||
ECHO %BuildDefinition% "%BUILD_FULL_SIGNATURE%" >> %BUILD_HEADER_FILE% || GOTO :ERROR
|
ECHO %BuildDefinition% "%BUILD_FULL_SIGNATURE%">> %BUILD_HEADER_FILE% || GOTO :ERROR
|
||||||
|
|
||||||
|
|
||||||
if ""=="%~1" (
|
if ""=="%~1" (
|
||||||
|
@ -72,6 +89,11 @@ ECHO Copying scripts...
|
||||||
COPY "StartWebController.cmd" "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%\\StartWebController.cmd" || GOTO :ERROR
|
COPY "StartWebController.cmd" "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%\\StartWebController.cmd" || GOTO :ERROR
|
||||||
COPY "RestartWebController.cmd" "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%\\RestartWebController.cmd" || GOTO :ERROR
|
COPY "RestartWebController.cmd" "%BUILDS_PATH%\\%BUILD_FULL_SIGNATURE%\\RestartWebController.cmd" || GOTO :ERROR
|
||||||
|
|
||||||
|
ECHO.
|
||||||
|
ECHO Restoring version header...
|
||||||
|
ECHO #include "StdAfx.h"> %BUILD_HEADER_FILE% || GOTO :ERROR
|
||||||
|
ECHO %BuildDefinition% "%VersionFromHeader%">> %BUILD_HEADER_FILE% || GOTO :ERROR
|
||||||
|
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO Done. Build %BUILD_FULL_SIGNATURE% successfully created.
|
ECHO Done. Build %BUILD_FULL_SIGNATURE% successfully created.
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#include "StdAfx.h"
|
#include "StdAfx.h"
|
||||||
#define C3_BUILD_VERSION "C3-1.0.manual-build"
|
#define C3_BUILD_VERSION "C3-1.1.0-manual"
|
||||||
|
|
Loading…
Reference in New Issue