Skip to content

Commit 87ea8e8

Browse files
committed
Now use git commit author if no build user is specified, log out git info, fix getAsciiVersion to be consistent with getUnicodeVersion, add comment, remove ( void ), fix Version function ordering
1 parent 3314261 commit 87ea8e8

File tree

7 files changed

+218
-87
lines changed

7 files changed

+218
-87
lines changed

GeneralsMD/Code/GameEngine/Include/Common/version.h

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,61 @@
3838
* values for different parts of the game.
3939
* @todo: increment build number on compile, and stamp exe with username
4040
*/
41+
// TheSuperHackers @tweak The Version class now also provides Git information
42+
// alongside the original Version information.
4143
class Version
4244
{
4345
public:
4446
Version();
4547

46-
UnsignedInt getVersionNumber( void ) const; ///< Return a 4-byte integer suitable for WOLAPI
47-
AsciiString getAsciiVersion( void ) const; ///< Return a human-readable version number
48-
UnicodeString getUnicodeVersion( void ) const; ///< Return a human-readable version number
49-
AsciiString getAsciiBuildTime( void ) const; ///< Return a formated date/time string for build time
50-
UnicodeString getUnicodeBuildTime( void ) const; ///< Return a formated date/time string for build time
51-
AsciiString getAsciiBuildLocation( void ) const; ///< Return a string with the build location
52-
UnicodeString getUnicodeBuildLocation( void ) const; ///< Return a string with the build location
53-
AsciiString getAsciiBuildUser( void ) const; ///< Return a string with the build user
54-
UnicodeString getUnicodeBuildUser( void ) const; ///< Return a string with the build user
55-
56-
static Int getGitRevision();
57-
static time_t getGitCommitTime();
58-
AsciiString getAsciiGitRevision( void ) const { return m_asciiGitRevision; }
59-
AsciiString getAsciiGitVersion( void ) const { return m_asciiGitVersion; }
60-
AsciiString getAsciiGitCommitTime( void ) const { return m_asciiGitCommitTime; }
61-
UnicodeString getUnicodeGitRevision( void ) const { return m_unicodeGitRevision; }
62-
UnicodeString getUnicodeGitVersion( void ) const { return m_unicodeGitVersion; }
63-
UnicodeString getUnicodeGitCommitTime( void ) const { return m_unicodeGitCommitTime; }
64-
UnicodeString getUnicodeGameAndGitVersion( void ) const;
65-
66-
Bool showFullVersion( void ) { return m_showFullVersion; }
48+
UnsignedInt getVersionNumber() const; ///< Return a 4-byte integer suitable for WOLAPI
49+
50+
AsciiString getAsciiVersion() const; ///< Return a human-readable version number
51+
UnicodeString getUnicodeVersion() const; ///< Return a human-readable version number. Is decorated with localized string
52+
53+
AsciiString getAsciiBuildTime() const; ///< Return a formated date/time string for build time
54+
UnicodeString getUnicodeBuildTime() const; ///< Return a formated date/time string for build time. Is decorated with localized string
55+
56+
AsciiString getAsciiBuildLocation() const; ///< Return a string with the build location
57+
UnicodeString getUnicodeBuildLocation() const; ///< Return a string with the build location. Is decorated with localized string
58+
59+
AsciiString getAsciiBuildUser() const; ///< Return a string with the build user
60+
UnicodeString getUnicodeBuildUser() const; ///< Return a string with the build user. Is decorated with localized string
61+
62+
static Int getGitRevision(); ///< Returns the total git commit count as a number
63+
static time_t getGitCommitTime(); ///< Returns the last git commit time as a UTC timestamp
64+
static const char* getGitCommitAuthorName(); ///< Returns the last git commit author name
65+
66+
AsciiString getAsciiGitRevision() const; ///< Returns the total git commit count. Is prefixed with ~ if there were uncommitted changes.
67+
UnicodeString getUnicodeGitRevision() const; ///< Returns the total git commit count. Is prefixed with ~ if there were uncommitted changes.
68+
69+
AsciiString getAsciiGitVersion() const; ///< Returns the last git commit tag or hash. Is prefixed with ~ if there were uncommitted changes.
70+
UnicodeString getUnicodeGitVersion() const; ///< Returns the last git commit tag or hash. Is prefixed with ~ if there were uncommitted changes.
71+
72+
AsciiString getAsciiGitCommitTime() const; ///< Returns the last git commit time in YYYY-mm-dd HH:MM:SS format
73+
UnicodeString getUnicodeGitCommitTime() const; ///< Returns the last git commit time in YYYY-mm-dd HH:MM:SS format
74+
75+
AsciiString getAsciiGameAndGitVersion() const; ///< Returns the game and git version
76+
UnicodeString getUnicodeGameAndGitVersion() const; ///< Returns the game and git version. Is decorated with localized string
77+
78+
AsciiString getAsciiBuildUserOrGitCommitAuthorName() const;
79+
UnicodeString getUnicodeBuildUserOrGitCommitAuthorName() const; ///< Is decorated with localized string
80+
81+
Bool showFullVersion() const { return m_showFullVersion; }
6782
void setShowFullVersion( Bool val ) { m_showFullVersion = val; }
6883

6984
void setVersion(Int major, Int minor, Int buildNum,
7085
Int localBuildNum, AsciiString user, AsciiString location,
71-
AsciiString buildTime, AsciiString buildDate); ///< Set version info
86+
AsciiString buildTime, AsciiString buildDate);
7287

7388
private:
7489
static AsciiString buildAsciiGitRevision();
75-
static AsciiString buildAsciiGitVersion();
76-
static AsciiString buildAsciiGitCommitTime();
7790
static UnicodeString buildUnicodeGitRevision();
91+
92+
static AsciiString buildAsciiGitVersion();
7893
static UnicodeString buildUnicodeGitVersion();
94+
95+
static AsciiString buildAsciiGitCommitTime();
7996
static UnicodeString buildUnicodeGitCommitTime();
8097

8198
private:
@@ -96,6 +113,6 @@ class Version
96113
Bool m_showFullVersion;
97114
};
98115

99-
extern Version *TheVersion; ///< The Version singleton
116+
extern Version *TheVersion;
100117

101118
#endif // __VERSION_H__

GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,17 +261,14 @@ void GameEngine::init()
261261
if (TheVersion)
262262
{
263263
DEBUG_LOG(("================================================================================\n"));
264-
#if defined RTS_DEBUG
265-
const char *buildType = "Debug";
266-
#elif defined RTS_INTERNAL
267-
const char *buildType = "Internal";
268-
#else
269-
const char *buildType = "Release";
270-
#endif
271-
DEBUG_LOG(("Generals version %s (%s)\n", TheVersion->getAsciiVersion().str(), buildType));
264+
DEBUG_LOG(("Generals version %s\n", TheVersion->getAsciiVersion().str()));
272265
DEBUG_LOG(("Build date: %s\n", TheVersion->getAsciiBuildTime().str()));
273266
DEBUG_LOG(("Build location: %s\n", TheVersion->getAsciiBuildLocation().str()));
274-
DEBUG_LOG(("Built by: %s\n", TheVersion->getAsciiBuildUser().str()));
267+
DEBUG_LOG(("Build user: %s\n", TheVersion->getAsciiBuildUser().str()));
268+
DEBUG_LOG(("Build git revision: %s\n", TheVersion->getAsciiGitRevision().str()));
269+
DEBUG_LOG(("Build git version: %s\n", TheVersion->getAsciiGitVersion().str()));
270+
DEBUG_LOG(("Build git commit time: %s\n", TheVersion->getAsciiGitCommitTime().str()));
271+
DEBUG_LOG(("Build git commit author: %s\n", Version::getGitCommitAuthorName()));
275272
DEBUG_LOG(("================================================================================\n"));
276273
}
277274
#endif

0 commit comments

Comments
 (0)