Refactoring git versioning

Added print about version ReGameDLL
This commit is contained in:
s1lentq 2016-01-21 23:36:05 +06:00
parent 2085f00203
commit e80480a400
11 changed files with 177 additions and 174 deletions

4
.gitignore vendored
View File

@ -2,6 +2,9 @@
**/.gradle
.idea
*.iml
*.bat
*.log
*.lnk
**/msvc/Debug*
**/msvc/Release*
**/msvc/Tests
@ -9,6 +12,7 @@
**/msvc/*.opensdf
**/msvc/*.user
**/msvc/*.suo
**/msvc/*.txt
**/msvc/ipch
regamedll/version/appversion.h

View File

@ -29,6 +29,7 @@ if (gitInfo.tag && gitInfo.tag[0] == 'v') {
majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
countCommit: gitInfo.countCommit,
lastCommitDate: gitInfo.lastCommitDate
)
} else {
@ -36,6 +37,7 @@ if (gitInfo.tag && gitInfo.tag[0] == 'v') {
majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int,
suffix: 'SNAPSHOT',
countCommit: gitInfo.countCommit,
lastCommitDate: gitInfo.lastCommitDate
)
}

View File

@ -1,33 +1,30 @@
apply plugin: 'groovy'
repositories {
//mavenLocal()
mavenCentral()
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/'
}
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/'
}
//mavenLocal()
mavenCentral()
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-releases/'
}
maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/regamedll-snapshots/'
}
}
dependencies {
compile gradleApi()
compile localGroovy()
compile 'commons-io:commons-io:2.4'
compile 'commons-lang:commons-lang:2.6'
compile 'joda-time:joda-time:2.7'
compile localGroovy()
compile 'commons-io:commons-io:2.4'
compile 'commons-lang:commons-lang:2.6'
compile 'joda-time:joda-time:2.7'
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'org.apache.commons:commons-compress:1.9'
compile 'org.apache.ant:ant-compress:1.2'
compile 'org.apache.ant:ant:1.9.6'
compile 'org.apache.commons:commons-compress:1.9'
compile 'org.apache.ant:ant-compress:1.2'
compile 'org.apache.ant:ant:1.9.6'
//compile 'org.tmatesoft.svnkit:svnkit:1.8.5'
//compile 'org.apache.velocity:velocity-tools:2.0'
compile 'org.apache.velocity:velocity:1.7'
compile 'org.apache.velocity:velocity:1.7'
}

View File

@ -6,7 +6,8 @@ import org.joda.time.DateTime
@CompileStatic @TypeChecked
class GitInfo {
DateTime lastCommitDate
String branch
String tag
DateTime lastCommitDate
String branch
String tag
Integer countCommit
}

View File

@ -2,8 +2,10 @@ package versioning
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.joda.time.DateTime
@ -12,30 +14,41 @@ import org.joda.time.DateTimeZone
@CompileStatic @TypeChecked
class GitVersioner {
static GitInfo versionForDir(String dir) {
versionForDir(new File(dir))
}
static GitInfo versionForDir(String dir) {
versionForDir(new File(dir))
}
static int getCountCommit(Repository repo) {
Iterable<RevCommit> commits = Git.wrap(repo).log().call()
int count = 0;
commits.each {
count++;
}
static GitInfo versionForDir(File dir) {
FileRepositoryBuilder builder = new FileRepositoryBuilder()
Repository repo = builder.setWorkTree(dir)
.findGitDir()
.build()
return count;
}
static GitInfo versionForDir(File dir) {
FileRepositoryBuilder builder = new FileRepositoryBuilder()
Repository repo = builder.setWorkTree(dir)
.findGitDir()
.build()
ObjectId head = repo.resolve('HEAD')
if (!head) {
return null
}
ObjectId head = repo.resolve('HEAD')
if (!head) {
return null
}
def commit = new RevWalk(repo).parseCommit(head)
def branch = repo.getBranch()
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC)
String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key
def commit = new RevWalk(repo).parseCommit(head)
def branch = repo.getBranch()
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC)
int commitCount = getCountCommit(repo);
return new GitInfo(
lastCommitDate: commitDate,
branch: branch,
tag: tag
)
}
String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key
return new GitInfo(
lastCommitDate: commitDate,
branch: branch,
tag: tag,
countCommit: commitCount
)
}
}

View File

@ -8,28 +8,30 @@ import org.joda.time.DateTime
@CompileStatic @TypeChecked
@ToString(includeNames = true)
class RegamedllVersionInfo {
int majorVersion
int minorVersion
Integer maintenanceVersion
String suffix
int majorVersion
int minorVersion
Integer maintenanceVersion
String suffix
Integer countCommit
DateTime lastCommitDate
DateTime lastCommitDate
String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) {
StringBuilder sb = new StringBuilder()
sb.append(majorVersion).append(versionSeparator).append(minorVersion)
if (maintenanceVersion != null) {
sb.append(versionSeparator).append(maintenanceVersion)
}
String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) {
StringBuilder sb = new StringBuilder()
sb.append(majorVersion).append(versionSeparator).append(minorVersion)
if (maintenanceVersion != null) {
sb.append(versionSeparator).append(maintenanceVersion)
}
if (suffix && includeSuffix) {
sb.append(suffixSeparator).append(suffix)
}
if (suffix && includeSuffix) {
sb.append(suffixSeparator).append(suffix)
}
return sb.toString()
}
String asMavenVersion() {
format('.', '-', true)
}
return sb.toString()
}
String asVersion() {
sprintf("%i.%i.%i", majorVersion, minorVersion, countCommit)
}
String asMavenVersion() {
format('.', '-', true)
}
}

View File

@ -1,5 +1,7 @@
#include "precompiled.h"
// Move towards currently heard noise
/* <5b3114> ../cstrike/dlls/bot/states/cs_bot_investigate_noise.cpp:17 */
NOBODY void InvestigateNoiseState::AttendCurrentNoise(CCSBot *me)
{

View File

@ -405,12 +405,22 @@ cvar_t sk_scientist_heal3;
#ifdef REGAMEDLL_ADD
cvar_t game_version = { "game_version", APP_VERSION_STRD, FCVAR_SERVER, 0.0f, NULL };
cvar_t maxmoney = { "mp_maxmoney", "16000", FCVAR_SERVER, 0.0f, NULL };
cvar_t minmoney = { "mp_minmoney", "800", FCVAR_SERVER, 0.0f, NULL };
cvar_t round_infinite = { "mp_round_infinite", "0", FCVAR_SERVER, 0.0f, NULL };
#endif // REGAMEDLL_ADD
void GameDLL_Version_f(void)
{
if (Q_stricmp(CMD_ARGV(1), "version") != 0)
return;
// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");
CONSOLE_ECHO("ReGameDLL API version %i.%i\n", REGAMEDLL_API_VERSION_MAJOR, REGAMEDLL_API_VERSION_MINOR);
}
/* <9c900> ../cstrike/dlls/game.cpp:500 */
void EXT_FUNC GameDLLInit(void)
{
@ -503,10 +513,16 @@ void EXT_FUNC GameDLLInit(void)
#ifdef REGAMEDLL_ADD
ADD_SERVER_COMMAND("game", GameDLL_Version_f);
CVAR_REGISTER(&game_version);
CVAR_REGISTER(&maxmoney);
CVAR_REGISTER(&minmoney);
CVAR_REGISTER(&round_infinite);
// print version
CONSOLE_ECHO("ReGameDLL build: " __TIME__ " " __DATE__ " (" APP_VERSION_STRD ")\n");
CONSOLE_ECHO("ReGameDLL API version %i.%i\n", REGAMEDLL_API_VERSION_MAJOR, REGAMEDLL_API_VERSION_MINOR);
#endif // REGAMEDLL_ADD
Bot_RegisterCvars();

View File

@ -6,22 +6,21 @@
SET srcdir=%~1
SET repodir=%~2
set old_version=
SET old_version=
set old_specialbuild=""
set version_revision=0
SET version_revision=0
set version_specialbuild=
set version_date=?
set version_pdate=
set version_pdate_1=
set version_pdate_2=
set version_major=
set version_minor=
set version_maintenance=
SET version_pdate_1=%date:~-4%-%date:~3,2%-%date:~0,2%
SET version_pdate=%version_pdate_1% %time:~0,2%:%time:~3,2%:%time:~6,2%
SET version_date=%version_pdate_1%__%time:~0,2%-%time:~3,2%-%time:~6,2%
SET version_major=0
SET version_minor=0
SET version_specialversion=
::
:: Check for SubWCRev.exe presence
:: Check for git.exe presence
::
SubWCRev.exe 2>NUL >NUL
CALL git.exe describe >NUL 2>&1
set errlvl="%ERRORLEVEL%"
::
@ -36,109 +35,71 @@ IF EXIST "%srcdir%\appversion.h" (
)
)
IF NOT %errlvl% == "1" (
echo can't locate SubWCRev.exe - auto-versioning step won't be performed
IF %errlvl% == "1" (
echo can't locate git.exe - auto-versioning step won't be performed
:: if we haven't appversion.h, we need to create it
IF "%old_version%" == "" (
set version_revision=0
set version_date=?
goto _readVersionH
IF NOT "%old_version%" == "" (
SET version_revision=0
)
exit /B 0
)
::
:: Create template file for SubWCRev
:: Read major, minor and maintenance version components from Version.h
::
:GETTEMPNAME
:: Use current path, current time and random number to create unique file name
SET TMPFILE=svn-%CD:~-15%-%RANDOM%-%TIME:~-5%-%RANDOM%
:: Remove bad characters
SET TMPFILE=%TMPFILE:\=%
SET TMPFILE=%TMPFILE:.=%
SET TMPFILE=%TMPFILE:,=%
SET TMPFILE=%TMPFILE: =%
:: Will put in a temporary directory
SET TMPFILE=%TMP%.\%TMPFILE%
IF EXIST "%TMPFILE%" GOTO :GETTEMPNAME
echo #define SVNV_REVISION ^$WCREV^$ >"%TMPFILE%.templ"
echo #define SVNV_DATE ^$WCDATE=^%%Y-^%%m-^%%d__^%%H-^%%M-^%%S^$ >>"%TMPFILE%.templ"
echo #define SVNV_PDATE_1 ^$WCDATE=^%%Y-^%%m-^%%d^$ >>"%TMPFILE%.templ"
echo #define SVNV_PDATE_2 ^$WCDATE=^%%H:^%%M:^%%S^$ >>"%TMPFILE%.templ"
echo . >>"%TMPFILE%.templ"
::
:: Process template
::
SubWCRev.exe "%repodir%\." "%TMPFILE%.templ" "%TMPFILE%.h" >NUL
IF NOT "%ERRORLEVEL%" == "0" (
echo SubWCRev.exe done with errors [%ERRORLEVEL%].
echo Check if you have correct SVN repository at '%repodir%'
echo Auto-versioning step will not be performed.
DEL /F /Q "%TMPFILE%.templ" 2>NUL
DEL /F /Q "%TMPFILE%.h" 2>NUL
:: if we haven't appversion.h, we need to create it
IF "%old_version%" == "" (
set version_revision=0
set version_date=?
goto _readVersionH
IF EXIST "%srcdir%\version.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
IF %%i==#define (
IF %%j==VERSION_MAJOR SET version_major=%%k
IF %%j==VERSION_MINOR SET version_minor=%%k
IF %%j==VERSION_SPECIALVERSION SET version_specialversion=%%k
)
)
) ELSE (
FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do (
IF NOT [%%j] == [] (
IF %%i==majorVersion SET version_major=%%j
IF %%i==minorVersion SET version_minor=%%j
IF %%i==specialVersion SET version_specialversion=%%j
)
)
exit /B 0
)
DEL /F /Q "%TMPFILE%.templ" 2>NUL
::
:: Read revision and release date from it
::
FOR /F "usebackq tokens=1,2,3" %%i in ("%TMPFILE%.h") do (
IF %%i==#define (
IF %%j==SVNV_REVISION SET version_revision=%%k
IF %%j==SVNV_DATE SET version_date=%%k
IF %%j==SVNV_PDATE_1 SET version_pdate_1=%%k
IF %%j==SVNV_PDATE_2 SET version_pdate_2=%%k
)
)
DEL /F /Q "%TMPFILE%.h" 2>NUL
SET version_pdate=%version_pdate_1% %version_pdate_2%
::
:: Detect local modifications
::
SubWCRev.exe "%repodir%\." -nm >NUL
IF "%ERRORLEVEL%" == "7" (
set version_specialbuild=m
) ELSE (
set version_specialbuild=
)
:_readVersionH
::
:: Read major, minor and maintenance version components from Version.h
::
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
IF %%i==#define (
IF %%j==VERSION_MAJOR SET version_major=%%k
IF %%j==VERSION_MINOR SET version_minor=%%k
IF %%j==VERSION_MAINTENANCE SET version_maintenance=%%k
IF NOT %errlvl% == "1" (
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --all | wc -l"') DO (
IF NOT [%%i] == [] (
set version_revision=%%i
)
)
)
::
:: Now form full version string like 1.0.0.1
::
IF "%version_maintenance%" == "" (
set new_version=%version_major%,%version_minor%,0,%version_revision%
set new_version=%version_major%,%version_minor%,0,%version_revision%
::
:: Detect local modifications
::
SET localChanged=0
IF NOT %errlvl% == "1" (
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO (
SET localChanged=1
)
)
IF [%localChanged%]==[1] (
IF NOT [%version_specialversion%] == [] (
set version_specialbuild=%version_specialversion%
) ELSE (
set version_specialbuild=m
)
) ELSE (
set new_version=%version_major%,%version_minor%,%version_maintenance%,%version_revision%
set version_specialbuild=
)
::
@ -162,14 +123,16 @@ echo // >>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo // Version defines>>"%srcdir%\appversion.h"
IF "%version_maintenance%" == "" (
IF "%version_specialversion%" == "" (
echo #define APP_VERSION_D %version_major%.%version_minor%.%version_revision% >>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_revision%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_C %version_major%,%version_minor%,0,%version_revision% >>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, 0, %version_revision%">>"%srcdir%\appversion.h"
) ELSE (
echo #define APP_VERSION_D %version_major%.%version_minor%.%version_maintenance%.%version_revision% >>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRD "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRD_RC "%version_major%.%version_minor%.%version_maintenance%.%version_revision%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_C %version_major%,%version_minor%,%version_maintenance%,%version_revision% >>"%srcdir%\appversion.h"
echo #define APP_VERSION_STRCS "%version_major%, %version_minor%, %version_maintenance%, %version_revision%">>"%srcdir%\appversion.h"
)
@ -186,10 +149,10 @@ echo.>>"%srcdir%\appversion.h"
IF NOT "%version_specialbuild%" == "" (
echo #define APP_VERSION_FLAGS VS_FF_SPECIALBUILD>>"%srcdir%\appversion.h"
echo #define APP_VERSION_SPECIALBUILD "%version_specialbuild%">>"%srcdir%\appversion.h"
echo #define APP_VERSION APP_VERSION_STRD "" APP_VERSION_SPECIALBUILD "" VERSION_POSTFIX>>"%srcdir%\appversion.h"
echo #define APP_VERSION APP_VERSION_STRD "" APP_VERSION_SPECIALBUILD>>"%srcdir%\appversion.h"
) ELSE (
echo #define APP_VERSION_FLAGS 0x0L>>"%srcdir%\appversion.h"
echo #define APP_VERSION APP_VERSION_STRD "" VERSION_POSTFIX>>"%srcdir%\appversion.h"
echo #define APP_VERSION APP_VERSION_STRD>>"%srcdir%\appversion.h"
)
echo.>>"%srcdir%\appversion.h"

View File

@ -1089,7 +1089,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1126,7 +1126,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1162,7 +1162,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1198,7 +1198,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug MP Play|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1234,7 +1234,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1270,7 +1270,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1309,7 +1309,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
<Message>Setup version from SVN revision</Message>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@ -11,10 +11,13 @@
\#define VERSION_MINOR ${verInfo.minorVersion}
\#define APP_VERSION_D ${verInfo.format('.', '-', true)}
\#define APP_VERSION_STRD "${verInfo.format('.', '-', true)}"
\#define APP_VERSION_C ${verInfo.majorVersion},${verInfo.minorVersion},0,${verInfo.countCommit}
\#define APP_VERSION_STRD "${verInfo.majorVersion}.${verInfo.minorVersion}.${verInfo.countCommit}"
\#define APP_VERSION_STRD_RC "${verInfo.majorVersion}.${verInfo.minorVersion}.${verInfo.countCommit}"
#set ( $commitYMD = $_DateTimeFormat.forPattern('yyyy-MM-dd').print($verInfo.lastCommitDate) )
\#define APP_VERSION_YMD_STR "${commitYMD}"
\#define APP_VERSION APP_VERSION_STRD
#endif //__APPVERSION_H__