fix(update): stamp the installed release so it is not offered twice
The checkout path installed with the build's configured prefix instead of installing into the directory holding the running copy, so the binary in use and its version marker both stayed at the old release: the app kept reporting that version and offered the same update again at every launch. Every method now stages and installs into the running binary's directory, the install step writes the release it just installed next to the binary, and currentVersion() reads the version compiled into the running build first, falling back to the marker file. The repo-root `version` file stays the single source of truth: CMake compiles it in. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
632cdf1dea
commit
5756704b03
5 files changed
+132
-42
No files matched your search
@@ -7,6 +7,13 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# The repo-root `version` file is the single source of truth for release
|
||||
# versioning. It is compiled into the binaries as well as installed next to
|
||||
# them, so a running app always reports the release it was built from instead
|
||||
# of trusting a `version` file that an update may have left stale.
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/version PACMANAGER_VERSION)
|
||||
string(STRIP "${PACMANAGER_VERSION}" PACMANAGER_VERSION)
|
||||
|
||||
# Find Qt6
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Network)
|
||||
|
||||
@@ -39,6 +46,8 @@ add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
|
||||
|
||||
# Copy the version file next to the executable so UpdateManager can read the
|
||||
# running build's version at runtime.
|
||||
@@ -124,6 +133,8 @@ add_executable(update-manager-test tests/update-manager.test.cpp
|
||||
src/update-manager.cpp src/app-logging.cpp include/update-manager.h)
|
||||
target_include_directories(update-manager-test PRIVATE include)
|
||||
target_link_libraries(update-manager-test PRIVATE Qt6::Core Qt6::Network)
|
||||
target_compile_definitions(update-manager-test PRIVATE
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
|
||||
add_test(NAME update-manager-test COMMAND update-manager-test)
|
||||
|
||||
# ---- Plugins ----
|
||||
|
||||
Reference in new issue
Block a user