Repository navigation
version: expose the resolved build version in header and runtime - #120
Merged
Merged
Conversation
Render the public header version macros from the same tag or override that CMake and the package manifest use, and expose lancedb_version() from the library as a static string. Direct Cargo builds resolve the same tags without requiring CMake or Python. Package creation renders the header for its manifest version, and release verification derives the expected header from the exact tagged source plus the tag version. Keep the checked-in header usable directly with its development defaults. Refs #99
CMake configuration watched HEAD and tag refs but not the branch ref behind a symbolic HEAD, so an incremental build after moving the branch off a release tag reused the old version. Track the effective symbolic ref path plus its parent, covering loose, packed and linked-worktree refs.
Render generated headers under ${CMAKE_BINARY_DIR}/generated/include instead of ${CMAKE_BINARY_DIR}/include. In-source configuration no longer overwrites include/lancedb.h, and consumer and install paths follow the dedicated directory.
Refs #99
Replace sscanf with two-level stringification of the numeric version macros and compare the runtime version prefix plus a valid -, + or NUL boundary. The exact header/runtime comparison and numeric macro assertion remain, without CRT deprecation warnings on MSVC. Validated with strict C17 source, CMake-generated and package headers on GCC and Clang, the C17 consumer for dev and +build versions, package/release fixtures and the host/MSVC LLP64 ABI check.
…ospection # Conflicts: # CMakeLists.txt
…ders Watch the closest existing ancestor of a missing loose symbolic ref so a packed nested branch that creates its hierarchy on the next update still reconfigures. Watch reftable/tables.list in both the per-worktree and common Git directories, and teach build.rs the same reftable path for direct Cargo builds. Only rewrite the generated header when the rendered bytes differ. Non-tag branch advances then leave its mtime unchanged and do not rebuild consumers for identical content; LF and version validation remain in place. Validated with nested packed and reftable fixtures under Ninja and Unix Makefiles, including linked-worktree reftable refs, installed header/runtime comparisons, direct Cargo reftable builds and unchanged header mtimes.
This was referenced Nov 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the version introspection slice of #99. Includes current main (#121) with coverage removed.
The public header exposes
LANCEDB_VERSION_MAJOR,LANCEDB_VERSION_MINOR,LANCEDB_VERSION_PATCH,LANCEDB_VERSION_STRINGand theLANCEDB_VERSIONalias.lancedb_version()returns the same resolved version from the loaded library as a static, NUL-terminated string owned by the library; callers must not free it.The checked-in header keeps
0.0.0-devso direct C17 use still works without a generated file. CMake and the package builder render the same version block from the existing tag/override/dev resolution. Direct Cargo builds resolve the publicLANCEDB_VERSIONoverride or exact peeled tags at HEAD inbuild.rs, with a dev fallback for source trees without Git.Reviewed follow-up fixes included:
reftable/tables.listin both the per-worktree and common Git directories.build.rswatches the same path for direct Cargo builds.<build>/generated/include; in-source configure no longer overwritesinclude/lancedb.h, and consumer, Doxygen and install paths use the dedicated directory.NUL,-or+boundary. It keeps exact header/runtime equality and numeric macro consistency withoutsscanf, CRT suppression or toolchain-specific code.Validation on
08a0c700ae118988a719f85f0530777c8b9e7599(tree4a0f23bcb0f3af77c549b59eb81d950e5a712dc3):python3 .github/scripts/test_package.py: 28 tests passed.python3 .github/scripts/test_release.py: 32 tests passed.build/generated/include/lancedb.hand the source template stayed at0.0.0-dev.lancedb_source_header_c17builds through CMake.check-abi: host LP64 and MSVC LLP64 both matched 147 extern functions, 25 structs and 5 enums.0.2.0-preview.1to0.0.0-devwithout a manual reconfigure. Linked-worktree reftable refs passed the same test.build.rsstayed at0.2.0-preview.1after the branch moved off tag; the newbuild.rsproduced0.0.0-dev.0.0.0-devbranch left the generated header mtime unchanged under both Ninja and Make.0.7.0, then0.7.1) left the checked-in template at0.0.0-dev.0.0.0-devand0.2.0-preview.1+build.5on prepared headd2173bf; the current merge only appends build: remove code coverage support #121's coverage removal and these build-system fixes.sscanfunder MSVC/W4 /WX; that call is gone. The Windows job on484bb82covers the unchanged C17 consumer, but this new head still needs its newly triggered native checks. No coverage check is expected after build: remove code coverage support #121.Refs #99.