Skip to content

Quality: version string is hardcoded in dispatch.cpp and not tied to the build #55

Description

@KrisPowers

Summary

The host version is a compile-time string literal at the top of cpp/host/dispatch.cpp:

static constexpr const char* kHostVersion = "1.0.0";

This version is shown in /version, /debug, and debug.version IPC responses. It is not tied to any build system variable, CMake version, or git tag. This means the version shown to users is only updated when someone manually edits this constant, and it is easy to ship a build with a stale version number.

How to fix

Define the version in CMakeLists.txt using project(Binder VERSION 1.2.3) and pass it to the compilation unit via a preprocessor definition:

target_compile_definitions(binder_host PRIVATE
    BINDER_VERSION="${CMAKE_PROJECT_VERSION}"
)

Then in dispatch.cpp:

static constexpr const char* kHostVersion = BINDER_VERSION;

Alternatively, generate a version.hpp header from CMake using configure_file.

Files

  • cpp/host/dispatch.cpp (line 47, kHostVersion constant)
  • cpp/CMakeLists.txt (add version propagation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions