Fix merlin generation in presence of include_subdirs (#1083)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
be84bcffbb
commit
5aa9a07f1a
|
@ -671,7 +671,11 @@ module Gen(P : Install_rules.Params) = struct
|
|||
loop stanzas [] []
|
||||
in
|
||||
Option.iter (Merlin.merge_all merlins) ~f:(fun m ->
|
||||
Merlin.add_rules sctx ~dir:ctx_dir ~scope ~dir_kind:kind
|
||||
let more_src_dirs =
|
||||
List.map (Dir_contents.dirs dir_contents) ~f:(fun dc ->
|
||||
Path.drop_optional_build_context (Dir_contents.dir dc))
|
||||
in
|
||||
Merlin.add_rules sctx ~dir:ctx_dir ~more_src_dirs ~scope ~dir_kind:kind
|
||||
(Merlin.add_source_dir m src_dir));
|
||||
Utop.setup sctx ~dir:ctx_dir ~scope ~libs:(
|
||||
List.filter_map stanzas ~f:(function
|
||||
|
|
|
@ -109,7 +109,8 @@ let ppx_flags sctx ~dir:_ ~scope ~dir_kind { preprocess; libname; _ } =
|
|||
end
|
||||
| Other -> []
|
||||
|
||||
let dot_merlin sctx ~dir ~scope ~dir_kind ({ requires; flags; _ } as t) =
|
||||
let dot_merlin sctx ~dir ~more_src_dirs ~scope ~dir_kind
|
||||
({ requires; flags; _ } as t) =
|
||||
match Path.drop_build_context dir with
|
||||
| None -> ()
|
||||
| Some remaindir ->
|
||||
|
@ -137,6 +138,9 @@ let dot_merlin sctx ~dir ~scope ~dir_kind ({ requires; flags; _ } as t) =
|
|||
|> Path.drop_optional_build_context)
|
||||
, Path.Set.add obj_dirs (Lib.obj_dir lib)))
|
||||
in
|
||||
let src_dirs =
|
||||
Path.Set.union src_dirs (Path.Set.of_list more_src_dirs)
|
||||
in
|
||||
Dot_file.to_string
|
||||
~remaindir
|
||||
~ppx:(ppx_flags sctx ~dir ~scope ~dir_kind t)
|
||||
|
@ -162,6 +166,6 @@ let merge_all = function
|
|||
| [] -> None
|
||||
| init::ts -> Some (List.fold_left ~init ~f:merge_two ts)
|
||||
|
||||
let add_rules sctx ~dir ~scope ~dir_kind merlin =
|
||||
let add_rules sctx ~dir ~more_src_dirs ~scope ~dir_kind merlin =
|
||||
if (SC.context sctx).merlin then
|
||||
dot_merlin sctx ~dir ~scope ~dir_kind merlin
|
||||
dot_merlin sctx ~dir ~more_src_dirs ~scope ~dir_kind merlin
|
||||
|
|
|
@ -22,6 +22,7 @@ val merge_all : t list -> t option
|
|||
val add_rules
|
||||
: Super_context.t
|
||||
-> dir:Path.t
|
||||
-> more_src_dirs:Path.t list
|
||||
-> scope:Scope.t
|
||||
-> dir_kind:File_tree.Dune_file.Kind.t
|
||||
-> t
|
||||
|
|
|
@ -1 +1 @@
|
|||
(lang dune 1.0)
|
||||
(lang dune 1.1)
|
||||
|
|
|
@ -6,5 +6,7 @@
|
|||
|
||||
(library
|
||||
(name bar)
|
||||
(modules ())
|
||||
(modules file)
|
||||
(preprocess (pps fooppx)))
|
||||
|
||||
(include_subdirs unqualified)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
let x = 42
|
|
@ -26,6 +26,7 @@
|
|||
S $LIB_PREFIX/lib/findlib
|
||||
S $LIB_PREFIX/lib/ocaml
|
||||
S .
|
||||
S subdir
|
||||
FLG -ppx '$PPX/fooppx@./ppx.exe --as-ppx --cookie '\''library-name="foo"'\'''
|
||||
FLG -open Foo -w -40 -open Bar -w -40
|
||||
|
||||
|
|
Loading…
Reference in New Issue