mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +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": {
|
"libs": {
|
||||||
"blackcore": true,
|
"blackcore": true,
|
||||||
"blackgui": true,
|
"blackgui": true,
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ bitrock_builder_bin = $$(BITROCK_BUILDER)
|
|||||||
WINDOWS64BITMODE = 0
|
WINDOWS64BITMODE = 0
|
||||||
win32 {
|
win32 {
|
||||||
INSTALLER_PLATFORM = windows
|
INSTALLER_PLATFORM = windows
|
||||||
INSTALLER_BASENAME = swiftinstaller-windows-$${WORD_SIZE}-$${BLACK_VERSION}
|
INSTALLER_BASENAME = swiftinstaller-windows-$${WORD_SIZE}-$$swiftConfig(version.full)
|
||||||
INSTALLER_EXT = exe
|
INSTALLER_EXT = exe
|
||||||
ARCHITECTURE = 32
|
ARCHITECTURE = 32
|
||||||
equals(WORD_SIZE,64) {
|
equals(WORD_SIZE,64) {
|
||||||
@@ -213,20 +213,20 @@ bitrock_builder_bin = $$(BITROCK_BUILDER)
|
|||||||
}
|
}
|
||||||
else:macx {
|
else:macx {
|
||||||
INSTALLER_PLATFORM = osx
|
INSTALLER_PLATFORM = osx
|
||||||
INSTALLER_BASENAME = swiftinstaller-macos-$${WORD_SIZE}-$${BLACK_VERSION}
|
INSTALLER_BASENAME = swiftinstaller-macos-$${WORD_SIZE}-$$swiftConfig(version.full)
|
||||||
INSTALLER_EXT = app
|
INSTALLER_EXT = app
|
||||||
ARCHITECTURE = 64
|
ARCHITECTURE = 64
|
||||||
}
|
}
|
||||||
else:unix {
|
else:unix {
|
||||||
INSTALLER_PLATFORM = linux-x$${WORD_SIZE}
|
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
|
INSTALLER_EXT = run
|
||||||
ARCHITECTURE = 64
|
ARCHITECTURE = 64
|
||||||
}
|
}
|
||||||
create_installer.commands = $${bitrock_builder_bin} quickbuild $${bitrock_project} $${INSTALLER_PLATFORM} \
|
create_installer.commands = $${bitrock_builder_bin} quickbuild $${bitrock_project} $${INSTALLER_PLATFORM} \
|
||||||
--setvars project.outputDirectory=$$shell_path($${PREFIX}/..) \
|
--setvars project.outputDirectory=$$shell_path($${PREFIX}/..) \
|
||||||
project.installerFilename=$${INSTALLER_BASENAME}.$${INSTALLER_EXT} \
|
project.installerFilename=$${INSTALLER_BASENAME}.$${INSTALLER_EXT} \
|
||||||
project.version=$${BLACK_VERSION} \
|
project.version=$$swiftConfig(version.full) \
|
||||||
project.windows64bitMode=$${WINDOWS64BITMODE} \
|
project.windows64bitMode=$${WINDOWS64BITMODE} \
|
||||||
architecture=$${ARCHITECTURE}
|
architecture=$${ARCHITECTURE}
|
||||||
QMAKE_EXTRA_TARGETS += create_installer
|
QMAKE_EXTRA_TARGETS += create_installer
|
||||||
|
|||||||
@@ -7,19 +7,6 @@
|
|||||||
# including this file, may be copied, modified, propagated, or distributed
|
# including this file, may be copied, modified, propagated, or distributed
|
||||||
# except according to the terms contained in the LICENSE file.
|
# 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
|
# Destination tree
|
||||||
################################
|
################################
|
||||||
@@ -33,6 +20,19 @@ else: DestRoot = $$DestRootRelease
|
|||||||
|
|
||||||
include(config.pri)
|
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
|
# 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
|
from datetime import date
|
||||||
import getopt
|
import getopt
|
||||||
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import os.path as path
|
import os.path as path
|
||||||
@@ -222,35 +223,19 @@ class Builder:
|
|||||||
self.version = self.__get_swift_version()
|
self.version = self.__get_swift_version()
|
||||||
|
|
||||||
def __get_swift_version(self):
|
def __get_swift_version(self):
|
||||||
version_major = '0'
|
config_file = path.abspath(path.join(self._get_swift_source_path(), 'default')) + '.json'
|
||||||
version_minor = '0'
|
f = open(config_file)
|
||||||
version_micro = '0'
|
config_json = json.load(f)
|
||||||
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()
|
|
||||||
f.close()
|
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
|
# Converted from swift's CBuildConfig::lastCommitTimestampAsVersionSegment
|
||||||
last_commit_timestamp = int(self.__get_last_commit_timestamp())
|
last_commit_timestamp = int(self.__get_last_commit_timestamp())
|
||||||
year_offset = 201000000000
|
year_offset = 201000000000
|
||||||
last_commit_timestamp = last_commit_timestamp - year_offset
|
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
|
return version
|
||||||
|
|
||||||
def __get_last_commit_timestamp(self):
|
def __get_last_commit_timestamp(self):
|
||||||
|
|||||||
@@ -101,6 +101,6 @@ constexpr bool BlackConfig::CBuildConfig::isVatsimVersion()
|
|||||||
!!ENDIF
|
!!ENDIF
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$BLACK_VER_MAJ; }
|
constexpr int BlackConfig::CBuildConfig::versionMajor() { return $$swiftConfig(version.major); }
|
||||||
constexpr int BlackConfig::CBuildConfig::versionMinor() { return $$BLACK_VER_MIN; }
|
constexpr int BlackConfig::CBuildConfig::versionMinor() { return $$swiftConfig(version.minor); }
|
||||||
constexpr int BlackConfig::CBuildConfig::versionMicro() { return $$BLACK_VER_MIC; }
|
constexpr int BlackConfig::CBuildConfig::versionMicro() { return $$swiftConfig(version.micro); }
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ DEFINES += XPLM210=1
|
|||||||
DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\"
|
DEFINES += XPMP_CLIENT_NAME=\\\"xswiftbus\\\"
|
||||||
DEFINES += XPMP_CLIENT_LONGNAME=\\\"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.
|
# X-Plane plugins must follow a prescribed filename and directory structure.
|
||||||
TARGET_EXT = .xpl
|
TARGET_EXT = .xpl
|
||||||
|
|||||||
Reference in New Issue
Block a user