Compare commits

...

4 commits

Author SHA1 Message Date
Simon Cruanes
2c52df1fae
add pre-commit hook for formatting
Some checks are pending
format / format (push) Waiting to run
build / build (4.08.x, ubuntu-latest) (push) Waiting to run
build / build (4.13.x, ubuntu-latest) (push) Waiting to run
build / build (5.0.x, ubuntu-latest) (push) Waiting to run
build / build (5.3.x, ubuntu-latest) (push) Waiting to run
2026-03-12 21:38:51 -04:00
Simon Cruanes
ceb3fb75f8
format 2026-03-12 21:12:38 -04:00
Simon Cruanes
74055f523b
re_export 2026-03-12 20:54:45 -04:00
Simon Cruanes
858de42a2b
revert to just dune-build-info 2026-03-12 20:50:41 -04:00
11 changed files with 24 additions and 42 deletions

3
.gitignore vendored
View file

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

10
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: ocamlformat
name: ocamlformat check
entry: make format-check
language: system
files: \.(ml|mli)$
pass_filenames: false
stages: [pre-push]

View file

@ -29,6 +29,9 @@ format:
format-check: format-check:
@dune build $(DUNE_OPTS) @fmt --display=quiet @dune build $(DUNE_OPTS) @fmt --display=quiet
setup-githooks:
uvx pre-commit install --hook-type pre-push
WATCH ?= @all WATCH ?= @all
watch: watch:
@dune build $(WATCH) -w $(OPTS) @dune build $(WATCH) -w $(OPTS)

View file

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

View file

@ -26,6 +26,7 @@ depends: [
"ocaml-lsp-server" {with-dev-setup} "ocaml-lsp-server" {with-dev-setup}
"ocamlformat" {with-dev-setup & >= "0.27" & < "0.28"} "ocamlformat" {with-dev-setup & >= "0.27" & < "0.28"}
"mtime" {>= "1.4"} "mtime" {>= "1.4"}
"dune-build-info"
] ]
depopts: ["atomic" "trace" "thread-local-storage" "lwt" "eio" "picos"] depopts: ["atomic" "trace" "thread-local-storage" "lwt" "eio" "picos"]
conflicts: [ 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 (library
(name opentelemetry) (name opentelemetry)
(public_name opentelemetry) (public_name opentelemetry)
@ -44,6 +21,7 @@
(re_export opentelemetry.ambient-context) (re_export opentelemetry.ambient-context)
(re_export opentelemetry.atomic) (re_export opentelemetry.atomic)
(re_export hmap) (re_export hmap)
(re_export dune-build-info)
mtime mtime
mtime.clock.os mtime.clock.os
pbrt 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 let service_version = ref None
(** @since NEXT_RELEASE *) (** @since NEXT_RELEASE *)
let sdk_version : string = Version.(spf "%s at %s" version git_hash) let sdk_version : string = Version.version
let instrumentation_library = let instrumentation_library =
make_instrumentation_scope ~version:sdk_version ~name:"opentelemetry" () 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,3 @@
val version : string val version : string
(** Version of the library, e.g. ["0.12"]. ["dev"] if not built from a release (** 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. *)