Restore .merlin-exists trick

This is needed so that command don't depend on the contents of the .merlin
This commit is contained in:
Jeremie Dimino 2018-01-19 22:54:05 +00:00
parent 8b11b494d2
commit b401284b84
2 changed files with 13 additions and 1 deletions

View File

@ -31,6 +31,18 @@ let dot_merlin sctx ~dir ({ requires; flags; _ } as t) =
match Path.drop_build_context dir with
| Some remaindir ->
let merlin_file = Path.relative dir ".merlin" in
(* We make the compilation of .ml/.mli files depend on the
existence of .merlin so that they are always generated, however
the command themselves don't read the merlin file, so we don't
want to declare a dependency on the contents of the .merlin
file.
Currently jbuilder doesn't support declaring a dependency only
on the existence of a file, so we have to use this trick. *)
SC.add_rule sctx
(Build.path merlin_file
>>>
Build.create_file (Path.relative dir ".merlin-exists"));
SC.add_rule sctx ~mode:Promote_but_delete_on_clean (
requires &&& flags
>>^ (fun (libs, flags) ->

View File

@ -322,7 +322,7 @@ module Libs = struct
in
let requires =
if t.context.merlin && has_dot_merlin then
Build.path (Path.relative dir ".merlin")
Build.path (Path.relative dir ".merlin-exists")
>>>
real_requires
else