• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ocaml / dune / 29258

12 Dec 2024 01:50AM UTC coverage: 6.908%. Remained the same
29258

Pull #11049

github

web-flow
Merge 9249043be into 25be1eac5
Pull Request #11049: pkg: ocamlformat dev tool requires lockdir

0 of 1 new or added line in 1 file covered. (0.0%)

2951 of 42719 relevant lines covered (6.91%)

26666.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.43
/src/dune_pkg/dev_tool.ml
1
open! Import
2

3
type t =
4
  | Ocamlformat
5
  | Odoc
6
  | Ocamllsp
7

8
let all = [ Ocamlformat; Odoc; Ocamllsp ]
9

10
let equal a b =
11
  match a, b with
×
12
  | Ocamlformat, Ocamlformat -> true
×
13
  | Odoc, Odoc -> true
×
14
  | Ocamllsp, Ocamllsp -> true
×
15
  | _ -> false
×
16
;;
17

18
let package_name = function
19
  | Ocamlformat -> Package_name.of_string "ocamlformat"
76✔
20
  | Odoc -> Package_name.of_string "odoc"
×
21
  | Ocamllsp -> Package_name.of_string "ocaml-lsp-server"
76✔
22
;;
23

24
let of_package_name package_name =
25
  match Package_name.to_string package_name with
×
26
  | "ocamlformat" -> Ocamlformat
×
27
  | "odoc" -> Odoc
×
28
  | "ocaml-lsp-server" -> Ocamllsp
×
29
  | other -> User_error.raise [ Pp.textf "No such dev tool: %s" other ]
×
30
;;
31

32
let exe_name = function
33
  | Ocamlformat -> "ocamlformat"
76✔
34
  | Odoc -> "odoc"
×
35
  | Ocamllsp -> "ocamllsp"
76✔
36
;;
37

38
let exe_path_components_within_package t =
39
  match t with
76✔
40
  | Ocamlformat -> [ "bin"; exe_name t ]
38✔
41
  | Odoc -> [ "bin"; exe_name t ]
×
42
  | Ocamllsp -> [ "bin"; exe_name t ]
38✔
43
;;
44

45
let needs_to_build_with_same_compiler_as_project = function
NEW
46
  | Ocamlformat ->
×
47
    (* XXX Technically ocamlformat doesn't need to build with the same
48
       compiler as the project, however without a lockdir, `dune fmt` will
49
       attempt to run `ocamlc -compile` to get system info, and `ocamlc`
50
       might not be in PATH. Forcing the user to lock their project before
51
       running commands involving ocamlformat is a workaround for this
52
       problem until it can be solved in a better way. See this issue for
53
       more information: https://github.com/ocaml/dune/issues/11038 *)
54
    true
55
  | Odoc -> true
×
56
  | Ocamllsp -> true
×
57
;;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc