Skip to content

Conversation

@DH-SuBaKu
Copy link

Summary

Implements version number detection with the following priority:

  1. CMake cache variable (-DVERSION_NUMBER=...)
  2. Environment variable (VERSION_NUMBER)
  3. Git describe (git describe --tags --dirty --always)
  4. Fallback to '0.0.0-dev'

The version is now displayed in:

  • Help output (-h/--help)
  • Version flag (--version)

Version detection normalizes git tags by removing 'v' prefix, stripping commit hashes, and cleaning dirty markers.

Fixes #309

Type of Change

  • New feature (non-breaking change which adds functionality)

Test Plan

Ran the full test suite to verify the changes don't break existing functionality:

cd ~/playground/openzl/build
ctest

All ~1200 C/C++ unit tests passed successfully.

Ran the CLI integration test suite:

cd ~/playground/openzl/cli/tests
python3 cli_integration_tests.py ../../build/cli/zli

All 14 integration tests passed successfully.

Manually verified version display:

  • ./build/cli/zli --help - shows version in help header
  • ./build/cli/zli --version - displays version string

Test Configuration

  • Compiler: GCC (default system compiler)
  • Build type: Release
  • Platform(s): Linux (WSL - Windows Subsystem for Linux)

Implements version number detection with the following priority:
1. CMake cache variable (-DVERSION_NUMBER=...)
2. Environment variable (VERSION_NUMBER)
3. Git describe (git describe --tags --dirty --always)
4. Fallback to '0.0.0-dev'

The version is now displayed in:
- Help output (-h/--help)
- Version flag (--version)

Version detection normalizes git tags by removing 'v' prefix,
stripping commit hashes, and cleaning dirty markers.

Fixes facebook#309
@meta-cla meta-cla bot added the cla signed label Dec 30, 2025
@DH-SuBaKu
Copy link
Author

Hey maintainers! I implemented version detection with three options:

  1. Compile Macro (-DVERSION_NUMBER=...)
  2. Environment variable (VERSION_NUMBER)
  3. Git describe fallback

The environment variable option is for CI/CD convenience, but I'm happy to simplify
if you think it's overkill. Let me know your preference!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI should display a version number

1 participant