Skip to content

Commit

Permalink
Generate version.mlts that support out-of-source builds
Browse files Browse the repository at this point in the history
Generated `version.mlt` files now supply `git` with the source path
`$DUNE_SOURCEROOT`.  The behavior is unchanged if the latter
environment variable is not defined.
  • Loading branch information
nberth committed Nov 7, 2023
1 parent 63a5770 commit eb0a186
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/drom_lib/genVersion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ let query cmd =
else None
with End_of_file -> None

let commit_hash = query "git show -s --pretty=format:%%H"
let commit_date = query "git show -s --pretty=format:%%ci"
let gitdir =
try Sys.getenv "DUNE_SOURCEROOT" with Not_found -> ""

let commit_hash =
query ("git -C \"^gitdir^\" show -s --pretty=format:%%H")
let commit_date =
query ("git -C \"^gitdir^\" show -s --pretty=format:%%ci")
let version = %S

let string_option = function
Expand Down

0 comments on commit eb0a186

Please sign in to comment.