feat(dirty-content-fingerprint): add dirty_fingerprint meson option and C define

Adds a dirty_fingerprint string meson option (default '') alongside the
already-shipped build-time-versioning feature's commit_id/build_time
options, and threads it through add_project_arguments() as
VERSION_DIRTY_FINGERPRINT for every C component. Purely additive,
non-behavioral plumbing -- nothing consumes the new define yet.

Verified independently by review: a bare meson setup with zero -D
options configures cleanly, and all 542 C compile commands carry the new
(empty) define, matching the existing commit_id/build_time defines'
counts exactly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-21 03:54:37 +00:00
parent d3c583b339
commit a860141bb9
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 6 additions and 5 deletions

View file

@ -1,9 +1,8 @@
# Implementation Plan
- [ ] 1. Foundation: dirty_fingerprint meson option and C-wide define
- Add a `dirty_fingerprint` meson option (string, default `''`) alongside the existing `commit_id`/`build_time` options in `src/meson.options`
- Extend `src/meson.build`'s existing `add_project_arguments()` call to also define `VERSION_DIRTY_FINGERPRINT` for every C component, mirroring `VERSION_COMMIT_ID`/`VERSION_BUILD_TIME`
- Observable: a plain `meson setup` with the option unset still configures successfully (the define resolves to empty string, no build failure)
- [x] 1. Foundation: dirty_fingerprint meson option and C-wide define
- `dirty_fingerprint` meson option (string, default `''`) added in `src/meson.options`, byte-for-byte matching `commit_id`/`build_time`'s style/type/yield; `add_project_arguments()` extended with `-DVERSION_DIRTY_FINGERPRINT=`
- Observable confirmed live (independently re-verified by review, fresh scratch build): a bare `meson setup` with zero `-D` options configures cleanly (73 targets); all 542 C compile commands contain the new define (empty string), matching the existing two defines' counts exactly; no consumption code touched yet
- _Requirements: 1.1, 5.1_
- [ ] 2. Foundation: compute real fingerprint values at both build entry points

View file

@ -28,7 +28,8 @@ if get_option('buildtype') == 'debug'
endif
add_project_arguments(['-DVERSION_COMMIT_ID='+get_option('commit_id'),
'-DVERSION_BUILD_TIME='+get_option('build_time')], language: 'c')
'-DVERSION_BUILD_TIME='+get_option('build_time'),
'-DVERSION_DIRTY_FINGERPRINT='+get_option('dirty_fingerprint')], language: 'c')
# Programs needed by all components
go_compiler = find_program('go')

View file

@ -1,6 +1,7 @@
option('with_debug', type: 'boolean', value: false, yield: true)
option('commit_id', type: 'string', value:'', yield: true)
option('build_time', type: 'string', value:'', yield: true)
option('dirty_fingerprint', type: 'string', value:'', yield: true)
option('component', type: 'combo',
choices: ['all', 'xcecore', 'xcecli'],
value: 'all',