mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
add auto-generated Version module to main lib
This commit is contained in:
parent
b92159c11e
commit
ba264c7094
4 changed files with 19 additions and 0 deletions
|
|
@ -1,3 +1,10 @@
|
|||
(rule
|
||||
(target version.ml)
|
||||
(deps (universe) gen_version.sh)
|
||||
(action
|
||||
(with-stdout-to version.ml
|
||||
(run sh gen_version.sh))))
|
||||
|
||||
(library
|
||||
(name opentelemetry)
|
||||
(public_name opentelemetry)
|
||||
|
|
|
|||
6
src/lib/gen_version.sh
Normal file
6
src/lib/gen_version.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
v=$(git describe --exact-match HEAD 2>/dev/null | sed 's/^v//')
|
||||
[ -z "$v" ] && v=dev
|
||||
h=$(git rev-parse HEAD 2>/dev/null)
|
||||
[ -z "$h" ] && h=unknown
|
||||
printf 'let version = "%s"\nlet git_hash = "%s"\n' "$v" "$h"
|
||||
|
|
@ -100,6 +100,7 @@ type key_value = Key_value.t
|
|||
(** {2 Global settings} *)
|
||||
|
||||
module Globals = Globals
|
||||
module Version = Version
|
||||
|
||||
(** {2 Traces and Spans} *)
|
||||
|
||||
|
|
|
|||
5
src/lib/version.mli
Normal file
5
src/lib/version.mli
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
val version : string
|
||||
(** Version of the library, e.g. ["0.12"]. ["dev"] if not built from a release tag. *)
|
||||
|
||||
val git_hash : string
|
||||
(** Full git commit hash at build time, e.g. ["b92159c1..."]. ["unknown"] if git was unavailable. *)
|
||||
Loading…
Add table
Reference in a new issue