Skip to content

Commit

Permalink
Replace Sys.ocaml_release with Sys.ocaml_version to avoid opam instal…
Browse files Browse the repository at this point in the history
…lation failure on 4.12
  • Loading branch information
jmid committed Jan 6, 2025
1 parent 497ea77 commit d89d51a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dynarray/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
(* We generate an appropriate dune stanza to avoid Dynarray tests build failures
on 5.0 and 5.1 with the opam-less CI GitHub action setup *)

let at_least_52 = Sys.(ocaml_release.major,ocaml_release.minor) >= (5,2)
(* Use ocaml_version instead of ocaml_release (from 4.14) to support 4.12 opam install *)
let ocaml_version_pair =
let (major,minor) = match String.split_on_char '.' Sys.ocaml_version with
| major::minor::_ -> (major,minor)
| _ -> failwith "Unable to extract OCaml version" in
try (int_of_string major, int_of_string minor)
with Failure _ -> failwith "Failed to parse OCaml version"

let dune =
if at_least_52
if ocaml_version_pair >= (5,2)
then Printf.sprintf {|
(test
(name lin_tests)
Expand Down

0 comments on commit d89d51a

Please sign in to comment.