Centralize version type handling in the build system - #6237
Conversation
Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
✅ Wave C Policy Gate: Hash & SBOM IntegrityResult: ✅ Hash & SBOM Integrity PASSED Checks
|
✅ Wave C Policy Gate: Edition & License ValidationResult: ✅ Edition & License Validation PASSED Checks
|
There was a problem hiding this comment.
🟡 Changes recommended
As written, it can break configuration/packaging flows (undefined _ver_numeric and unstable VERSION resolution via CMAKE_SOURCE_DIR) and the BuildInfo propagation does not match the stated “generated build-info metadata” behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR centralizes semantic version parsing in the CMake build system by deriving both the numeric MAJOR.MINOR.PATCH and a normalized prerelease “version type” from the repository VERSION file, then exposing these values to the build via cache variables and compile definitions.
Changes:
- Move version parsing to
cmake/Versions.cmakeand switchproject(VERSION ...)to useTHEMIS_VERSION_NUMERIC. - Introduce and expose
THEMIS_VERSION_TYPE(normalized from prerelease identifiers) as a cache value and compile definition. - Propagate version type into build-info compile definitions and configure-time status output.
File summaries
| File | Description |
|---|---|
| CMakeLists.txt | Switches top-level version resolution to cmake/Versions.cmake and uses THEMIS_VERSION_NUMERIC for project(). |
| cmake/Versions.cmake | Adds parsing/normalization for THEMIS_VERSION_TYPE and exports version data via cache + compile defs. |
| cmake/CMakeLists.txt | Replaces inline VERSION parsing with Versions.cmake and forwards the new version variables to compile defs. |
| cmake/BuildInfo.cmake | Adds THEMIS_VERSION_TYPE to build-info compile definitions and prints it in the BuildInfo banner. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # Read VERSION first (before project()) | ||
| if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION") | ||
| message(FATAL_ERROR "VERSION file not found at ${CMAKE_CURRENT_SOURCE_DIR}/VERSION") | ||
| include(cmake/Versions.cmake) | ||
| if(NOT DEFINED THEMIS_VERSION_NUMERIC OR "${THEMIS_VERSION_NUMERIC}" STREQUAL "") | ||
| message(FATAL_ERROR "Version metadata could not be resolved from ${CMAKE_CURRENT_SOURCE_DIR}/VERSION") | ||
| endif() |
| # Read VERSION from project root | ||
| if(NOT EXISTS "${CMAKE_SOURCE_DIR}/VERSION") | ||
| message(FATAL_ERROR "VERSION file not found at ${CMAKE_SOURCE_DIR}/VERSION") | ||
| endif() | ||
|
|
||
| file(READ "${CMAKE_SOURCE_DIR}/VERSION" THEMIS_VERSION_STRING) | ||
| string(STRIP "${THEMIS_VERSION_STRING}" THEMIS_VERSION_STRING) |
| list(APPEND THEMIS_GLOBAL_COMPILE_DEFINITIONS | ||
| THEMIS_BUILD_UUID="${THEMIS_BUILD_UUID}" | ||
| THEMIS_BUILD_VERSION_STRING="${THEMIS_BUILD_VERSION_STRING}" | ||
| THEMIS_VERSION_TYPE="${THEMIS_VERSION_TYPE}" | ||
| ) |
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
✅ Wave C Policy Gate: Community Fail-Closed ValidationResult: ✅ Community Fail-Closed Validation PASSED Checks
|
✅ Wave C Policy Gate: Private Plugin Boundary EnforcementResult: ✅ Private Plugin Boundary Enforcement PASSED Checks
|
Pull Request
Target Version (Required)
Target Version: [Unreleased]
This is a build-system and metadata change that should land on the next unreleased development line rather than a patch release.
Description
The build system now derives a normalized version type from the repository
VERSIONfile alongside the numeric version, so prerelease identifiers such asalpha,beta,rc1,nightly, andunstableare handled consistently.cmake/Versions.cmakeso both the numeric version and the version type are resolved from one source of truth.THEMIS_VERSION_TYPE(and the numeric version) through CMake cache values and compile definitions for broader build-time consumers.Linked Issues
Type of Change
Breaking Change Checklist
VERSIONandCMakeLists.txtdocs/migration/### Removed/### Changedsection updatedTesting
Security Tiering Impact (Required for Runtime Changes)
Impacted tier(s):
Trust-boundary crossings documented in PR description (example: T3 -> T2, T5 -> T4 brokered call)
Boundary controls validated for affected T3/T4/T5 paths (AuthN/AuthZ, validation, rate limits, audit)
Boundary-focused tests added/updated or explicit N/A rationale provided
If trust level/privilege increased, security maintainer approval is attached
📚 Research & Knowledge (wenn applicable)
/docs/research/angelegt?/docs/research/implementation_influence/eingetragen?Relevante Quellen:
AI-Generated Code (KI-generierter Code)
GetSymbolReferences_CppToolsgeprüft (siehe.github/instructions/cpp-language-service-tools.instructions.md)new/deleteohne explizites Review eingeführtAI Review Workflow (Required for AI-assisted PRs)
.github/prompts/pr-diff-findings-review.prompt.md.github/prompts/security-hardening-review.prompt.md(or N/A documented).github/prompts/api-change-impact-review.prompt.md(or N/A documented).github/copilot/REVIEW_SEVERITY_POLICY.mdHigh-Finding Exception Record (only if High is accepted)
High-finding exception claimed in this PR
Finding reference:
Maintainer approver:
Mitigation in current release:
Target fix milestone:
Tracking issue:
Validation evidence:
Release Readiness Gate (Required for release-scoped changes)
.github/prompts/release-readiness-check.prompt.mdfor branch transition scopeBRANCHING_STRATEGY.mdandRELEASE_STRATEGY.mdVERSIONING.mdandCHANGELOG.mdChecklist
[Unreleased]Scanner and IntelliSense Gates
criticalfindings in categoriessecurity,input_validation,query_correctness,distributed_consistency,concurrency,memoryhighfindings in the same categories (or explicitly approved)unknownscanner findings triaged (fixed, re-categorized, or justified)