diff options
author | Davide Beatrici <git@davidebeatrici.dev> | 2021-01-06 21:42:48 +0300 |
---|---|---|
committer | Davide Beatrici <git@davidebeatrici.dev> | 2021-01-06 21:42:48 +0300 |
commit | 27471118b58e281d305cc95eda8a262dbbd19bd5 (patch) | |
tree | 8ef1dbe7b87662b7c947564027e0a1455b825b67 | |
parent | fe086b41d83d6f488b5b91167c806a87094e32c0 (diff) |
BUILD(versioning): Make use of the 4th part (build/tweak) of the version
The build number can be specified through the new "BUILD_NUMBER" variable.
This change is very important on Windows, for two reasons:
- It allows to easily identify binaries simply by looking at their version.
More specifically, we can guess what build they're part of.
- Right now snapshots can not be updated without uninstalling first, because the version is the same (i.e. 1.4.0).
By increasing the 4th digit of the version for every build we can solve the issue.
This commit also takes care of renaming a few variables so that they're consistent and also clearer.
For example, "version" is now "RELEASE_ID".
-rw-r--r-- | .ci/azure-pipelines/build_windows.bat | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rw-r--r-- | g15helper/g15helper.rc.in | 4 | ||||
-rw-r--r-- | overlay/CMakeLists.txt | 2 | ||||
-rw-r--r-- | overlay/mumble_ol.rc.in | 4 | ||||
-rw-r--r-- | overlay/overlay_exe/overlay_exe.rc.in | 4 | ||||
-rw-r--r-- | overlay_winx64/mumble_ol.rc.in | 4 | ||||
-rw-r--r-- | overlay_winx64/overlay_exe_winx64/overlay_exe.rc.in | 4 | ||||
-rwxr-xr-x | scripts/mumble-version.py | 10 | ||||
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/Version.h | 8 | ||||
-rw-r--r-- | src/mumble/mumble.rc.in | 4 | ||||
-rwxr-xr-x | src/mumble/mumble_dll.rc.in | 4 | ||||
-rw-r--r-- | src/mumble_exe/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/murmur/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/murmur/murmur.rc.in | 4 |
16 files changed, 46 insertions, 37 deletions
diff --git a/.ci/azure-pipelines/build_windows.bat b/.ci/azure-pipelines/build_windows.bat index cc2a2f125..3bf9d09e4 100644 --- a/.ci/azure-pipelines/build_windows.bat +++ b/.ci/azure-pipelines/build_windows.bat @@ -1,4 +1,4 @@ -:: Copyright 2020 The Mumble Developers. All rights reserved. +:: Copyright 2020-2020 The Mumble Developers. All rights reserved. :: Use of this source code is governed by a BSD-style license :: that can be found in the LICENSE file at the root of the :: Mumble source tree or at <https://www.mumble.info/LICENSE>. diff --git a/CMakeLists.txt b/CMakeLists.txt index a1b33b29e..b5769c668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,15 +8,22 @@ cmake_minimum_required(VERSION 3.15) cmake_policy(SET CMP0079 NEW) cmake_policy(SET CMP0091 NEW) -set(version "1.4.0" CACHE STRING "Project version") +set(BUILD_NUMBER CACHE STRING "The build number of the current build. Will be used in Mumble's version to make sure newer builds upgrade older installations properly.") +set(RELEASE_ID CACHE STRING "The ID of the current release (used for representation in the UI and the updater)") -string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]" version_short ${version}) +if ("${BUILD_NUMBER}" STREQUAL "") + if(packaging) + message(FATAL_ERROR "Tried to create a Mumble package, without specifying BUILD_NUMBER!") + else() + set(BUILD_NUMBER "0") + endif() +endif() # Get compilation year string(TIMESTAMP MUMBLE_BUILD_YEAR "%Y") project(Mumble - VERSION ${version_short} + VERSION "1.4.0.${BUILD_NUMBER}" DESCRIPTION "Open source, low-latency, high quality voice chat." HOMEPAGE_URL "https://www.mumble.info" LANGUAGES "C" "CXX" @@ -69,10 +76,11 @@ else() endif() message(STATUS "##################################################") -message(STATUS "Mumble version: ${version}") -message(STATUS "Architecture: ${ARCH}") +message(STATUS "Mumble release ID: ${RELEASE_ID}") +message(STATUS "Mumble version: ${PROJECT_VERSION}") +message(STATUS "Architecture: ${ARCH}") if(NOT IS_MULTI_CONFIG) - message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") else() message(STATUS "Using multi-config generator that will determine build type on-the-fly") endif() diff --git a/g15helper/g15helper.rc.in b/g15helper/g15helper.rc.in index 731657b90..056a93c12 100644 --- a/g15helper/g15helper.rc.in +++ b/g15helper/g15helper.rc.in @@ -20,8 +20,8 @@ IDI_ICON1 ICON DISCARDABLE "@G15HELPER_ICON@" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/overlay/CMakeLists.txt b/overlay/CMakeLists.txt index 7dc197699..733f7e450 100644 --- a/overlay/CMakeLists.txt +++ b/overlay/CMakeLists.txt @@ -162,6 +162,7 @@ if(64_BIT AND MSVC) "-DCMAKE_CXX_COMPILER=cl.exe" "-DBUILD_OVERLAY_XCOMPILE=ON" "-Dsymbols=${symbols}" + "-Dversion=${PROJECT_VERSION}" ${CMAKE_SOURCE_DIR}/overlay CMAKE_GENERATOR_PLATFORM "Win32" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/overlay/overlay_xcompile-prefix @@ -184,6 +185,7 @@ if(64_BIT AND MSVC) "-DCMAKE_CXX_COMPILER=cl.exe" "-DBUILD_OVERLAY_XCOMPILE=ON" "-Dsymbols=${symbols}" + "-Dversion=${PROJECT_VERSION}" ${CMAKE_SOURCE_DIR}/overlay WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/overlay/overlay_xcompile-prefix INSTALL_COMMAND "" diff --git a/overlay/mumble_ol.rc.in b/overlay/mumble_ol.rc.in index 065d64cf0..736e8b561 100644 --- a/overlay/mumble_ol.rc.in +++ b/overlay/mumble_ol.rc.in @@ -18,8 +18,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/overlay/overlay_exe/overlay_exe.rc.in b/overlay/overlay_exe/overlay_exe.rc.in index b3ab0ace5..d88dda921 100644 --- a/overlay/overlay_exe/overlay_exe.rc.in +++ b/overlay/overlay_exe/overlay_exe.rc.in @@ -18,8 +18,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/overlay_winx64/mumble_ol.rc.in b/overlay_winx64/mumble_ol.rc.in index cee2b9027..0fb3fb454 100644 --- a/overlay_winx64/mumble_ol.rc.in +++ b/overlay_winx64/mumble_ol.rc.in @@ -18,8 +18,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/overlay_winx64/overlay_exe_winx64/overlay_exe.rc.in b/overlay_winx64/overlay_exe_winx64/overlay_exe.rc.in index 2d6a2ff66..8f1f304a0 100644 --- a/overlay_winx64/overlay_exe_winx64/overlay_exe.rc.in +++ b/overlay_winx64/overlay_exe_winx64/overlay_exe.rc.in @@ -18,8 +18,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/scripts/mumble-version.py b/scripts/mumble-version.py index 0a7642194..c4a5ee8a7 100755 --- a/scripts/mumble-version.py +++ b/scripts/mumble-version.py @@ -82,12 +82,10 @@ def readMumbleVersion(): version = None with open(os.path.join(sourceTreeRoot, 'CMakeLists.txt'), 'r') as f: for line in f: - # The version is specified as e.g. set(version "1.4.0" CACHE STRING "Project version") - if 'set(version' in line: - line = line.replace('set(version', '') - line = line[0 : line.find('CACHE')].strip() - # remove quotes - line = line[1 : len(line) - 1] + # The version is specified as e.g. VERSION "1.4.0.${BUILD_NUMBER}" + if 'VERSION "' in line and '.${BUILD_NUMBER}"' in line: + line = line.replace('VERSION "', '') + line = line[0 : line.find('.${BUILD_NUMBER}"')].strip() version = line break if version is None: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 520e42f78..e64a84663 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -126,8 +126,9 @@ target_sources(shared target_compile_definitions(shared PUBLIC - "MUMBLE_VERSION=${version}" - "MUMBLE_VERSION_STRING=${version_short}" + "MUMBLE_VERSION=${PROJECT_VERSION}" + # Only define this macro if RELEASE_ID is actually set + $<$<NOT:$<STREQUAL:"${RELEASE_ID}","">>:MUMBLE_RELEASE_ID=${RELEASE_ID}> ) target_compile_definitions(shared diff --git a/src/Version.h b/src/Version.h index 26f114524..d37c718b8 100644 --- a/src/Version.h +++ b/src/Version.h @@ -11,18 +11,18 @@ #define MUMXTEXT(X) #X #define MUMTEXT(X) MUMXTEXT(X) -#ifndef MUMBLE_VERSION +#ifndef MUMBLE_RELEASE_ID # define MUMBLE_RELEASE "Compiled by User" #else -# define MUMBLE_RELEASE MUMTEXT(MUMBLE_VERSION) +# define MUMBLE_RELEASE MUMTEXT(MUMBLE_RELEASE_ID) #endif class MumbleVersion { public: - static unsigned int getRaw(const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); + static unsigned int getRaw(const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION))); static QString toString(unsigned int version); static bool get(int *major, int *minor, int *patch, - const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); + const QString &version = QLatin1String(MUMTEXT(MUMBLE_RELEASE_ID))); static unsigned int toRaw(int major, int minor, int patch); static void fromRaw(unsigned int version, int *major, int *minor, int *patch); diff --git a/src/mumble/mumble.rc.in b/src/mumble/mumble.rc.in index e5c8ec7b3..c9af66846 100644 --- a/src/mumble/mumble.rc.in +++ b/src/mumble/mumble.rc.in @@ -20,8 +20,8 @@ IDI_ICON1 ICON DISCARDABLE "@MUMBLE_ICON@" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/src/mumble/mumble_dll.rc.in b/src/mumble/mumble_dll.rc.in index b416d0082..d8a172686 100755 --- a/src/mumble/mumble_dll.rc.in +++ b/src/mumble/mumble_dll.rc.in @@ -18,8 +18,8 @@ #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 diff --git a/src/mumble_exe/CMakeLists.txt b/src/mumble_exe/CMakeLists.txt index e420315db..89643573b 100644 --- a/src/mumble_exe/CMakeLists.txt +++ b/src/mumble_exe/CMakeLists.txt @@ -64,7 +64,7 @@ if(packaging) add_custom_command(TARGET mumble_exe POST_BUILD COMMAND cscs.exe -cd MumbleInstall.cs - COMMAND cscs.exe ClientInstaller.cs --version ${version_short} --arch ${ARCH} ${installer_vars} + COMMAND cscs.exe ClientInstaller.cs --version ${PROJECT_VERSION} --arch ${ARCH} ${installer_vars} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/installer/client ) endif() diff --git a/src/murmur/CMakeLists.txt b/src/murmur/CMakeLists.txt index 65a252b8f..70d3168f3 100644 --- a/src/murmur/CMakeLists.txt +++ b/src/murmur/CMakeLists.txt @@ -355,7 +355,7 @@ if(packaging) add_custom_command(TARGET murmur POST_BUILD COMMAND cscs.exe -cd MumbleInstall.cs - COMMAND cscs.exe ServerInstaller.cs --version ${version_short} --arch ${ARCH} ${installer_vars} + COMMAND cscs.exe ServerInstaller.cs --version ${PROJECT_VERSION} --arch ${ARCH} ${installer_vars} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/installer/server ) endif() diff --git a/src/murmur/murmur.rc.in b/src/murmur/murmur.rc.in index 3bd1bff71..81dddcb46 100644 --- a/src/murmur/murmur.rc.in +++ b/src/murmur/murmur.rc.in @@ -20,8 +20,8 @@ IDI_ICON1 ICON DISCARDABLE "@MURMUR_ICON@" #endif VS_VERSION_INFO VERSIONINFO - FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 - PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0 + FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ + PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,@PROJECT_VERSION_TWEAK@ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS (VER_DEBUG|VER_RELEASE) FILEOS VOS_NT_WINDOWS32 |