Skip to content

Commit

Permalink
Update version number
Browse files Browse the repository at this point in the history
IB-8336

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Jan 7, 2025
1 parent b8cb58c commit cc47f95
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 74 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -S . -B build
Expand Down Expand Up @@ -46,21 +44,21 @@ jobs:
id: runvcpkg
with:
vcpkgArguments: openssl
vcpkgGitCommitId: 8161f655436492669adc8eb6f269dc41392ffa70
vcpkgGitCommitId: e4644bd15436d406bba71928d086c809e5c9ca45
vcpkgTriplet: x64-windows
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.7.2
version: 6.7.3
arch: win64_msvc2019_64
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install WiX
run: |
dotnet tool install -g wix --version 5.0.1
wix extension -g add WixToolset.UI.wixext/5.0.1
dotnet tool install -g wix --version 5.0.2
wix extension -g add WixToolset.UI.wixext/5.0.2
- name: Build
run: |
cmake -S . -B build `
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "common"]
path = common
url = ../qt-common
[submodule "cmake"]
path = cmake
url = ../cmake
3 changes: 1 addition & 2 deletions Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ Application::Application( int &argc, char **argv )
#endif
setWindowIcon(QIcon(u":/appicon.png"_s));
setApplicationName(u"id-updater"_s);
setApplicationVersion(u"%1.%2.%3.%4"_s
.arg( MAJOR_VER ).arg( MINOR_VER ).arg( RELEASE_VER ).arg( BUILD_VER ) );
setApplicationVersion(u"" VERSION ""_s);
setOrganizationDomain(u"ria.ee"_s);
setOrganizationName(u"RIA"_s);
setStyle(u"windowsvista"_s);
Expand Down
65 changes: 33 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
cmake_minimum_required(VERSION 3.16)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/modules/VersionInfo.cmake)
message(FATAL_ERROR "cmake submodule directory empty, did you 'git clone --recursive'?")
endif()
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
project(ID-updater VERSION 3.16.0)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
project(ID-updater VERSION 3.17.0)

include( VersionInfo )
macro( SET_ENV NAME DEF )
if( DEFINED ENV{${NAME}} )
set( ${NAME} $ENV{${NAME}} ${ARGN} )
else()
set( ${NAME} ${DEF} ${ARGN} )
endif()
endmacro()

set_env(BUILD_NUMBER 0)
set(VERSION ${PROJECT_VERSION}.${BUILD_NUMBER})
set_env( CONFIG_URL "https://id.eesti.ee/config.json" CACHE STRING "Set Config URL" )
set_env( SIGNCERT "" CACHE STRING "Common name of certificate to used sign binaries, empty skip signing" )
add_definitions( -DCONFIG_URL="${CONFIG_URL}" )
Expand All @@ -24,8 +27,7 @@ if( APPLE )
)
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_executable( id-updater-helper prefPane/id-updater-helper.m prefPane/update.m config.h )
target_compile_options(id-updater-helper PRIVATE "-Wno-unused-parameter" "-fobjc-arc")
target_link_libraries(id-updater-helper "-framework Foundation -framework CryptoTokenKit -framework Security")
target_compile_options(id-updater-helper PRIVATE -Wno-unused-parameter -fobjc-arc -fmodules)

add_custom_command( OUTPUT ID_updater.nib
COMMAND ibtool --errors --warnings --notices --output-format human-readable-text
Expand All @@ -39,7 +41,6 @@ if( APPLE )
add_library(${PROJECT_NAME} MODULE
ID_updater.nib
config.h
prefPane/Base.lproj/ID_updater.xib
${EN_RESOURCES}
${ET_RESOURCES}
${RU_RESOURCES}
Expand All @@ -56,43 +57,44 @@ if( APPLE )
BUNDLE YES
BUNDLE_EXTENSION prefPane
RESOURCES prefPane/Icon.icns
COMPILE_FLAGS "-Wno-unused-parameter -fobjc-arc"
COMPILE_FLAGS "-Wno-unused-parameter -fobjc-arc -fmodules"
XCODE_ATTRIBUTE_WRAPPER_EXTENSION prefPane
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/prefPane/Info.plist.cmake
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_GUI_IDENTIFIER "ee.ria.${PROJECT_NAME}"
MACOSX_BUNDLE_COPYRIGHT "(C) 2010-2025 Estonian Information System Authority"
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION}
MACOSX_BUNDLE_BUNDLE_VERSION ${BUILD_NUMBER}
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "ee.ria.${PROJECT_NAME}"
)
target_link_libraries(${PROJECT_NAME} ${XAR}
"-framework Cocoa"
"-framework PreferencePanes"
"-framework CryptoTokenKit"
"-framework Security"
target_link_libraries(${PROJECT_NAME} ${XAR})
add_dependencies(${PROJECT_NAME} id-updater-helper)
set_target_properties(id-updater-helper PROPERTIES
RUNTIME_OUTPUT_DIRECTORY $<TARGET_BUNDLE_CONTENT_DIR:${PROJECT_NAME}>/Resources
)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND cp $<TARGET_FILE:id-updater-helper> $<TARGET_BUNDLE_CONTENT_DIR:${PROJECT_NAME}>/Resources )
install( TARGETS ${PROJECT_NAME} DESTINATION /Library/PreferencePanes )

add_custom_target(signhelper DEPENDS ${PROJECT_NAME})
if(SIGNCERT)
add_custom_command( TARGET signhelper POST_BUILD
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND codesign -f --options=runtime -s "Developer ID Application: ${SIGNCERT}"
$<TARGET_BUNDLE_CONTENT_DIR:${PROJECT_NAME}>/Resources/id-updater-helper
$<TARGET_BUNDLE_DIR:${PROJECT_NAME}>
)
endif()
add_custom_target( pkgbuild DEPENDS signhelper
add_custom_target(pkgbuild DEPENDS ${PROJECT_NAME}
COMMAND make install DESTDIR=install
COMMAND chmod 755 install/Library/PreferencePanes/ID-updater.prefPane/Contents/Resources/id-updater-helper
COMMAND pkgbuild --root install "$<$<BOOL:${SIGNCERT}>:--sign;${SIGNCERT}>" updater_${VERSION}$ENV{VER_SUFFIX}.pkg
COMMAND_EXPAND_LISTS
)
add_custom_target(zipdebug DEPENDS ${PROJECT_NAME}
COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $<TARGET_FILE:${PROJECT_NAME}>
COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $<TARGET_FILE:id-updater-helper>
COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $<TARGET_FILE:${PROJECT_NAME}> $<TARGET_FILE:id-updater-helper>
COMMAND zip -r updater-dbg_${VERSION}$ENV{VER_SUFFIX}.zip ${PROJECT_NAME}.dSYM
)
else()
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/common/CMakeLists.txt)
message(FATAL_ERROR "cmake submodule directory empty, did you 'git clone --recursive'?")
endif()
file( DOWNLOAD ${CONFIG_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.json )
string( REPLACE ".json" ".rsa" RSA_URL ${CONFIG_URL} )
file( DOWNLOAD ${RSA_URL} ${CMAKE_CURRENT_BINARY_DIR}/config.rsa )
Expand All @@ -101,8 +103,6 @@ else()
find_package(OpenSSL 3.0.0 REQUIRED)
find_package(Qt6 6.0.0 REQUIRED COMPONENTS Core Widgets Network LinguistTools)

include_directories( ${CMAKE_CURRENT_BINARY_DIR} common/qtsingleapplication/src )

configure_file( translations.qrc translations.qrc COPYONLY )
qt_add_translation(SOURCES idupdater_et.ts idupdater_ru.ts
common/translations/qtbase_et.ts common/translations/qtbase_ru.ts
Expand All @@ -121,7 +121,6 @@ else()
${CMAKE_CURRENT_BINARY_DIR}/config.qrc
common/Common.cpp
common/Configuration.cpp
common/QPCSC.cpp
common/qtsingleapplication/src/qtlocalpeer.cpp
common/qtsingleapplication/src/qtsingleapplication.cpp
)
Expand All @@ -134,12 +133,15 @@ else()
INTERPROCEDURAL_OPTIMIZATION YES
INTERPROCEDURAL_OPTIMIZATION_DEBUG NO
)
target_include_directories(${PROJECT_NAME} PRIVATE common/qtsingleapplication/src)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
target_compile_definitions(${PROJECT_NAME} PRIVATE
WIN32_LEAN_AND_MEAN
UNICODE
CONFIG_URL="${CONFIG_URL}"
COMMON_STATIC
NO_CACHE
VERSION="${VERSION}"
VERSION_INF=${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH},${BUILD_NUMBER}
)
target_link_libraries(${PROJECT_NAME} Qt6::Widgets Qt6::Network OpenSSL::Crypto
msi wintrust Crypt32 taskschd comsupp Setupapi winscard Wtsapi32
Expand All @@ -163,17 +165,16 @@ else()
COMMAND wix.exe build -nologo
-arch ${PLATFORM}
-ext WixToolset.UI.wixext
-bv WixUIDialogBmp=${CMAKE_SOURCE_DIR}/cmake/modules/dlgbmp.bmp
-bv WixUIBannerBmp=${CMAKE_SOURCE_DIR}/cmake/modules/banner.bmp
-d MSI_VERSION=${VERSION}
-bv WixUIDialogBmp=${CMAKE_SOURCE_DIR}/common/dlgbmp.bmp
-bv WixUIBannerBmp=${CMAKE_SOURCE_DIR}/common/banner.bmp
-d appicon=${CMAKE_SOURCE_DIR}/appicon.ico
-d qt_path=${qtCore_install_prefix}
-d qt_suffix=$<$<CONFIG:Debug>:d>
-d libs_path="${SSL_PATH}"
-d updater_path=$<TARGET_FILE:${PROJECT_NAME}>
${CMAKE_SOURCE_DIR}/idupdater.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WelcomeDlg.wxs
${CMAKE_SOURCE_DIR}/cmake/modules/WixUI_Minimal.wxs
${CMAKE_SOURCE_DIR}/common/WelcomeDlg.wxs
${CMAKE_SOURCE_DIR}/common/WixUI_Minimal.wxs
-o ${MSI_FILE}.msi
)
if(SIGNCERT)
Expand Down
1 change: 0 additions & 1 deletion cmake
Submodule cmake deleted from 8ce75e
2 changes: 1 addition & 1 deletion common
37 changes: 19 additions & 18 deletions idupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "common/Common.h"
#include "common/Configuration.h"
#include "common/QPCSC.h"

#include <QDebug>
#include <QDir>
Expand All @@ -41,6 +40,8 @@
#include <Msi.h>
#include <Softpub.h>

using namespace Qt::StringLiterals;

idupdaterui::idupdaterui( const QString &version, idupdater *parent )
: QWidget()
{
Expand Down Expand Up @@ -103,13 +104,13 @@ idupdater::idupdater( QObject *parent )
, version(installedVersion("{f1c4d351-269d-4bee-8cdb-6ea70c968875}"))
, conf(new Configuration(this))
{
QString userAgent = QStringLiteral("%1/%2 (%3) Lang: %4 Devices: %5")
QString userAgent = "%1/%2 (%3) Lang: %4 Devices: %5"_L1
.arg(QApplication::applicationName(), QApplication::applicationVersion(), Common::applicationOs(),
QLocale().uiLanguages().first(), QPCSC::instance().drivers().join('/'));
QLocale().uiLanguages().first(), Common::drivers().join('/'));
qDebug() << "User-Agent:" << userAgent;
request.setRawHeader( "User-Agent", userAgent.toUtf8() );
connect(conf, &Configuration::finished, this, &idupdater::finished);
connect(this, &QNetworkAccessManager::sslErrors, this, [=](QNetworkReply *reply, const QList<QSslError> &errors){
connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList<QSslError> &errors) {
QList<QSslError> ignore;
for(const QSslError &error: errors)
{
Expand All @@ -118,7 +119,7 @@ idupdater::idupdater( QObject *parent )
case QSslError::UnableToGetLocalIssuerCertificate:
case QSslError::CertificateUntrusted:
case QSslError::SelfSignedCertificateInChain:
if(trusted.contains(reply->sslConfiguration().peerCertificate())) {
if(reply->sslConfiguration().caCertificates().contains(reply->sslConfiguration().peerCertificate())) {
ignore << error;
break;
}
Expand Down Expand Up @@ -151,29 +152,29 @@ void idupdater::finished(bool /*changed*/, const QString &err)

QJsonObject obj = conf->object();
trusted.clear();
for(const auto &c: conf->object().value(QLatin1String("CERT-BUNDLE")).toArray())
for(const auto array = conf->object().value("CERT-BUNDLE"_L1).toArray(); const auto &c: array)
trusted.append(QSslCertificate(QByteArray::fromBase64(c.toString().toLatin1()), QSsl::Der));
if(obj.contains(QLatin1String("UPDATER-MESSAGE-URL")))
if(obj.contains("UPDATER-MESSAGE-URL"_L1))
{
QSslConfiguration ssl = QSslConfiguration::defaultConfiguration();
ssl.setCaCertificates({});
ssl.setCaCertificates(trusted);
auto copy = request;
copy.setSslConfiguration(ssl);
copy.setUrl(obj.value(QLatin1String("UPDATER-MESSAGE-URL")).toString());
copy.setUrl(obj.value("UPDATER-MESSAGE-URL"_L1).toString());
QNetworkReply *reply = get(copy);
connect(reply, &QNetworkReply::finished, this, [this, reply]{
if(reply->error() == QNetworkReply::NoError)
emit message(reply->readAll());
reply->deleteLater();
});
}
else if(obj.contains(QLatin1String("WIN-MESSAGE")))
emit message(obj.value(QLatin1String("WIN-MESSAGE")).toString());
else if(obj.contains("WIN-MESSAGE"_L1))
emit message(obj.value("WIN-MESSAGE"_L1).toString());

if(obj.contains(QLatin1String("WIN-UPGRADECODE")))
version = installedVersion(obj.value(QLatin1String("WIN-UPGRADECODE")).toString());
QString available = obj.value(QLatin1String("WIN-LATEST")).toString();
request.setUrl(obj.value(QLatin1String("WIN-DOWNLOAD")).toString());
if(obj.contains("WIN-UPGRADECODE"_L1))
version = installedVersion(obj.value("WIN-UPGRADECODE"_L1).toString());
QString available = obj.value("WIN-LATEST"_L1).toString();
request.setUrl(obj.value("WIN-DOWNLOAD"_L1).toString());
qDebug() << "Installed version" << version << "available version" << available;

if(!lessThanVersion(version, available))
Expand All @@ -198,11 +199,11 @@ void idupdater::finished(bool /*changed*/, const QString &err)
QString idupdater::installedVersion(const QString &upgradeCode) const
{
QString code = upgradeCode.toUpper();
QSettings s(QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), QSettings::Registry32Format);
QSettings s(u"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"_s, QSettings::Registry32Format);
for(const QString &key: s.childGroups()) {
s.beginGroup(key);
if(s.value(QStringLiteral("/BundleUpgradeCode")).toString().toUpper() == code)
return s.value(QStringLiteral("/DisplayVersion")).toString();
if(s.value(u"/BundleUpgradeCode"_s).toString().toUpper() == code)
return s.value(u"/DisplayVersion"_s).toString();
s.endGroup();
}

Expand Down
13 changes: 5 additions & 8 deletions idupdater.rc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include <winver.h>

#define VER_STR_HELPER(x) #x
#define VER_STR(x) VER_STR_HELPER(x)

VS_VERSION_INFO VERSIONINFO
FILEVERSION MAJOR_VER,MINOR_VER,RELEASE_VER,BUILD_VER
PRODUCTVERSION MAJOR_VER,MINOR_VER,RELEASE_VER,BUILD_VER
FILEVERSION VERSION_INF
PRODUCTVERSION VERSION_INF
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
Expand All @@ -22,12 +19,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "RIA"
VALUE "FileDescription", "ID Updater Application"
VALUE "FileVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER)
VALUE "FileVersion", VERSION
VALUE "InternalName", "id-updater"
VALUE "LegalCopyright", "Copyright (C) 2009-2024 Estonian Information System Authority"
VALUE "LegalCopyright", "Copyright (C) 2009-2025 Estonian Information System Authority"
VALUE "OriginalFilename", "id-updater.exe"
VALUE "ProductName", "id-updater"
VALUE "ProductVersion", VER_STR(MAJOR_VER.MINOR_VER.RELEASE_VER.BUILD_VER)
VALUE "ProductVersion", VERSION
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion idupdater.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="Open-EID Updater" UpgradeCode="d3aa8bd7-e1e6-46d0-97a6-c9b87d2b830b"
Language="1033" Version="$(var.MSI_VERSION)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">
Language="1033" Version="!(bind.FileVersion.id_updater.exe)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500">
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<Icon Id="appicon.ico" SourceFile="$(var.appicon)" />
<Property Id="ARPPRODUCTICON" Value="appicon.ico" />
Expand Down
2 changes: 0 additions & 2 deletions qt.conf

This file was deleted.

0 comments on commit cc47f95

Please sign in to comment.