Help users to not use non-future proof features in jbuild files

This commit is contained in:
Jeremie Dimino 2017-06-08 11:33:59 +01:00
parent c2f04a4963
commit eb7b5e2be4
2 changed files with 9 additions and 1 deletions

View File

@ -1001,3 +1001,5 @@ syntax is not enough. It is not clear whether the OCaml syntax will be
supported in the long term as it doesn't work well with incremental
builds. It is possible that it will be replaced by just an ``include``
stanza where one can include a generated file.
Consequently **you must not** build complex systems based on it.

View File

@ -55,7 +55,13 @@ module Jbuilds = struct
let plugin_contents = Io.read_file plugin in
Io.with_file_out (Path.to_string wrapper) ~f:(fun oc ->
Printf.fprintf oc {|
let () = Hashtbl.add Toploop.directive_table "require" (Toploop.Directive_string ignore)
let () =
Hashtbl.add Toploop.directive_table "require" (Toploop.Directive_string ignore);
Hashtbl.add Toploop.directive_table "use" (Toploop.Directive_string (fun _ ->
failwith "#use is not allowed inside jbuild in OCaml syntax"));
Hashtbl.add Toploop.directive_table "use_mod" (Toploop.Directive_string (fun _ ->
failwith "#use is not allowed inside jbuild in OCaml syntax"))
module Jbuild_plugin = struct
module V1 = struct
let context = %S