Skip to content

Commit

Permalink
Use Toploop.add_directive (ocaml#4834)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolás Ojeda Bär <n.oje.bar@gmail.com>
  • Loading branch information
nojb authored Sep 21, 2021
1 parent 72ebf28 commit 3f08057
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ Unreleased
new `(subst <disable|enable>)` stanza to the `dune-project` file.
(#4864, @kit-ty-kate)

- No longer reference deprecated Toploop functions when using dune files in
OCaml syntax. (#4834, fixes #4830, @nojb)

2.9.1 (07/09/2021)
------------------

Expand Down
15 changes: 9 additions & 6 deletions plugin/jbuild_plugin.ml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
let () =
Hashtbl.add Toploop.directive_table "require"
(Toploop.Directive_string ignore);
Hashtbl.add Toploop.directive_table "use"
(Toploop.Directive_string
let open Toploop in
let add_directive name desc =
add_directive name desc { section = ""; doc = "" }
in
add_directive "require" (Directive_string ignore);
add_directive "use"
(Directive_string
(fun _ ->
failwith "#use is not allowed inside a dune file in OCaml syntax"));
Hashtbl.add Toploop.directive_table "use_mod"
(Toploop.Directive_string
add_directive "use_mod"
(Directive_string
(fun _ ->
failwith "#use is not allowed inside a dune file in OCaml syntax"))

Expand Down
17 changes: 10 additions & 7 deletions src/dune_rules/assets.ml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
let jbuild_plugin_ml = {jbp|
let () =
Hashtbl.add Toploop.directive_table "require"
(Toploop.Directive_string ignore);
Hashtbl.add Toploop.directive_table "use"
(Toploop.Directive_string
let open Toploop in
let add_directive name desc =
add_directive name desc { section = ""; doc = "" }
in
add_directive "require" (Directive_string ignore);
add_directive "use"
(Directive_string
(fun _ ->
failwith "#use is not allowed inside a dune file in OCaml syntax"));
Hashtbl.add Toploop.directive_table "use_mod"
(Toploop.Directive_string
add_directive "use_mod"
(Directive_string
(fun _ ->
failwith "#use is not allowed inside a dune file in OCaml syntax"))

Expand Down Expand Up @@ -73,4 +76,4 @@ module V1 : sig
(** Execute a command and read its output *)
val run_and_read_lines : string -> string list
end
|jbp}
|jbp}

0 comments on commit 3f08057

Please sign in to comment.