Skip to content

feat: complete semantic versioning — qmake VERSION var + setApplicationVersion#110

Merged
MaximumTrainer merged 3 commits intomasterfrom
copilot/implement-semantic-versioning
Mar 17, 2026
Merged

feat: complete semantic versioning — qmake VERSION var + setApplicationVersion#110
MaximumTrainer merged 3 commits intomasterfrom
copilot/implement-semantic-versioning

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

The versioning system was missing two pieces: the Windows .exe metadata version (visible in file Properties → Details) and QCoreApplication::applicationVersion() returning the actual build version at runtime.

The async GitHub update-check flow (VersionDAODialogLoginUpdateDialog), semantic version comparison (Util::isVersionNewer), and APP_VERSION macro injection from git tags were already fully implemented.

Changes

  • PowerVelo.pro — Derives qmake's VERSION variable from GIT_VERSION by stripping the leading v and any git describe suffix (e.g. v1.2.3-14-gabcdef1.2.3). qmake uses this to auto-generate the Windows RC file that populates the .exe Details tab.
NUMERIC_VERSION = $$replace(GIT_VERSION, ^[vV], "")
NUMERIC_VERSION = $$section(NUMERIC_VERSION, -, 0, 0)
isEmpty(NUMERIC_VERSION): NUMERIC_VERSION = "0.0.0"
VERSION = $$NUMERIC_VERSION
  • src/app/globalvars.cpp — Calls QCoreApplication::setApplicationVersion(Environnement::getVersion()) alongside the existing setOrganizationName / setApplicationName calls, so QCoreApplication::applicationVersion() returns the correct version throughout the app lifecycle.
Original prompt

This section details on the original issue you should resolve

<issue_title>Implementation of Semantic Versioning and Automated Update Check</issue_title>
<issue_description>Context: The project is a Qt-based C++ application (MaximumTrainer_Redux). We need to implement a robust versioning system that embeds version metadata into the executable and performs a check against the latest GitHub release upon startup.

Objective: 1. Embed Version Metadata: Ensure the .exe (Windows) and application instance contain the current version string.
2. GitHub Version Validation: At startup, fetch the latest release tag from the GitHub API.
3. Conditional Upgrade UI: Compare the local version with the GitHub version. Only trigger the upgrade dialog/window if local_version < github_version.

Technical Requirements:

  1. Version Definition & Metadata
    Centralized Versioning: Define the version (e.g., 1.2.3) in a central location. Preferably in the PowerVelo.pro file using the VERSION variable or a dedicated version.h header.

Application Metadata: Call QCoreApplication::setApplicationVersion() in main.cpp using this defined version.

Windows Executable Metadata: Ensure the version appears in the "Details" tab of the .exe file properties. (Hint: If using qmake, ensure VERSION is set in the .pro file or a .rc file is generated/included).

  1. Update Checker Logic
    Class/Module: Create or update a VersionChecker class using QNetworkAccessManager.

Endpoint: Query the GitHub Releases API: https://api.github.com/repos/MaximumTrainer/MaximumTrainer_Redux/releases/latest.

Parsing: Use QJsonDocument to extract the tag_name (e.g., "v1.2.4").

Comparison: Implement a semantic version comparison (handling major.minor.patch). Do not do a simple string comparison to avoid issues like "1.10" being flagged as older than "1.2".

  1. UI Integration
    Silent Check: The version check should happen asynchronously in the background immediately after the application starts.

Conditional Trigger: * IF CurrentVersion < GitHubVersion: Display the existing upgrade window/dialog.

ELSE: Proceed to the main application screen silently with no pop-ups.

Implementation Notes for Developer:
Error Handling: If the user is offline or the GitHub API is unreachable, the app should fail silently and continue to the main screen.

User Agent: Remember to set a User-Agent header in the QNetworkRequest, as required by the GitHub API.

Asynchronous: Ensure the network call does not block the GUI thread.</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add semantic versioning and automated update check feat: complete semantic versioning — qmake VERSION var + setApplicationVersion Mar 17, 2026
Copilot AI requested a review from MaximumTrainer March 17, 2026 12:31
@MaximumTrainer MaximumTrainer requested review from Copilot and removed request for MaximumTrainer March 17, 2026 12:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Completes the app’s semantic-version plumbing by ensuring the qmake project VERSION is set (for Windows executable version metadata) and that QCoreApplication::applicationVersion() is populated at runtime from the existing build-time version source.

Changes:

  • Derive qmake VERSION from GIT_VERSION to drive Windows RC/.exe “Details” version fields.
  • Set QCoreApplication::setApplicationVersion(Environnement::getVersion()) during early app initialization.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PowerVelo.pro Adds logic to compute and assign qmake VERSION from git describe output for Windows version metadata.
src/app/globalvars.cpp Sets Qt application version at startup using Environnement::getVersion().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread PowerVelo.pro Outdated
# git-describe suffix (e.g. "-14-gabcdef") is removed, leaving "MAJOR.MINOR.PATCH".
NUMERIC_VERSION = $$replace(GIT_VERSION, ^[vV], "")
NUMERIC_VERSION = $$section(NUMERIC_VERSION, -, 0, 0)
isEmpty(NUMERIC_VERSION): NUMERIC_VERSION = "0.0.0"
@MaximumTrainer MaximumTrainer marked this pull request as ready for review March 17, 2026 12:49
@MaximumTrainer
Copy link
Copy Markdown
Owner

@copilot fix the failing windows build "LINK : fatal error LNK1117: syntax error in option 'VERSION:21ab926'

This error indicates that the /VERSION option provided to the linker is not in the expected format. According to Microsoft documentation, the /VERSION switch expects a numeric value in the form: major[.minor], such as /VERSION:1.0."

Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 17, 2026

@copilot fix the failing windows build "LINK : fatal error LNK1117: syntax error in option 'VERSION:21ab926'

This error indicates that the /VERSION option provided to the linker is not in the expec...

Fixed in 7f8bd45. The issue was that git describe --always returns a bare commit hash (e.g. 21ab926) in shallow CI checkouts without tag history, and qmake was passing that directly as VERSION to the MSVC linker.

The fix adds a contains() guard that validates NUMERIC_VERSION starts with digit.digit before assigning it — anything that doesn't match (bare hash, empty, letters-only) falls back to "0.0.0":

!contains(NUMERIC_VERSION, ^[0-9]+\\.[0-9]+): NUMERIC_VERSION = "0.0.0"

Copilot AI requested a review from MaximumTrainer March 17, 2026 16:53
@MaximumTrainer MaximumTrainer merged commit 423161c into master Mar 17, 2026
15 checks passed
@MaximumTrainer MaximumTrainer deleted the copilot/implement-semantic-versioning branch March 17, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implementation of Semantic Versioning and Automated Update Check

3 participants