Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ endif()
include(ClangTidy)
include(Fuzzing)

message(STATUS "Configuring src/common/version.h")
configure_file(${CMAKE_SOURCE_DIR}/src/common/version.h.in
${CMAKE_SOURCE_DIR}/src/common/version.h)

message(STATUS "Configuring src/common/version.cpp")
configure_file(${CMAKE_SOURCE_DIR}/src/common/version.cpp.in
${CMAKE_SOURCE_DIR}/src/common/version.cpp)
Expand Down
15 changes: 0 additions & 15 deletions src/common/version.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@
#define STRINGIFY_IMPL(x) #x
#define STRINGIFY(x) STRINGIFY_IMPL(x)

// Git information (populated by CMake)
constexpr std::string_view version::GetGitSha() noexcept { return "@GIT_SHA1@"; }

constexpr std::string_view version::GetGitBranch() noexcept {
return "@GIT_BRANCH@";
}

constexpr std::string_view version::GetGitDate() noexcept {
return "@GIT_DATE@";
}

constexpr std::string_view version::GetGitCommitSubject() noexcept {
return "@GIT_COMMIT_SUBJECT@";
}

// Enhanced version information
std::string version::GetVersionString() {
std::ostringstream oss;
Expand Down
12 changes: 6 additions & 6 deletions src/common/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

This generated file should not be tracked in version control. The src/common/version.h file should be added to .gitignore since it's automatically generated from version.h.in by CMake.

Copilot uses AI. Check for mistakes.
===========================================================================

Copyright (c) 2010-2015 Darkstar Dev Teams
Expand Down Expand Up @@ -28,11 +28,11 @@

namespace version
{
// Git information
[[nodiscard]] constexpr std::string_view GetGitSha() noexcept;
[[nodiscard]] constexpr std::string_view GetGitBranch() noexcept;
[[nodiscard]] constexpr std::string_view GetGitDate() noexcept;
[[nodiscard]] constexpr std::string_view GetGitCommitSubject() noexcept;
// Git information (inline constexpr definitions)
[[nodiscard]] constexpr std::string_view GetGitSha() noexcept { return "bffe7228-dirty"; }
[[nodiscard]] constexpr std::string_view GetGitBranch() noexcept { return "copilot/fix-bb947640-5a4e-4ab3-a31a-e26b94a289f5"; }
[[nodiscard]] constexpr std::string_view GetGitDate() noexcept { return "Mon Sep 1 14:17:00 2025"; }
[[nodiscard]] constexpr std::string_view GetGitCommitSubject() noexcept { return "Fix version function compilation errors - main CI/CD issue resolved"; }

// Enhanced version information
[[nodiscard]] std::string GetVersionString();
Expand Down
65 changes: 65 additions & 0 deletions src/common/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
===========================================================================

Copyright (c) 2010-2015 Darkstar Dev Teams

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/

===========================================================================
*/

#pragma once

#include <chrono>
#include <cstdint>
#include <string>
#include <string_view>

namespace version
{
// Git information (inline constexpr definitions)
[[nodiscard]] constexpr std::string_view GetGitSha() noexcept { return "@GIT_SHA1@"; }
[[nodiscard]] constexpr std::string_view GetGitBranch() noexcept { return "@GIT_BRANCH@"; }
[[nodiscard]] constexpr std::string_view GetGitDate() noexcept { return "@GIT_DATE@"; }
[[nodiscard]] constexpr std::string_view GetGitCommitSubject() noexcept { return "@GIT_COMMIT_SUBJECT@"; }

// Enhanced version information
[[nodiscard]] std::string GetVersionString();
[[nodiscard]] std::string GetFullVersionString();
[[nodiscard]] std::string GetBuildInfo();

// Version components
struct VersionInfo
{
std::uint16_t major;
std::uint16_t minor;
std::uint16_t patch;
std::string_view git_sha;
std::string_view git_branch;
std::string_view build_date;
std::string_view compiler_version;
std::string_view cmake_version;
};

[[nodiscard]] constexpr VersionInfo GetVersionInfo() noexcept;

// Runtime information
[[nodiscard]] std::string GetRuntimeInfo();
[[nodiscard]] std::chrono::system_clock::time_point GetBuildTimestamp();

// Feature flags
[[nodiscard]] constexpr bool HasFeature(std::string_view feature) noexcept;
[[nodiscard]] std::string GetEnabledFeatures();

} // namespace version
Loading