Skip to content

Commit 20531de

Browse files
authored
pkg: enroll odig as a dev-tool (#12096)
* pkg: enroll odig as a dev-tool Signed-off-by: Sudha Parimala <[email protected]> * format fixes Signed-off-by: Sudha Parimala <[email protected]> * address review comment and fix failing test Signed-off-by: Sudha Parimala <[email protected]> --------- Signed-off-by: Sudha Parimala <[email protected]>
1 parent 23d7974 commit 20531de

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

bin/tools/tools.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ module Exec = struct
77
let group =
88
Cmd.group
99
info
10-
(List.map [ Ocamlformat; Ocamllsp; Ocamlearlybird ] ~f:Tools_common.exec_command)
10+
(List.map
11+
[ Ocamlformat; Ocamllsp; Ocamlearlybird; Odig ]
12+
~f:Tools_common.exec_command)
1113
;;
1214
end
1315

src/dune_pkg/dev_tool.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ type t =
66
| Ocamllsp
77
| Utop
88
| Ocamlearlybird
9+
| Odig
910

1011
let to_dyn = function
1112
| Ocamlformat -> Dyn.variant "Ocamlformat" []
1213
| Odoc -> Dyn.variant "Odoc" []
1314
| Ocamllsp -> Dyn.variant "Ocamllsp" []
1415
| Utop -> Dyn.variant "Utop" []
1516
| Ocamlearlybird -> Dyn.variant "Ocamlearlybird" []
17+
| Odig -> Dyn.variant "Odig" []
1618
;;
1719

18-
let all = [ Ocamlformat; Odoc; Ocamllsp; Utop; Ocamlearlybird ]
20+
let all = [ Ocamlformat; Odoc; Ocamllsp; Utop; Ocamlearlybird; Odig ]
1921

2022
let equal a b =
2123
match a, b with
@@ -28,6 +30,8 @@ let equal a b =
2830
| Utop, Utop -> true
2931
| Utop, _ | _, Utop -> false
3032
| Ocamlearlybird, Ocamlearlybird -> true
33+
| Ocamlearlybird, _ | _, Ocamlearlybird -> false
34+
| Odig, Odig -> true
3135
;;
3236

3337
let package_name = function
@@ -36,6 +40,7 @@ let package_name = function
3640
| Ocamllsp -> Package_name.of_string "ocaml-lsp-server"
3741
| Utop -> Package_name.of_string "utop"
3842
| Ocamlearlybird -> Package_name.of_string "earlybird"
43+
| Odig -> Package_name.of_string "odig"
3944
;;
4045

4146
let of_package_name package_name =
@@ -45,6 +50,7 @@ let of_package_name package_name =
4550
| "ocaml-lsp-server" -> Ocamllsp
4651
| "utop" -> Utop
4752
| "earlybird" -> Ocamlearlybird
53+
| "odig" -> Odig
4854
| other -> User_error.raise [ Pp.textf "No such dev tool: %s" other ]
4955
;;
5056

@@ -54,6 +60,7 @@ let exe_name = function
5460
| Ocamllsp -> "ocamllsp"
5561
| Utop -> "utop"
5662
| Ocamlearlybird -> "ocamlearlybird"
63+
| Odig -> "odig"
5764
;;
5865

5966
let exe_path_components_within_package t =
@@ -63,6 +70,7 @@ let exe_path_components_within_package t =
6370
| Ocamllsp -> [ "bin"; exe_name t ]
6471
| Utop -> [ "bin"; exe_name t ]
6572
| Ocamlearlybird -> [ "bin"; exe_name t ]
73+
| Odig -> [ "bin"; exe_name t ]
6674
;;
6775

6876
let needs_to_build_with_same_compiler_as_project = function
@@ -71,4 +79,5 @@ let needs_to_build_with_same_compiler_as_project = function
7179
| Ocamllsp -> true
7280
| Utop -> false
7381
| Ocamlearlybird -> false
82+
| Odig -> false
7483
;;

src/dune_pkg/dev_tool.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type t =
66
| Ocamllsp
77
| Utop
88
| Ocamlearlybird
9+
| Odig
910

1011
val to_dyn : t -> Dyn.t
1112
val all : t list

test/blackbox-tests/test-cases/pkg/dev-tools-help-message.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ Output the help text:
3636
ocamllsp executable (pass flags to ocamllsp after the '--'
3737
argument, such as 'dune tools exec ocamllsp -- --help').
3838

39+
odig [OPTION]… [ARGS]…
40+
Wrapper for running odig intended to be run automatically by a
41+
text editor. All positional arguments will be passed to the odig
42+
executable (pass flags to odig after the '--' argument, such as
43+
'dune tools exec odig -- --help').
44+
3945
COMMON OPTIONS
4046
--help[=FMT] (default=auto)
4147
Show this help in format FMT. The value FMT must be one of auto,

test/blackbox-tests/test-cases/pkg/ocamllsp/dev-tool-ocamllsp-env-path-var.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Confirm that each dev tool's bin directory is now in PATH:
2828
- ocaml.5.2.0
2929
- ocaml-lsp-server.0.0.1
3030
Running 'ocamllsp'
31+
$TESTCASE_ROOT/_build/_private/default/.dev-tool/odig/odig/target/bin
3132
$TESTCASE_ROOT/_build/_private/default/.dev-tool/earlybird/earlybird/target/bin
3233
$TESTCASE_ROOT/_build/_private/default/.dev-tool/utop/utop/target/bin
3334
$TESTCASE_ROOT/_build/_private/default/.dev-tool/ocaml-lsp-server/ocaml-lsp-server/target/bin

0 commit comments

Comments
 (0)