diff --git a/default.json b/default.json index 04e6752f1..540ba4ee4 100644 --- a/default.json +++ b/default.json @@ -1,4 +1,9 @@ { + "version": { + "major": 0, + "minor": 8, + "micro": 7 + }, "libs": { "blackcore": true, "blackgui": true, diff --git a/install.pri b/install.pri index 7040abb8f..43e4017aa 100644 --- a/install.pri +++ b/install.pri @@ -203,7 +203,7 @@ bitrock_builder_bin = $$(BITROCK_BUILDER) WINDOWS64BITMODE = 0 win32 { INSTALLER_PLATFORM = windows - INSTALLER_BASENAME = swiftinstaller-windows-$${WORD_SIZE}-$${BLACK_VERSION} + INSTALLER_BASENAME = swiftinstaller-windows-$${WORD_SIZE}-$$swiftConfig(version.full) INSTALLER_EXT = exe ARCHITECTURE = 32 equals(WORD_SIZE,64) { @@ -213,20 +213,20 @@ bitrock_builder_bin = $$(BITROCK_BUILDER) } else:macx { INSTALLER_PLATFORM = osx - INSTALLER_BASENAME = swiftinstaller-macos-$${WORD_SIZE}-$${BLACK_VERSION} + INSTALLER_BASENAME = swiftinstaller-macos-$${WORD_SIZE}-$$swiftConfig(version.full) INSTALLER_EXT = app ARCHITECTURE = 64 } else:unix { INSTALLER_PLATFORM = linux-x$${WORD_SIZE} - INSTALLER_BASENAME = swiftinstaller-linux-$${WORD_SIZE}-$${BLACK_VERSION} + INSTALLER_BASENAME = swiftinstaller-linux-$${WORD_SIZE}-$$swiftConfig(version.full) INSTALLER_EXT = run ARCHITECTURE = 64 } create_installer.commands = $${bitrock_builder_bin} quickbuild $${bitrock_project} $${INSTALLER_PLATFORM} \ --setvars project.outputDirectory=$$shell_path($${PREFIX}/..) \ project.installerFilename=$${INSTALLER_BASENAME}.$${INSTALLER_EXT} \ - project.version=$${BLACK_VERSION} \ + project.version=$$swiftConfig(version.full) \ project.windows64bitMode=$${WINDOWS64BITMODE} \ architecture=$${ARCHITECTURE} QMAKE_EXTRA_TARGETS += create_installer diff --git a/mkspecs/features/common_pre.prf b/mkspecs/features/common_pre.prf index 3188f712e..5164d05ad 100644 --- a/mkspecs/features/common_pre.prf +++ b/mkspecs/features/common_pre.prf @@ -7,19 +7,6 @@ # including this file, may be copied, modified, propagated, or distributed # except according to the terms contained in the LICENSE file. -################################ -# Version number -################################ - -include(version.pri) - -!win32 { - VER_MAJ = $${BLACK_VER_MAJ} - VER_MIN = $${BLACK_VER_MIN} - VER_MIC = $${BLACK_VER_MIC} - VERSION = $${BLACK_VERSION} -} - ################################ # Destination tree ################################ @@ -33,6 +20,19 @@ else: DestRoot = $$DestRootRelease include(config.pri) +################################ +# Version number +################################ + +setSwiftConfig(version.full, $$swiftConfig(version.major).$$swiftConfig(version.minor).$$swiftConfig(version.micro)) + +!win32 { + VER_MAJ = $$swiftConfig(version.major) + VER_MIN = $$swiftConfig(version.minor) + VER_MIC = $$swiftConfig(version.micro) + VERSION = $$swiftConfig(version.full) +} + ################################ # QMake options ################################ diff --git a/mkspecs/features/version.pri b/mkspecs/features/version.pri deleted file mode 100644 index 2ed98d27f..000000000 --- a/mkspecs/features/version.pri +++ /dev/null @@ -1,4 +0,0 @@ -BLACK_VER_MAJ = 0 -BLACK_VER_MIN = 8 -BLACK_VER_MIC = 7 -BLACK_VERSION = $${BLACK_VER_MAJ}.$${BLACK_VER_MIN}.$${BLACK_VER_MIC} diff --git a/scripts/jenkins.py b/scripts/jenkins.py index 58f86eef3..3c148b005 100644 --- a/scripts/jenkins.py +++ b/scripts/jenkins.py @@ -10,6 +10,7 @@ from datetime import date import getopt +import json import multiprocessing import os import os.path as path @@ -222,35 +223,19 @@ class Builder: self.version = self.__get_swift_version() def __get_swift_version(self): - version_major = '0' - version_minor = '0' - version_micro = '0' - version_file = path.abspath( - path.join(self._get_swift_source_path(), 'mkspecs', 'features', 'version')) + '.pri' - f = open(version_file) - line = f.readline() - while line: - # Remove all spaces - line = line.strip().replace(' ', '') - tokens = line.split('=') - if not len(tokens) == 2: - raise ValueError('version.pri has wrong format!') - if tokens[0] == 'BLACK_VER_MAJ': - version_major = tokens[1] - elif tokens[0] == 'BLACK_VER_MIN': - version_minor = tokens[1] - elif tokens[0] == 'BLACK_VER_MIC': - version_micro = tokens[1] - else: - pass - line = f.readline() + config_file = path.abspath(path.join(self._get_swift_source_path(), 'default')) + '.json' + f = open(config_file) + config_json = json.load(f) f.close() + version_major = config_json['version']['major'] + version_minor = config_json['version']['minor'] + version_micro = config_json['version']['micro'] # Converted from swift's CBuildConfig::lastCommitTimestampAsVersionSegment last_commit_timestamp = int(self.__get_last_commit_timestamp()) year_offset = 201000000000 last_commit_timestamp = last_commit_timestamp - year_offset - version = '.'.join([version_major, version_minor, version_micro, str(last_commit_timestamp)]) + version = '.'.join([str(version_major), str(version_minor), str(version_micro), str(last_commit_timestamp)]) return version def __get_last_commit_timestamp(self): diff --git a/src/blackconfig/buildconfig_gen.inc.in b/src/blackconfig/buildconfig_gen.inc.in index 53bdda797..3507c9c5c 100644 --- a/src/blackconfig/buildconfig_gen.inc.in +++ b/src/blackconfig/buildconfig_gen.inc.in @@ -101,6 +101,6 @@ constexpr bool BlackConfig::CBuildConfig::isVatsimVersion() !!ENDIF } -constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$BLACK_VER_MAJ; } -constexpr int BlackConfig::CBuildConfig::versionMinor() { return $$BLACK_VER_MIN; } -constexpr int BlackConfig::CBuildConfig::versionMicro() { return $$BLACK_VER_MIC; } +constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$swiftConfig(version.major); } +constexpr int BlackConfig::CBuildConfig::versionMinor() { return $$swiftConfig(version.minor); } +constexpr int BlackConfig::CBuildConfig::versionMicro() { return $$swiftConfig(version.micro); } diff --git a/src/xswiftbus/xswiftbus.pro b/src/xswiftbus/xswiftbus.pro index 9c3a6bb21..0606b61a0 100644 --- a/src/xswiftbus/xswiftbus.pro +++ b/src/xswiftbus/xswiftbus.pro @@ -72,7 +72,7 @@ DEFINES += XPLM210=1 DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\" DEFINES += XPMP_CLIENT_LONGNAME=\\\"xswiftbus\\\" -DEFINES += XSWIFTBUS_VERSION=\\\"$${BLACK_VERSION}\\\" +DEFINES += XSWIFTBUS_VERSION=\\\"$$swiftConfig(version.full)\\\" # X-Plane plugins must follow a prescribed filename and directory structure. TARGET_EXT = .xpl