Commit c8afb329 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use git version

parent a95b5366
...@@ -77,6 +77,23 @@ find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED) ...@@ -77,6 +77,23 @@ find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5PimCommon ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommon ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
# Support for the GIT revision number in messagecomposer-version.h
if(EXISTS "${Messagelib_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${Messagelib_SOURCE_DIR}
OUTPUT_VARIABLE messagelib_git_revision)
string(REGEX REPLACE "\n" "" messagelib_git_revision "${messagelib_git_revision}")
set(messagelib_git_revision "git-${messagelib_git_revision}")
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
WORKING_DIRECTORY ${Messagelib_SOURCE_DIR}
OUTPUT_VARIABLE messagelib_git_last_change)
string(REGEX REPLACE " [0-9:+ ]*\n" "" messagelib_git_last_change "${messagelib_git_last_change}")
endif()
endif()
add_subdirectory(messageviewer) add_subdirectory(messageviewer)
add_subdirectory(templateparser) add_subdirectory(templateparser)
add_subdirectory(messagecomposer) add_subdirectory(messagecomposer)
......
...@@ -46,9 +46,9 @@ void initHeader(const KMime::Message::Ptr &message, const KIdentityManagement::I ...@@ -46,9 +46,9 @@ void initHeader(const KMime::Message::Ptr &message, const KIdentityManagement::I
message->removeHeader<KMime::Headers::Subject>(); message->removeHeader<KMime::Headers::Subject>();
message->date()->setDateTime(QDateTime::currentDateTime()); message->date()->setDateTime(QDateTime::currentDateTime());
const QStringList extraInfo = QStringList() << QString::fromLocal8Bit(KDEPIM_GIT_REVISION_STRING) << QString::fromLocal8Bit(KDEPIM_GIT_LAST_CHANGE); const QStringList extraInfo = QStringList() << QString::fromLocal8Bit(MESSAGELIB_GIT_REVISION_STRING) << QString::fromLocal8Bit(MESSAGELIB_GIT_LAST_CHANGE);
message->userAgent()->fromUnicodeString(KProtocolManager::userAgentForApplication(QString::fromLocal8Bit("KMail"), QString::fromLocal8Bit(KDEPIM_GIT_REVISION_STRING), extraInfo), QLatin1String("utf-8").latin1()); message->userAgent()->fromUnicodeString(KProtocolManager::userAgentForApplication(QString::fromLocal8Bit("KMail"), QString::fromLocal8Bit(MESSAGELIB_GIT_REVISION_STRING), extraInfo), QLatin1String("utf-8").latin1());
// This will allow to change Content-Type: // This will allow to change Content-Type:
message->contentType()->setMimeType("text/plain"); message->contentType()->setMimeType("text/plain");
} }
......
...@@ -182,7 +182,7 @@ void SkeletonMessageJobPrivate::doStart() ...@@ -182,7 +182,7 @@ void SkeletonMessageJobPrivate::doStart()
// User-Agent // User-Agent
if (!infoPart->userAgent().isEmpty()) { if (!infoPart->userAgent().isEmpty()) {
QStringList extraInfo; QStringList extraInfo;
extraInfo << QLatin1String(KDEPIM_GIT_REVISION_STRING) << QLatin1String(KDEPIM_GIT_LAST_CHANGE); extraInfo << QLatin1String(MESSAGELIB_GIT_REVISION_STRING) << QLatin1String(MESSAGELIB_GIT_LAST_CHANGE);
KMime::Headers::UserAgent *ua = new KMime::Headers::UserAgent; KMime::Headers::UserAgent *ua = new KMime::Headers::UserAgent;
ua->fromUnicodeString(KProtocolManager::userAgentForApplication(infoPart->userAgent(), QStringLiteral(MESSAGELIB_LIB_VERSION), extraInfo), "utf-8"); ua->fromUnicodeString(KProtocolManager::userAgentForApplication(infoPart->userAgent(), QStringLiteral(MESSAGELIB_LIB_VERSION), extraInfo), "utf-8");
message->setHeader(ua); message->setHeader(ua);
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
#define MESSAGELIB_LIB_VERSION "@MESSAGELIB_LIB_VERSION@" #define MESSAGELIB_LIB_VERSION "@MESSAGELIB_LIB_VERSION@"
/* GIT revision number, of the form "git-xxxxxxxx" */ /* GIT revision number, of the form "git-xxxxxxxx" */
#define KDEPIM_GIT_REVISION_STRING "@kdepim_git_revision@" #define MESSAGELIB_GIT_REVISION_STRING "@messagelib_git_revision@"
/* Date of last commit, of the form "YYYY-MM-DD" */ /* Date of last commit, of the form "YYYY-MM-DD" */
#define KDEPIM_GIT_LAST_CHANGE "@kdepim_git_last_change@" #define MESSAGELIB_GIT_LAST_CHANGE "@messagelib_git_last_change@"
#endif #endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment