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 [] []
|
loop stanzas [] []
|
||||||
in
|
in
|
||||||
Option.iter (Merlin.merge_all merlins) ~f:(fun m ->
|
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));
|
(Merlin.add_source_dir m src_dir));
|
||||||
Utop.setup sctx ~dir:ctx_dir ~scope ~libs:(
|
Utop.setup sctx ~dir:ctx_dir ~scope ~libs:(
|
||||||
List.filter_map stanzas ~f:(function
|
List.filter_map stanzas ~f:(function
|
||||||
|
|
|
@ -109,7 +109,8 @@ let ppx_flags sctx ~dir:_ ~scope ~dir_kind { preprocess; libname; _ } =
|
||||||
end
|
end
|
||||||
| Other -> []
|
| 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
|
match Path.drop_build_context dir with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
| Some remaindir ->
|
| Some remaindir ->
|
||||||
|
@ -137,6 +138,9 @@ let dot_merlin sctx ~dir ~scope ~dir_kind ({ requires; flags; _ } as t) =
|
||||||
|> Path.drop_optional_build_context)
|
|> Path.drop_optional_build_context)
|
||||||
, Path.Set.add obj_dirs (Lib.obj_dir lib)))
|
, Path.Set.add obj_dirs (Lib.obj_dir lib)))
|
||||||
in
|
in
|
||||||
|
let src_dirs =
|
||||||
|
Path.Set.union src_dirs (Path.Set.of_list more_src_dirs)
|
||||||
|
in
|
||||||
Dot_file.to_string
|
Dot_file.to_string
|
||||||
~remaindir
|
~remaindir
|
||||||
~ppx:(ppx_flags sctx ~dir ~scope ~dir_kind t)
|
~ppx:(ppx_flags sctx ~dir ~scope ~dir_kind t)
|
||||||
|
@ -162,6 +166,6 @@ let merge_all = function
|
||||||
| [] -> None
|
| [] -> None
|
||||||
| init::ts -> Some (List.fold_left ~init ~f:merge_two ts)
|
| 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
|
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
|
val add_rules
|
||||||
: Super_context.t
|
: Super_context.t
|
||||||
-> dir:Path.t
|
-> dir:Path.t
|
||||||
|
-> more_src_dirs:Path.t list
|
||||||
-> scope:Scope.t
|
-> scope:Scope.t
|
||||||
-> dir_kind:File_tree.Dune_file.Kind.t
|
-> dir_kind:File_tree.Dune_file.Kind.t
|
||||||
-> t
|
-> t
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
(lang dune 1.0)
|
(lang dune 1.1)
|
||||||
|
|
|
@ -6,5 +6,7 @@
|
||||||
|
|
||||||
(library
|
(library
|
||||||
(name bar)
|
(name bar)
|
||||||
(modules ())
|
(modules file)
|
||||||
(preprocess (pps fooppx)))
|
(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/findlib
|
||||||
S $LIB_PREFIX/lib/ocaml
|
S $LIB_PREFIX/lib/ocaml
|
||||||
S .
|
S .
|
||||||
|
S subdir
|
||||||
FLG -ppx '$PPX/fooppx@./ppx.exe --as-ppx --cookie '\''library-name="foo"'\'''
|
FLG -ppx '$PPX/fooppx@./ppx.exe --as-ppx --cookie '\''library-name="foo"'\'''
|
||||||
FLG -open Foo -w -40 -open Bar -w -40
|
FLG -open Foo -w -40 -open Bar -w -40
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue