diff options
-rw-r--r-- | BuildTools/SCons/Version.py | 30 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 15 | ||||
-rw-r--r-- | Swift/resources/Windows/Swift.rc | 2 |
3 files changed, 40 insertions, 7 deletions
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py index 57ef96d..a912e02 100644 --- a/BuildTools/SCons/Version.py +++ b/BuildTools/SCons/Version.py @@ -30,3 +30,33 @@ def getBuildVersion(root, project) : return gitVersion return datetime.date.today().strftime("%Y%m%d") + +def convertToWindowsVersion(version) : + version_match = re.match("(\d+)\.(\d+)(.*)", version) + major = int(version_match.group(1)) if version_match else 0 + minor = int(version_match.group(2)) if version_match else 0 + if version_match and len(version_match.group(3)) == 0 : + patch = 99999 + else : + match = re.match("^beta(\d+)(.*)", version_match.group(3)) + build_string = "" + if match : + patch = 1000*int(match.group(1)) + build_string = match.group(2) + else : + match = re.match("^rc(\d+)(.*)", version_match.group(3)) + if match : + patch = 10000*int(rc_match.group(1)) + build_string = match.group(2) + else : + match = re.match("^alpha(.*)", version_match.group(3)) + if match : + build_string = match.group(1) + + if len(build_string) > 0 : + build_match = re.match("^-dev(\d+)", build_string) + if build_match : + patch += int(build_match.group(1)) + + return (major, minor, patch) + diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index 5fb238a..c40ba4b 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -164,10 +164,14 @@ sources = [ "QtUISettingConstants.cpp" ] +# Determine the version myenv["SWIFT_VERSION"] = Version.getBuildVersion(env.Dir("#").abspath, "swift") -version_match = re.match("(\d+)\.(\d+).*", myenv["SWIFT_VERSION"]) -myenv["SWIFT_VERSION_MAJOR"] = int(version_match.group(1)) if version_match else 0 -myenv["SWIFT_VERSION_MINOR"] = int(version_match.group(2)) if version_match else 0 +if env["PLATFORM"] == "win32" : + swift_windows_version = Version.convertToWindowsVersion(myenv["SWIFT_VERSION"]) + myenv["SWIFT_VERSION_MAJOR"] = swift_windows_version[0] + myenv["SWIFT_VERSION_MINOR"] = swift_windows_version[1] + myenv["SWIFT_VERSION_PATCH"] = swift_windows_version[2] + if env["PLATFORM"] == "win32" : res_env = myenv.Clone() @@ -175,6 +179,7 @@ if env["PLATFORM"] == "win32" : ("SWIFT_COPYRIGHT_YEAR", "\"\\\"2010-%s\\\"\"" % str(time.localtime()[0])), ("SWIFT_VERSION_MAJOR", "${SWIFT_VERSION_MAJOR}"), ("SWIFT_VERSION_MINOR", "${SWIFT_VERSION_MINOR}"), + ("SWIFT_VERSION_PATCH", "${SWIFT_VERSION_PATCH}"), ]) res = res_env.RES("#/Swift/resources/Windows/Swift.rc") # For some reason, SCons isn't picking up the dependency correctly @@ -342,9 +347,7 @@ if env["PLATFORM"] == "win32" : wixvariables = { 'VCCRTFile': env["vcredist"], - # FIXME: Not including patch version, but that shouldn't be - # a problem. It just allows downgrading between development versions - 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + ".0" + 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"]) } wixincludecontent = "<Include>" for key in wixvariables: diff --git a/Swift/resources/Windows/Swift.rc b/Swift/resources/Windows/Swift.rc index eb02bd1..887f389 100644 --- a/Swift/resources/Windows/Swift.rc +++ b/Swift/resources/Windows/Swift.rc @@ -1,7 +1,7 @@ #include "Swift/Controllers/BuildVersion.h" 1 VERSIONINFO - FILEVERSION SWIFT_VERSION_MAJOR, SWIFT_VERSION_MINOR + FILEVERSION SWIFT_VERSION_MAJOR, SWIFT_VERSION_MINOR, SWIFT_VERSION_PATCH // PRODUCTVERSION 1.0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG |