-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
2,185 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef INCLUDE_GUARD | ||
#define INCLUDE_GUARD | ||
|
||
#define PROJECT_NAME "Trunk-Recorder" | ||
#define PROJECT_VER "4.3.2" | ||
#define PROJECT_VER_MAJOR "4" | ||
#define PROJECT_VER_MINOR "3" | ||
#define PTOJECT_VER_PATCH "2" | ||
|
||
#endif // INCLUDE_GUARD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef INCLUDE_GUARD | ||
#define INCLUDE_GUARD | ||
|
||
#define PROJECT_NAME "@PROJECT_NAME@" | ||
#define PROJECT_VER "@PROJECT_VERSION@" | ||
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@" | ||
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@" | ||
#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@" | ||
|
||
#endif // INCLUDE_GUARD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <cstdlib> | ||
#include <iostream> | ||
|
||
#include "git.h" | ||
#include "cmake.h" | ||
|
||
const char *version = "version info:\n"; | ||
|
||
bool GitMetadata::Populated() { | ||
return @GIT_RETRIEVED_STATE@; | ||
} | ||
bool GitMetadata::AnyUncommittedChanges() { | ||
return @GIT_IS_DIRTY@; | ||
} | ||
std::string GitMetadata::AuthorName() { | ||
return "@GIT_AUTHOR_NAME@"; | ||
} | ||
std::string GitMetadata::AuthorEmail() { | ||
return "@GIT_AUTHOR_EMAIL@"; | ||
} | ||
std::string GitMetadata::CommitSHA1() { | ||
return "@GIT_HEAD_SHA1@"; | ||
} | ||
std::string GitMetadata::CommitDate() { | ||
return "@GIT_COMMIT_DATE_ISO8601@"; | ||
} | ||
std::string GitMetadata::CommitSubject() { | ||
return "@GIT_COMMIT_SUBJECT@"; | ||
} | ||
std::string GitMetadata::CommitBody() { | ||
return "@GIT_COMMIT_BODY@"; | ||
} | ||
std::string GitMetadata::Describe() { | ||
return "@GIT_DESCRIBE@"; | ||
} | ||
std::string GitMetadata::Branch() { | ||
return "@GIT_BRANCH@"; | ||
} | ||
void GitMetadata::VersionInfo() { | ||
std::cout << PROJECT_NAME << ": " << PROJECT_VER << std::endl; | ||
|
||
if(GitMetadata::Populated()) { | ||
if(GitMetadata::AnyUncommittedChanges()) { | ||
std::cerr << "\t" << "WARN: there were uncommitted changes at build-time." << std::endl; | ||
} | ||
std::cout << "\t" << "commit " << GitMetadata::CommitSHA1() << " (" << GitMetadata::Branch() << ")\n" | ||
<< "\t" << "describe " << GitMetadata::Describe() << "\n" | ||
<< "\t" << "Author: " << GitMetadata::AuthorName() << " <" << GitMetadata::AuthorEmail() << ">\n" | ||
<< "\t" << "Date: " << GitMetadata::CommitDate() << "\n\n" | ||
<< "\t" << GitMetadata::CommitSubject() << "\n" << GitMetadata::CommitBody() << std::endl; | ||
} | ||
else { | ||
std::cerr << "WARN: failed to get the current git state. Is this a git repo?" << std::endl; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
class GitMetadata { | ||
public: | ||
// Is the metadata populated? We may not have metadata if | ||
// there wasn't a .git directory (e.g. downloaded source | ||
// code without revision history). | ||
static bool Populated(); | ||
|
||
// Were there any uncommitted changes that won't be reflected | ||
// in the CommitID? | ||
static bool AnyUncommittedChanges(); | ||
|
||
// The commit author's name. | ||
static std::string AuthorName(); | ||
// The commit author's email. | ||
static std::string AuthorEmail(); | ||
// The commit SHA1. | ||
static std::string CommitSHA1(); | ||
// The ISO8601 commit date. | ||
static std::string CommitDate(); | ||
// The commit subject. | ||
static std::string CommitSubject(); | ||
// The commit body. | ||
static std::string CommitBody(); | ||
// The commit describe. | ||
static std::string Describe(); | ||
// The symbolic reference tied to HEAD. | ||
static std::string Branch(); | ||
// dump | ||
static void VersionInfo(); | ||
}; |
Oops, something went wrong.