Align the full version schema across all artifacts

Summary:
The version number used for packaging symbols and xswiftbus was not the
full one including the timestamp.
This change adds the last commit timestamp (in contrast to the build
timestamp used before) as regular part of the version number. This helps
us to also keep the version number consistent with the content across all
installers. The version number will change only, if the last commit was
modified and not with each different build.
In the end, all jenkins jobs building from the same commit should produce
artifacts with the same version everywhere.

ref T204

Reviewers: #swift_pilot_client, kbasan

Reviewed By: #swift_pilot_client, kbasan

Subscribers: jenkins

Maniphest Tasks: T204

Differential Revision: https://dev.swift-project.org/D68
This commit is contained in:
Roland Winklmeier
2017-11-29 15:36:17 +01:00
parent d8c156a762
commit d7d4fdff2c
7 changed files with 62 additions and 43 deletions

View File

@@ -192,7 +192,7 @@ namespace BlackConfig
const QVersionNumber &CBuildConfig::getVersion()
{
static const QVersionNumber v { versionMajor(), versionMinor(), versionMicro(), buildTimestampAsVersionSegment(buildTimestamp()) };
static const QVersionNumber v { versionMajor(), versionMinor(), versionMicro(), lastCommitTimestampAsVersionSegment(lastCommitTimestamp()) };
return v;
}
@@ -220,20 +220,20 @@ namespace BlackConfig
return dt;
}
int CBuildConfig::buildTimestampAsVersionSegment(const QDateTime &buildTimestamp)
int CBuildConfig::lastCommitTimestampAsVersionSegment(const QDateTime &lastCommitTimestamp)
{
if (buildTimestamp.isValid())
if (lastCommitTimestamp.isValid())
{
const QString bts = buildTimestamp.toString("yyyyMMddHHmm");
const QString bts = lastCommitTimestamp.toString("yyyyMMddHHmm");
bool ok;
const long long btsll = bts.toLongLong(&ok); // at least 64bit
const long long lctsll = bts.toLongLong(&ok); // at least 64bit
if (!ok) { return 0; }
// now we have to converto int
// max 2147483647 (2^31 - 1)
// 1MMddHHmm (years since 2010)
const long long yearOffset = 201000000000;
const int btsInt = btsll - yearOffset;
return btsInt;
const int lctsInt = lctsll - yearOffset;
return lctsInt;
}
return 0; // intentionally 0 => 0.7.3.0 <-
}