From e7ab7a6e46bdda8f65e84b4d46c35be0698be986 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 6 Jan 2025 14:25:30 +0200 Subject: [PATCH] Update version number IB-8336 Signed-off-by: Raul Metsma --- .github/workflows/build.yml | 10 +++--- .gitmodules | 3 -- Application.cpp | 3 +- CMakeLists.txt | 65 +++++++++++++++++++------------------ cmake | 1 - common | 2 +- idupdater.cpp | 37 +++++++++++---------- idupdater.rc | 13 +++----- idupdater.wxs | 2 +- qt.conf | 2 -- 10 files changed, 64 insertions(+), 74 deletions(-) delete mode 160000 cmake delete mode 100644 qt.conf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 987cec4..c313397 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -46,12 +44,12 @@ 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 @@ -59,8 +57,8 @@ jobs: 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 ` diff --git a/.gitmodules b/.gitmodules index a2cf6da..eed6069 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "common"] path = common url = ../qt-common -[submodule "cmake"] - path = cmake - url = ../cmake diff --git a/Application.cpp b/Application.cpp index b5bdf27..66a4895 100644 --- a/Application.cpp +++ b/Application.cpp @@ -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); diff --git a/CMakeLists.txt b/CMakeLists.txt index 851c5b7..890b1aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}" ) @@ -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 @@ -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} @@ -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 $/Resources ) - add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD - COMMAND cp $ $/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}" $/Resources/id-updater-helper $ ) 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 "$<$:--sign;${SIGNCERT}>" updater_${VERSION}$ENV{VER_SUFFIX}.pkg COMMAND_EXPAND_LISTS ) add_custom_target(zipdebug DEPENDS ${PROJECT_NAME} - COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $ - COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $ + COMMAND dsymutil -o ${PROJECT_NAME}.dSYM $ $ 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 ) @@ -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 @@ -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 ) @@ -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 @@ -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=$<$:d> -d libs_path="${SSL_PATH}" -d updater_path=$ ${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) diff --git a/cmake b/cmake deleted file mode 160000 index 8ce75e6..0000000 --- a/cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8ce75e6057067ca51d7c619d34d88422bad201e5 diff --git a/common b/common index 8e4034f..f470100 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 8e4034fff04708e305d0bc9df8e445d6c3ffc81f +Subproject commit f470100aa0411bfda3e1a8b8318ad59f0d7e0db8 diff --git a/idupdater.cpp b/idupdater.cpp index ca1832e..abbb74d 100644 --- a/idupdater.cpp +++ b/idupdater.cpp @@ -21,7 +21,6 @@ #include "common/Common.h" #include "common/Configuration.h" -#include "common/QPCSC.h" #include #include @@ -41,6 +40,8 @@ #include #include +using namespace Qt::StringLiterals; + idupdaterui::idupdaterui( const QString &version, idupdater *parent ) : QWidget() { @@ -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 &errors){ + connect(this, &QNetworkAccessManager::sslErrors, this, [](QNetworkReply *reply, const QList &errors) { QList ignore; for(const QSslError &error: errors) { @@ -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; } @@ -151,15 +152,15 @@ 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) @@ -167,13 +168,13 @@ void idupdater::finished(bool /*changed*/, const QString &err) 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)) @@ -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(); } diff --git a/idupdater.rc b/idupdater.rc index d630f0d..172488a 100644 --- a/idupdater.rc +++ b/idupdater.rc @@ -1,11 +1,8 @@ #include -#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 @@ -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" diff --git a/idupdater.wxs b/idupdater.wxs index 738d440..7640465 100644 --- a/idupdater.wxs +++ b/idupdater.wxs @@ -19,7 +19,7 @@ + Language="1033" Version="!(bind.FileVersion.id_updater.exe)" Codepage="1251" Manufacturer="RIA" InstallerVersion="500"> diff --git a/qt.conf b/qt.conf deleted file mode 100644 index bf65c1a..0000000 --- a/qt.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Platforms] -WindowsArguments = dpiawareness=1 \ No newline at end of file