feat(build-time-versioning): xce-build.sh computes real commit id/build time

The dev-loop build path (/xce-build, the one behind the motivating
incident) never set -Dcommit_id= at all, so every locally-built binary
carried an empty commit id. xce-build.sh now computes commit_id (git
rev-parse --short HEAD, -dirty suffixed on uncommitted changes, unknown
fallback on a genuine git failure) and build_time (UTC date), appends
both to MESON_OPTS for every profile before meson setup, and warns
loudly to stderr if either ever resolves empty anyway.

Task 2.1/13 of build-time-versioning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-20 08:45:53 +00:00
parent 1ff9e66cf4
commit bca639749d
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
2 changed files with 42 additions and 1 deletions

View file

@ -7,7 +7,7 @@
- _Requirements: 1.1, 1.2, 1.4, 4.3_
- [ ] 2. Foundation: compute real values at both build entry points
- [ ] 2.1 (P) xce-build.sh computes and passes commit id and build time
- [x] 2.1 (P) xce-build.sh computes and passes commit id and build time
- Compute `commit_id` via `git rev-parse --short HEAD`, appended with `-dirty` when the tree has uncommitted changes (`git status --porcelain` or `git diff --quiet HEAD --`)
- Compute `build_time` via `date -u +%Y-%m-%dT%H:%M:%SZ`
- Fall back to the literal string `unknown` for `commit_id` when `git` itself fails (e.g. no `.git` present)