revert to just dune-build-info

This commit is contained in:
Simon Cruanes 2026-03-12 20:49:35 -04:00
parent 54dc4d0ef7
commit 858de42a2b
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
9 changed files with 10 additions and 42 deletions

3
.gitignore vendored
View file

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

View file

@ -49,7 +49,8 @@
(>= 0.27)
(< 0.28)))
(mtime
(>= "1.4")))
(>= "1.4"))
dune-build-info)
(depopts atomic trace thread-local-storage lwt eio picos)
(conflicts
(trace

View file

@ -26,6 +26,7 @@ depends: [
"ocaml-lsp-server" {with-dev-setup}
"ocamlformat" {with-dev-setup & >= "0.27" & < "0.28"}
"mtime" {>= "1.4"}
"dune-build-info"
]
depopts: ["atomic" "trace" "thread-local-storage" "lwt" "eio" "picos"]
conflicts: [

View file

@ -1,26 +1,3 @@
(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
(file .git_index.lnk)
gen_version.sh)
(action
(with-stdout-to
version.ml
(run sh gen_version.sh))))
(library
(name opentelemetry)
(public_name opentelemetry)
@ -44,6 +21,7 @@
(re_export opentelemetry.ambient-context)
(re_export opentelemetry.atomic)
(re_export hmap)
dune-build-info
mtime
mtime.clock.os
pbrt

View file

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

View file

@ -1,6 +0,0 @@
#!/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"

View file

@ -21,7 +21,7 @@ let service_instance_id = ref None
let service_version = ref None
(** @since NEXT_RELEASE *)
let sdk_version : string = Version.(spf "%s at %s" version git_hash)
let sdk_version : string = Version.version
let instrumentation_library =
make_instrumentation_scope ~version:sdk_version ~name:"opentelemetry" ()

4
src/lib/version.ml Normal file
View file

@ -0,0 +1,4 @@
let version =
match Build_info.V1.version () with
| None -> "dev"
| Some v -> Build_info.V1.Version.to_string v

View file

@ -1,7 +1,2 @@
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. *)
(** Version of the library, e.g. ["0.12"]. ["dev"] if not built from a release. *)