2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-30 15:38:05 +03:00

Refactoring of versioning

This commit is contained in:
s1lentq 2016-11-07 19:27:06 +07:00
parent be450ea340
commit 4090ff3db5
16 changed files with 334 additions and 213 deletions

View File

@ -26,14 +26,22 @@ if (gitInfo && gitInfo.tag && gitInfo.tag[0] == 'v') {
majorVersion: m.group(1) as int, majorVersion: m.group(1) as int,
minorVersion: m.group(2) as int, minorVersion: m.group(2) as int,
maintenanceVersion: m.group(4) ? (m.group(4) as int) : null, maintenanceVersion: m.group(4) ? (m.group(4) as int) : null,
lastCommitDate: gitInfo.lastCommitDate localChanges: gitInfo.localChanges,
commitDate: gitInfo.commitDate,
commitSHA: gitInfo.commitSHA,
commitURL: gitInfo.commitURL
) )
} else { } else {
versionInfo = new RehldsVersionInfo( versionInfo = new RehldsVersionInfo(
majorVersion: project.majorVersion as int, majorVersion: project.majorVersion as int,
minorVersion: project.minorVersion as int, minorVersion: project.minorVersion as int,
suffix: 'SNAPSHOT', maintenanceVersion: project.maintenanceVersion as int,
lastCommitDate: gitInfo ? gitInfo.lastCommitDate : new DateTime() suffix: 'dev',
localChanges: gitInfo ? gitInfo.localChanges : true,
commitDate: gitInfo ? gitInfo.commitDate : new DateTime(),
commitSHA: gitInfo ? gitInfo.commitSHA : "",
commitURL: gitInfo ? gitInfo.commitURL : "",
commitCount: gitInfo ? (gitInfo.commitCount as int) : null
) )
} }

View File

@ -9,7 +9,6 @@ repositories {
maven { maven {
url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/' url 'http://nexus.rehlds.org/nexus/content/repositories/rehlds-snapshots/'
} }
} }
dependencies { dependencies {
@ -20,8 +19,6 @@ dependencies {
compile 'joda-time:joda-time:2.7' compile 'joda-time:joda-time:2.7'
compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2' compile 'org.doomedsociety.gradlecpp:gradle-cpp-plugin:1.2'
compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r' compile 'org.eclipse.jgit:org.eclipse.jgit:3.7.0.201502260915-r'
compile 'org.apache.velocity:velocity:1.7' compile 'org.apache.velocity:velocity:1.7'
} }

View File

@ -3,7 +3,6 @@ package gradlecpp
import org.apache.velocity.Template import org.apache.velocity.Template
import org.apache.velocity.VelocityContext import org.apache.velocity.VelocityContext
import org.apache.velocity.app.Velocity import org.apache.velocity.app.Velocity
import org.joda.time.format.DateTimeFormat
class VelocityUtils { class VelocityUtils {
@ -26,10 +25,7 @@ class VelocityUtils {
throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found") throw new RuntimeException("Failed to load velocity template ${tplFile.absolutePath}: not found")
} }
def velocityContext = new VelocityContext(ctx) def velocityContext = new VelocityContext(ctx)
velocityContext.put("_DateTimeFormat", DateTimeFormat)
def sw = new StringWriter() def sw = new StringWriter()
tpl.merge(velocityContext, sw) tpl.merge(velocityContext, sw)

View File

@ -6,7 +6,11 @@ import org.joda.time.DateTime
@CompileStatic @TypeChecked @CompileStatic @TypeChecked
class GitInfo { class GitInfo {
DateTime lastCommitDate boolean localChanges
DateTime commitDate
String branch String branch
String tag String tag
String commitSHA
String commitURL
Integer commitCount
} }

View File

@ -1,9 +1,15 @@
package versioning package versioning
import java.util.Set;
import groovy.transform.CompileStatic import groovy.transform.CompileStatic
import groovy.transform.TypeChecked import groovy.transform.TypeChecked
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.lib.ObjectId import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.lib.Repository import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.lib.StoredConfig
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.joda.time.DateTime import org.joda.time.DateTime
@ -15,7 +21,52 @@ class GitVersioner {
static GitInfo versionForDir(String dir) { static GitInfo versionForDir(String dir) {
versionForDir(new File(dir)) versionForDir(new File(dir))
} }
static int getCountCommit(Repository repo) {
Iterable<RevCommit> commits = Git.wrap(repo).log().call()
int count = 0;
commits.each {
count++;
}
return count;
}
static String prepareUrlToCommits(String url) {
if (url == null) {
// default remote url
return "https://github.com/dreamstalker/rehlds/commit/";
}
StringBuilder sb = new StringBuilder();
String childPath;
int pos = url.indexOf('@');
if (pos != -1) {
childPath = url.substring(pos + 1, url.lastIndexOf('.git')).replace(':', '/');
sb.append('https://');
} else {
pos = url.lastIndexOf('.git');
childPath = (pos == -1) ? url : url.substring(0, pos);
}
// support for different links to history of commits
if (url.indexOf('bitbucket.org') != -1) {
sb.append(childPath).append('/commits/');
} else {
sb.append(childPath).append('/commit/');
}
return sb.toString();
}
// check uncommited changes
static boolean getUncommittedChanges(Repository repo) {
Git git = new Git(repo);
Status status = git.status().call();
Set<String> uncommittedChanges = status.getUncommittedChanges();
for(String uncommitted : uncommittedChanges) {
return true;
}
return false;
}
static GitInfo versionForDir(File dir) { static GitInfo versionForDir(File dir) {
FileRepositoryBuilder builder = new FileRepositoryBuilder() FileRepositoryBuilder builder = new FileRepositoryBuilder()
Repository repo = builder.setWorkTree(dir) Repository repo = builder.setWorkTree(dir)
@ -27,15 +78,49 @@ class GitVersioner {
return null return null
} }
final StoredConfig cfg = repo.getConfig();
def commit = new RevWalk(repo).parseCommit(head) def commit = new RevWalk(repo).parseCommit(head)
if (!commit) {
throw new RuntimeException("Can't find last commit.")
}
def localChanges = getUncommittedChanges(repo);
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC);
if (localChanges) {
commitDate = new DateTime();
}
def branch = repo.getBranch() def branch = repo.getBranch()
def commitDate = new DateTime(1000L * commit.commitTime, DateTimeZone.UTC)
String url = null;
String remote_name = cfg.getString("branch", branch, "remote");
if (remote_name == null) {
for (String remotes : cfg.getSubsections("remote")) {
if (url != null) {
println 'Found a second remote: (' + remotes + '), url: (' + cfg.getString("remote", remotes, "url") + ')'
continue;
}
url = cfg.getString("remote", remotes, "url");
}
} else {
url = cfg.getString("remote", remote_name, "url");
}
String commitURL = prepareUrlToCommits(url);
String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key String tag = repo.tags.find { kv -> kv.value.objectId == commit.id }?.key
String commitSHA = commit.getId().abbreviate(7).name();
return new GitInfo( return new GitInfo(
lastCommitDate: commitDate, localChanges: localChanges,
commitDate: commitDate,
branch: branch, branch: branch,
tag: tag tag: tag,
commitSHA: commitSHA,
commitURL: commitURL,
commitCount: getCountCommit(repo)
) )
} }
} }

View File

@ -3,6 +3,7 @@ package versioning
import groovy.transform.CompileStatic import groovy.transform.CompileStatic
import groovy.transform.ToString import groovy.transform.ToString
import groovy.transform.TypeChecked import groovy.transform.TypeChecked
import org.joda.time.format.DateTimeFormat
import org.joda.time.DateTime import org.joda.time.DateTime
@CompileStatic @TypeChecked @CompileStatic @TypeChecked
@ -13,23 +14,43 @@ class RehldsVersionInfo {
Integer maintenanceVersion Integer maintenanceVersion
String suffix String suffix
DateTime lastCommitDate boolean localChanges
DateTime commitDate
String commitSHA
String commitURL
Integer commitCount
String format(String versionSeparator, String suffixSeparator, boolean includeSuffix) { String asMavenVersion() {
StringBuilder sb = new StringBuilder() StringBuilder sb = new StringBuilder()
sb.append(majorVersion).append(versionSeparator).append(minorVersion) sb.append(majorVersion).append('.' + minorVersion);
if (maintenanceVersion != null) { if (maintenanceVersion != null) {
sb.append(versionSeparator).append(maintenanceVersion) sb.append('.' + maintenanceVersion);
} }
if (suffix && includeSuffix) { if (commitCount != null) {
sb.append(suffixSeparator).append(suffix) sb.append('.' + commitCount)
}
if (suffix) {
sb.append('-' + suffix)
}
// do mark for this build like a modified version
if (localChanges) {
sb.append('+m');
} }
return sb.toString() return sb.toString()
} }
String asCommitDate() {
String pattern = "MMM d yyyy";
if (commitDate.getDayOfMonth() >= 10) {
pattern = "MMM d yyyy";
}
String asMavenVersion() { return DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH).print(commitDate);
format('.', '-', true) }
String asCommitTime() {
return DateTimeFormat.forPattern('HH:mm:ss').withLocale(Locale.ENGLISH).print(commitDate);
} }
} }

View File

@ -1,2 +1,3 @@
majorVersion=0 majorVersion=3
minorVersion=2 minorVersion=13
maintenanceVersion=0

View File

@ -1,6 +1,7 @@
import gradlecpp.RehldsPlayTestPlugin import gradlecpp.RehldsPlayTestPlugin
import gradlecpp.RehldsPlayTestTask import gradlecpp.RehldsPlayTestTask
import gradlecpp.VelocityUtils import gradlecpp.VelocityUtils
import org.doomedsociety.gradlecpp.GradleCppUtils import org.doomedsociety.gradlecpp.GradleCppUtils
import org.doomedsociety.gradlecpp.LazyNativeDepSet import org.doomedsociety.gradlecpp.LazyNativeDepSet
import org.doomedsociety.gradlecpp.cfg.ToolchainConfig import org.doomedsociety.gradlecpp.cfg.ToolchainConfig
@ -386,16 +387,21 @@ tasks.clean.doLast {
task generateAppVersion { task generateAppVersion {
RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo RehldsVersionInfo verInfo = (RehldsVersionInfo) rootProject.rehldsVersionInfo
def tplFile = project.file('version/appversion.vm') def tplFile = project.file('version/appversion.vm')
def renderedFile = project.file('version/appversion.h') def renderedFile = project.file('version/appversion.h')
// check to up-to-date
inputs.file tplFile inputs.file tplFile
inputs.file project.file('gradle.properties') inputs.file project.file('gradle.properties')
outputs.file renderedFile outputs.file renderedFile
inputs.property('version', verInfo.asMavenVersion())
inputs.property('lastCommitDate', verInfo.lastCommitDate.toString()) // this will ensure that this task is redone when the versions change
inputs.property('version', rootProject.version)
inputs.property('commitDate', verInfo.asCommitDate())
doLast { doLast {
def templateCtx = [ def templateCtx = [
verInfo : verInfo verInfo : verInfo
] ]
@ -403,5 +409,7 @@ task generateAppVersion {
def content = VelocityUtils.renderTemplate(tplFile, templateCtx) def content = VelocityUtils.renderTemplate(tplFile, templateCtx)
renderedFile.delete() renderedFile.delete()
renderedFile.write(content, 'utf-8') renderedFile.write(content, 'utf-8')
println 'The current ReHLDS maven version is ' + rootProject.version + ', url: (' + verInfo.commitURL + '' + verInfo.commitSHA + ')';
} }
} }

View File

@ -28,19 +28,12 @@
#include "precompiled.h" #include "precompiled.h"
//TODO: use last commit date there static char *date = __BUILD_DATE__;
#ifdef REHLDS_FIXES
static char *date = __DATE__;
#else // REHLDS_FIXES
static char *date = "Aug 8 2013";
#endif // REHLDS_FIXES
static char *mon[12] = static char *mon[12] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
static char mond[12] = static char mond[12] =
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int build_number(void) int build_number(void)
{ {
int m = 0; int m = 0;

View File

@ -34,6 +34,18 @@
#include "info.h" #include "info.h"
#include "com_model.h" #include "com_model.h"
#ifndef REHLDS_FIXES
#ifdef _WIN32
#define __BUILD_TIME__ "11:17:23"
#define __BUILD_DATE__ "Aug 8 2013"
#else
#define __BUILD_TIME__ "13:14:09"
#define __BUILD_DATE__ "Aug 29 2013"
#endif
#else
#define __BUILD_TIME__ APP_COMMIT_TIME
#define __BUILD_DATE__ APP_COMMIT_DATE
#endif
#ifdef HOOK_ENGINE #ifdef HOOK_ENGINE
#define serverinfo (*pserverinfo) #define serverinfo (*pserverinfo)

View File

@ -1123,20 +1123,12 @@ void Host_Version(void)
if (g_pcls.state != ca_dedicated) if (g_pcls.state != ca_dedicated)
{ {
Con_DPrintf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString); Con_DPrintf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString);
#ifdef REHLDS_FIXES Con_DPrintf("Exe build: " __BUILD_TIME__ " " __BUILD_DATE__ " (%i)\n", build_number());
Con_DPrintf("Exe build: " __TIME__ " " __DATE__ " (%i)\n", build_number());
#else
Con_DPrintf("Exe build: 13:14:09 Aug 29 2013 (%i)\n", build_number());
#endif // REHLDS_FIXES
} }
else else
{ {
Con_Printf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString); Con_Printf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString);
#ifdef REHLDS_FIXES Con_Printf("Exe build: " __BUILD_TIME__ " " __BUILD_DATE__ " (%i)\n", build_number());
Con_Printf("Exe build: " __TIME__ " " __DATE__ " (%i)\n", build_number());
#else
Con_Printf("Exe build: 13:14:09 Aug 29 2013 (%i)\n", build_number());
#endif // REHLDS_FIXES
} }
} }

View File

@ -2432,16 +2432,15 @@ void Host_Changelevel2_f(void)
void Host_Version_f(void) void Host_Version_f(void)
{ {
Con_Printf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString); Con_Printf("Protocol version %i\nExe version %s (%s)\n", PROTOCOL_VERSION, gpszVersionString, gpszProductString);
#ifdef REHLDS_FIXES #ifdef REHLDS_FIXES
Con_Printf("Exe build: " __TIME__ " " __DATE__ " (%i)\n", build_number()); Con_Printf("ReHLDS version: " APP_VERSION "\n");
#else // REHLDS_FIXES Con_Printf("Build date: " __BUILD_TIME__ " " __BUILD_DATE__ " (%i)\n", build_number());
#ifdef _WIN32 Con_Printf("Build from: "APP_COMMIT_URL APP_COMMIT_SHA"\n");
Con_Printf("Exe build: 11:17:24 Aug 8 2013 (%i)\n", build_number()); #else
#else // _WIN32 Con_Printf("Exe build: " __BUILD_TIME__ " " __BUILD_DATE__ " (%i)\n", build_number());
Con_Printf("Exe build: 10:03:21 Aug 8 2013 (%i)\n", build_number()); #endif
#endif // _WIN32
#endif // REHLDS_FIXES
Con_Printf("ReHLDS API version %i.%i\n", REHLDS_API_VERSION_MAJOR, REHLDS_API_VERSION_MINOR);
} }
/* <3d516> ../engine/host_cmd.c:3382 */ /* <3d516> ../engine/host_cmd.c:3382 */

View File

@ -705,7 +705,7 @@ bool CDedicatedServerAPI::Init_noVirt(char *basedir, char *cmdline, CreateInterf
#endif #endif
if (!Q_strstr(cmdline, "-nobreakpad")) if (!Q_strstr(cmdline, "-nobreakpad"))
{ {
CRehldsPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(va("%d", build_number()), "Aug 8 2013", "11:17:26", 0, 0, 0); CRehldsPlatformHolder::get()->SteamAPI_UseBreakpadCrashHandler(va("%d", build_number()), __BUILD_DATE__, __BUILD_TIME__, 0, 0, 0);
} }
TraceInit("Sys_InitArgv( m_OrigCmd )", "Sys_ShutdownArgv()", 0); TraceInit("Sys_InitArgv( m_OrigCmd )", "Sys_ShutdownArgv()", 0);
Sys_InitArgv(m_OrigCmd); Sys_InitArgv(m_OrigCmd);

View File

@ -1,27 +1,37 @@
@echo OFF @setlocal enableextensions enabledelayedexpansion
@echo off
:: ::
:: Pre-build auto-versioning script :: Pre-build auto-versioning script
:: ::
SET srcdir=%~1 set srcdir=%~1
SET repodir=%~2 set repodir=%~2
set old_version= set old_version=
set old_specialbuild="" set version_major=0
set version_revision=0 set version_minor=0
set version_specialbuild= set version_maintenance=0
set version_date=? set version_modifed=
set version_pdate=
set version_pdate_1= set commitSHA=
set version_pdate_2= set commitURL=
set version_major= set commitCount=0
set version_minor= set branch_name=master
set version_maintenance=
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "hour=%dt:~8,2%"
set "min=%dt:~10,2%"
set "sec=%dt:~12,2%"
for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I"
:: ::
:: 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%" set errlvl="%ERRORLEVEL%"
:: ::
@ -30,127 +40,144 @@ set errlvl="%ERRORLEVEL%"
IF EXIST "%srcdir%\appversion.h" ( IF EXIST "%srcdir%\appversion.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do ( FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do (
IF %%i==#define ( IF %%i==#define (
IF %%j==APP_VERSION_C SET old_version=%%k IF %%j==APP_VERSION (
IF %%j==APP_VERSION_SPECIALBUILD SET old_specialbuild=%%k :: Remove quotes
set v=%%k
set old_version=!v:"=!
)
) )
) )
) )
IF NOT %errlvl% == "1" ( IF %errlvl% == "1" (
echo can't locate SubWCRev.exe - auto-versioning step won't be performed 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 we haven't appversion.h, we need to create it
IF "%old_version%" == "" ( IF NOT "%old_version%" == "" (
set version_revision=0 set commitCount=0
set version_date=?
goto _readVersionH
) )
exit /B 0
) )
:: ::
:: Create template file for SubWCRev :: Read major, minor and maintenance version components from Version.h
:: ::
IF EXIST "%srcdir%\version.h" (
:GETTEMPNAME FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
:: Use current path, current time and random number to create unique file name IF %%i==#define (
SET TMPFILE=svn-%CD:~-15%-%RANDOM%-%TIME:~-5%-%RANDOM% IF %%j==VERSION_MAJOR set version_major=%%k
:: Remove bad characters IF %%j==VERSION_MINOR set version_minor=%%k
SET TMPFILE=%TMPFILE:\=% IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k
SET TMPFILE=%TMPFILE:.=% )
SET TMPFILE=%TMPFILE:,=% )
SET TMPFILE=%TMPFILE: =% ) ELSE (
:: Will put in a temporary directory FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do (
SET TMPFILE=%TMP%.\%TMPFILE% IF NOT [%%j] == [] (
IF EXIST "%TMPFILE%" GOTO :GETTEMPNAME IF %%i==majorVersion set version_major=%%j
IF %%i==minorVersion set version_minor=%%j
echo #define SVNV_REVISION ^$WCREV^$ >"%TMPFILE%.templ" IF %%i==maintenanceVersion set version_maintenance=%%j
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
) )
exit /B 0
) )
DEL /F /Q "%TMPFILE%.templ" 2>NUL
:: ::
:: Read revision and release date from it :: Read revision and release date from it
:: ::
FOR /F "usebackq tokens=1,2,3" %%i in ("%TMPFILE%.h") do ( IF NOT %errlvl% == "1" (
IF %%i==#define ( :: Get current branch
IF %%j==SVNV_REVISION SET version_revision=%%k FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
IF %%j==SVNV_DATE SET version_date=%%k set branch_name=%%i
IF %%j==SVNV_PDATE_1 SET version_pdate_1=%%k )
IF %%j==SVNV_PDATE_2 SET version_pdate_2=%%k
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO (
IF NOT [%%i] == [] (
set commitCount=%%i
)
) )
) )
DEL /F /Q "%TMPFILE%.h" 2>NUL ::
SET version_pdate=%version_pdate_1% %version_pdate_2% :: Get remote url repository
::
IF NOT %errlvl% == "1" (
set branch_remote=origin
:: Get remote name by current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
set branch_remote=%%i
)
:: Get remote url
FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: Get commit id
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO (
set shafull=%%i
set commitSHA=!shafull:~0,+7!
)
IF [!commitURL!] == [] (
FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: append extra string
If NOT "%commitURL%"=="%commitURL:bitbucket.org=%" (
set commitURL=!commitURL!/commit/
) ELSE (
set commitURL=!commitURL!/commits/
)
) ELSE (
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: replace : to /
set commitURL=!commitURL::=/!
:: append extra string
If NOT "%commitURL%"=="%commitURL:bitbucket.org=%" (
set commitURL=https://!commitURL!/commit/
) ELSE (
set commitURL=https://!commitURL!/commits/
)
)
)
:: ::
:: Detect local modifications :: Detect local modifications
:: ::
SubWCRev.exe "%repodir%\." -nm >NUL set localChanged=0
IF NOT %errlvl% == "1" (
IF "%ERRORLEVEL%" == "7" ( FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO (
set version_specialbuild=m set localChanged=1
) ELSE ( )
set version_specialbuild=
) )
:_readVersionH IF [%localChanged%]==[1] (
:: set version_modifed=+m
:: 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
)
) )
:: ::
:: Now form full version string like 1.0.0.1 :: 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%.%version_maintenance%.%commitCount%-dev%version_modifed%
) ELSE (
set new_version=%version_major%,%version_minor%,%version_maintenance%,%version_revision%
)
:: ::
:: Update appversion.h if version has changed or modifications/mixed revisions detected :: Update appversion.h if version has changed or modifications/mixed revisions detected
:: ::
IF NOT "%new_version%"=="%old_version%" goto _update IF NOT "%new_version%"=="%old_version%" goto _update
IF NOT "%version_specialbuild%"==%old_specialbuild% goto _update
goto _exit goto _exit
:_update :_update
echo Updating appversion.h, new version is "%new_version%", the old one was "%old_version%" echo Updating appversion.h, new version is "%new_version%", the old one was %old_version%
echo new special build is "%version_specialbuild%", the old one was %old_specialbuild%
echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h" echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h"
echo #define __APPVERSION_H__>>"%srcdir%\appversion.h" echo #define __APPVERSION_H__>>"%srcdir%\appversion.h"
@ -161,36 +188,15 @@ echo // Don't edit it.>>"%srcdir%\appversion.h"
echo // >>"%srcdir%\appversion.h" echo // >>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h"
echo // Version defines>>"%srcdir%\appversion.h" echo // Version defines>>"%srcdir%\appversion.h"
echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h"
IF "%version_maintenance%" == "" (
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_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_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"
)
echo.>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h"
echo #define APP_VERSION_DATE %version_date%>>"%srcdir%\appversion.h" echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_DATE_STR "%version_date%">>"%srcdir%\appversion.h" echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_VERSION_PDATE_STR "%version_pdate%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_VERSION_YMD_STR "%version_pdate_1%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
IF NOT "%version_specialbuild%" == "" ( echo.>>"%srcdir%\appversion.h"
echo #define APP_VERSION_FLAGS VS_FF_SPECIALBUILD>>"%srcdir%\appversion.h" echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h"
echo #define APP_VERSION_SPECIALBUILD "%version_specialbuild%">>"%srcdir%\appversion.h" echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h"
echo #define APP_VERSION APP_VERSION_STRD "" APP_VERSION_SPECIALBUILD "" VERSION_POSTFIX>>"%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.>>"%srcdir%\appversion.h" echo.>>"%srcdir%\appversion.h"
echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h" echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h"
@ -200,6 +206,7 @@ echo.>>"%srcdir%\appversion.h"
:: Do update of version.cpp file last modify time to force it recompile :: Do update of version.cpp file last modify time to force it recompile
:: ::
copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp" copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp"
endlocal
:_exit :_exit
exit /B 0 exit /B 0

View File

@ -720,7 +720,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -758,7 +758,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -795,7 +795,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Play|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -831,7 +831,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Swds Play|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -870,7 +870,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Record|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -906,7 +906,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Tests|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -942,7 +942,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Test Fixes|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -977,7 +977,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1016,7 +1016,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Play|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -1056,7 +1056,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds Play|Win32'">
<PreBuildEvent> <PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command> <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> </PreBuildEvent>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\metamod\include\;$(ProjectDir)\..\public\rehlds\;$(ProjectDir)\..\common;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\rehlds\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@ -7,14 +7,12 @@
// //
// Version defines // Version defines
\#define VERSION_MAJOR ${verInfo.majorVersion} \#define APP_VERSION "$verInfo.asMavenVersion()"
\#define VERSION_MINOR ${verInfo.minorVersion}
\#define APP_VERSION_D ${verInfo.format('.', '-', true)} \#define APP_COMMIT_DATE "$verInfo.asCommitDate()"
\#define APP_VERSION_STRD "${verInfo.format('.', '-', true)}" \#define APP_COMMIT_TIME "$verInfo.asCommitTime()"
#set ( $commitYMD = $_DateTimeFormat.forPattern('yyyy-MM-dd').print($verInfo.lastCommitDate) ) \#define APP_COMMIT_SHA "$verInfo.commitSHA"
\#define APP_COMMIT_URL "$verInfo.commitURL"
\#define APP_VERSION_YMD_STR "${commitYMD}"
#endif //__APPVERSION_H__ #endif //__APPVERSION_H__