diff options
| author | Kevin Smith <git@kismith.co.uk> | 2012-11-14 08:55:30 (GMT) |
|---|---|---|
| committer | Swift Review <review@swift.im> | 2012-11-14 09:54:12 (GMT) |
| commit | c733ee6f86513adf59ead706fc82711c3ca1e1ec (patch) | |
| tree | 64c7a6a4dbd61123d784bc55d3b3e5f3b9a36fa5 | |
| parent | 10c43c39dfd926e7a70ce8a68e33859acf681404 (diff) | |
| download | swift-c733ee6f86513adf59ead706fc82711c3ca1e1ec.zip swift-c733ee6f86513adf59ead706fc82711c3ca1e1ec.tar.bz2 | |
Use version numbers for Swift binary so upgrades work
Change-Id: If491b0a62782d568cad132c8c5856aaeb3a3967a
| -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 @@ -21,12 +21,42 @@ def getBuildVersion(root, project) : versionFilename = os.path.join(root, "VERSION." + project) if os.path.isfile(versionFilename) : f = open(versionFilename) version = f.read().strip() f.close() return version gitVersion = getGitBuildVersion(project) if gitVersion : 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 @@ -155,35 +155,40 @@ sources = [ "Whiteboard/ColorWidget.cpp", "QtSubscriptionRequestWindow.cpp", "QtRosterHeader.cpp", "QtWebView.cpp", "qrc_DefaultTheme.cc", "qrc_Swift.cc", "QtChatWindowJSBridge.cpp", "QtMUCConfigurationWindow.cpp", "QtAffiliationEditor.cpp", "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() res_env.Append(CPPDEFINES = [ ("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 # Adding it explicitly until i figure out why myenv.Depends(res, "../Controllers/BuildVersion.h") sources += [ "WinUIHelpers.cpp", "CAPICertificateSelector.cpp", "WindowsNotifier.cpp", "#/Swift/resources/Windows/Swift.res" ] @@ -333,27 +338,25 @@ if env["PLATFORM"] == "win32" : # work outfile.write("\\'%X" % ord(char)) else : outfile.write(char) outfile.write('\\par ') outfile.write('}') outfile.close() infile.close() env.Command(["Swift/COPYING.rtf"], ["COPYING"], convertToRTF) 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: wixincludecontent += "<?define %s = \"%s\" ?>" % (key, wixvariables[key]) wixincludecontent += "</Include>" myenv.WriteVal("..\\Packaging\\Wix\\variables.wxs", env.Value(wixincludecontent)) myenv.WiX_Heat('..\\Packaging\\WiX\\gen_files.wxs', windowsBundleFiles) myenv.WiX_Candle('..\\Packaging\\WiX\\Swift.wixobj', '..\\Packaging\\WiX\\Swift.wxs') myenv.WiX_Candle('..\\Packaging\\WiX\\gen_files.wixobj', '..\\Packaging\\WiX\\gen_files.wxs') myenv.WiX_Light('#/Packages/Swift/Swift-' + myenv["SWIFT_VERSION"] + '.msi', ['..\\Packaging\\WiX\\gen_files.wixobj','..\\Packaging\\WiX\\Swift.wixobj']) if myenv["debug"] : 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,16 +1,16 @@ #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 FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x4L FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" |
Swift