1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-01 14:15:24 +02:00

versioning: add build version as windows build argument

The application currently has a different build version than the one set
in Jenkins. This causes issues in the crash reports on windows where
they contain a different build version than the one defined on Jenkins.
This leads to the names of the build artifacts on dl.jami.net not
matching the crash report's build version.

Changes:
- Add build version as parameter to the build-windows.py script.
- Propagate build version value to the application through the
BUILD_VERSION symbol.
- Deprecate version.h file and VERSION_STRING symbol.

GitLab: #2045
Change-Id: I7986679aaeebf2bcbbd63a781499f5a50e089712
This commit is contained in:
Felix Boucher 2025-05-01 12:21:39 -04:00 committed by Félix Boucher
parent 99f246016d
commit 898444dd3c
10 changed files with 18 additions and 70 deletions

View file

@ -264,6 +264,7 @@ add_custom_target(
-DAPP_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DCORE_SOURCE_DIR=${DAEMON_DIR}
-DCPP_INT_FILE=${VERSION_INFO_DIR}/version_info.cpp.in
-DBUILD_VERSION=${BUILD_VERSION}
-P ${CMAKE_SCRIPTS_DIR}/generate_version_info.cmake
)
list(APPEND CLIENT_INCLUDE_DIRS ${VERSION_INFO_DIR})
@ -377,7 +378,6 @@ set(COMMON_HEADERS
${APP_SRC_DIR}/appversionmanager.h
${APP_SRC_DIR}/utils.h
${APP_SRC_DIR}/bannedlistmodel.h
${APP_SRC_DIR}/version.h
${APP_SRC_DIR}/accountlistmodel.h
${APP_SRC_DIR}/instancemanager.h
${APP_SRC_DIR}/connectivitymonitor.h

View file

@ -24,6 +24,7 @@ set(CMAKE_CURRENT_BINARY_DIR ${APP_BINARY_DIR})
# Generate the version string for the application and core
configure_version_string(${APP_SOURCE_DIR} APP_VERSION_STRING)
configure_version_string(${CORE_SOURCE_DIR} CORE_VERSION_STRING)
set(BUILD_VERSION_STRING ${BUILD_VERSION})
# Get output file names with the .in extension removed
get_filename_component(VERSION_CPP_FILENAME ${CPP_INT_FILE} NAME_WE)

View file

@ -263,7 +263,7 @@ def cmake_build(config_str, env_vars, cmake_build_dir):
return True
def build(config_str, qt_dir, tests, enable_crash_reports, crash_report_url=None):
def build(config_str, qt_dir, tests, build_version, enable_crash_reports, crash_report_url=None):
"""Use cmake to build the project."""
print("Building with Qt at " + qt_dir)
@ -294,6 +294,9 @@ def build(config_str, qt_dir, tests, enable_crash_reports, crash_report_url=None
else:
cmake_options.append("-DENABLE_CRASHREPORTS=OFF")
if build_version:
cmake_options.append("-DBUILD_VERSION=" + build_version)
# Make sure the build directory exists.
if not os.path.exists(build_dir):
os.makedirs(build_dir)
@ -470,6 +473,8 @@ def parse_args():
help='Sets the Qt root path')
parser.add_argument(
"-a", "--arch", default="x64", help="Sets the build architecture")
parser.add_argument(
"--build-version", help="Sets the build version string used for defining app build version")
parser.add_argument(
"-t", "--tests", action="store_true", help="Build and run tests")
parser.add_argument(
@ -552,6 +557,7 @@ def main():
def do_build(do_tests):
if not parsed_args.skip_build:
build(config_str, parsed_args.qt, do_tests,
parsed_args.build_version,
parsed_args.enable_crash_reports,
parsed_args.crash_report_url)
if not parsed_args.skip_deploy:

View file

@ -18,7 +18,7 @@
#include "appversionmanager.h"
#include "lrcinstance.h"
#include "version.h"
#include "version_info.h"
#include <QProcess>
#include <QTimer>
@ -73,7 +73,7 @@ struct AppVersionManager::Impl : public QObject
Q_EMIT parent_.updateCheckReplyReceived(false);
return;
}
auto currentVersion = QString(VERSION_STRING).toULongLong();
auto currentVersion = BUILD_VERSION_STRING.toULongLong();
auto latestVersion = latestVersionString.toULongLong();
const QString channelStr = isBeta ? "beta" : "stable";
const auto newVersionFound = latestVersion > currentVersion;

View file

@ -17,7 +17,6 @@
#pragma once
#include "version.h"
#include "version_info.h"
#include <QVariantMap>
@ -108,7 +107,7 @@ protected:
{"platform", QSysInfo::prettyProductName() + "_" + QSysInfo::currentCpuArchitecture()},
{"client_sha", APP_VERSION_STRING},
{"jamicore_sha", CORE_VERSION_STRING},
{"build_id", QString(VERSION_STRING)},
{"build_id", BUILD_VERSION_STRING},
#if defined(Q_OS_WIN) && defined(BETA)
{"build_variant", "beta"},
#endif

View file

@ -17,7 +17,7 @@
#include "mainapplication.h"
#include "instancemanager.h"
#include "version.h"
#include "version_info.h"
#if defined(Q_OS_MACOS)
#include <os/macos/macutils.h>
#endif
@ -66,7 +66,7 @@ main(int argc, char* argv[])
QApplication::setApplicationName(QStringLiteral("Jami"));
QApplication::setOrganizationDomain(QStringLiteral("jami.net"));
QApplication::setQuitOnLastWindowClosed(false);
QCoreApplication::setApplicationVersion(QString(VERSION_STRING));
QCoreApplication::setApplicationVersion(BUILD_VERSION_STRING);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);

View file

@ -20,7 +20,6 @@
#include "lrcinstance.h"
#include "systemtray.h"
#include "utils.h"
#include "version.h"
#include "version_info.h"
#include "global.h"
#include <api/datatransfermodel.h>
@ -128,7 +127,7 @@ UtilsAdapter::getProjectCredits()
const QString
UtilsAdapter::getBuildIDStr()
{
return QString(VERSION_STRING);
return BUILD_VERSION_STRING;
}
const QString

View file

@ -1,59 +0,0 @@
#pragma once
// clang-format off
#define BUILD_YEAR_CH0 (__DATE__[ 7])
#define BUILD_YEAR_CH1 (__DATE__[ 8])
#define BUILD_YEAR_CH2 (__DATE__[ 9])
#define BUILD_YEAR_CH3 (__DATE__[10])
#define BUILD_MONTH_IS_JAN (__DATE__[0] == 'J' && __DATE__[1] == 'a' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_FEB (__DATE__[0] == 'F')
#define BUILD_MONTH_IS_MAR (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r')
#define BUILD_MONTH_IS_APR (__DATE__[0] == 'A' && __DATE__[1] == 'p')
#define BUILD_MONTH_IS_MAY (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y')
#define BUILD_MONTH_IS_JUN (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n')
#define BUILD_MONTH_IS_JUL (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l')
#define BUILD_MONTH_IS_AUG (__DATE__[0] == 'A' && __DATE__[1] == 'u')
#define BUILD_MONTH_IS_SEP (__DATE__[0] == 'S')
#define BUILD_MONTH_IS_OCT (__DATE__[0] == 'O')
#define BUILD_MONTH_IS_NOV (__DATE__[0] == 'N')
#define BUILD_MONTH_IS_DEC (__DATE__[0] == 'D')
#define BUILD_MONTH_CH0 \
((BUILD_MONTH_IS_OCT || BUILD_MONTH_IS_NOV || BUILD_MONTH_IS_DEC) ? '1' : '0')
#define BUILD_MONTH_CH1 \
( \
(BUILD_MONTH_IS_JAN) ? '1' : \
(BUILD_MONTH_IS_FEB) ? '2' : \
(BUILD_MONTH_IS_MAR) ? '3' : \
(BUILD_MONTH_IS_APR) ? '4' : \
(BUILD_MONTH_IS_MAY) ? '5' : \
(BUILD_MONTH_IS_JUN) ? '6' : \
(BUILD_MONTH_IS_JUL) ? '7' : \
(BUILD_MONTH_IS_AUG) ? '8' : \
(BUILD_MONTH_IS_SEP) ? '9' : \
(BUILD_MONTH_IS_OCT) ? '0' : \
(BUILD_MONTH_IS_NOV) ? '1' : \
(BUILD_MONTH_IS_DEC) ? '2' : \
/* error default */ '?' \
)
#define BUILD_DAY_CH0 ((__DATE__[4] >= '0') ? (__DATE__[4]) : '0')
#define BUILD_DAY_CH1 (__DATE__[ 5])
#define BUILD_HOUR_CH0 (__TIME__[0])
#define BUILD_HOUR_CH1 (__TIME__[1])
#define BUILD_MIN_CH0 (__TIME__[ 3])
#define BUILD_MIN_CH1 (__TIME__[ 4])
const char VERSION_STRING[] = {
BUILD_YEAR_CH0, BUILD_YEAR_CH1, BUILD_YEAR_CH2, BUILD_YEAR_CH3,
BUILD_MONTH_CH0, BUILD_MONTH_CH1,
BUILD_DAY_CH0, BUILD_DAY_CH1,
BUILD_HOUR_CH0, BUILD_HOUR_CH1,
BUILD_MIN_CH0, BUILD_MIN_CH1,
'\0'
};
// clang-format on

View file

@ -2,3 +2,4 @@
const QString APP_VERSION_STRING = "@APP_VERSION_STRING@";
const QString CORE_VERSION_STRING = "@CORE_VERSION_STRING@";
const QString BUILD_VERSION_STRING = "@BUILD_VERSION_STRING@";

View file

@ -4,3 +4,4 @@
extern const QString APP_VERSION_STRING;
extern const QString CORE_VERSION_STRING;
extern const QString BUILD_VERSION_STRING;