mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Integrate swift version numbering into the json config system.
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"version": {
|
||||
"major": 0,
|
||||
"minor": 8,
|
||||
"micro": 7
|
||||
},
|
||||
"libs": {
|
||||
"blackcore": true,
|
||||
"blackgui": true,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
################################
|
||||
|
||||
@@ -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}
|
||||
@@ -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):
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user