try weirder tricks for version generation

This commit is contained in:
Simon Cruanes 2026-03-06 12:32:16 -05:00
parent d974213376
commit aa9e3f98ff
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
3 changed files with 19 additions and 1 deletions

3
.gitignore vendored
View file

@ -7,3 +7,6 @@ _opam
*.install
*.exe
*.tmp
src/lib/version.ml
src/lib/.git_index_path
src/lib/.git_index.lnk

View file

@ -1,6 +1,19 @@
(rule
(target .git_index_path)
(deps (universe) gen_git_index_path.sh)
(action
(with-stdout-to
.git_index_path
(run sh gen_git_index_path.sh))))
(rule
(target .git_index.lnk)
(action
(run ln -sf %{read-lines:.git_index_path} %{target})))
(rule
(target version.ml)
(deps (universe) gen_version.sh)
(deps (file .git_index.lnk) gen_version.sh)
(action
(with-stdout-to
version.ml

View file

@ -0,0 +1,2 @@
#!/bin/sh
git rev-parse --git-path index 2>/dev/null || echo /dev/null