Make Merlin.t abstract
This commit is contained in:
parent
39ac04a535
commit
1b279f30bf
|
@ -721,14 +721,12 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
; compile_info
|
; compile_info
|
||||||
};
|
};
|
||||||
|
|
||||||
{ Merlin.
|
Merlin.make ()
|
||||||
requires = real_requires
|
~requires:real_requires
|
||||||
; flags
|
~flags
|
||||||
; preprocess = Buildable.single_preprocess lib.buildable
|
~preprocess:(Buildable.single_preprocess lib.buildable)
|
||||||
; libname = Some lib.name
|
~libname:lib.name
|
||||||
; source_dirs = Path.Set.empty
|
~objs_dirs:(Path.Set.singleton obj_dir)
|
||||||
; objs_dirs = Path.Set.singleton obj_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
(* +-----------------------------------------------------------------+
|
(* +-----------------------------------------------------------------+
|
||||||
| Executables stuff |
|
| Executables stuff |
|
||||||
|
@ -819,14 +817,11 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
~link_flags
|
~link_flags
|
||||||
~js_of_ocaml:exes.buildable.js_of_ocaml;
|
~js_of_ocaml:exes.buildable.js_of_ocaml;
|
||||||
|
|
||||||
{ Merlin.
|
Merlin.make ()
|
||||||
requires = real_requires
|
~requires:real_requires
|
||||||
; flags = Ocaml_flags.common flags
|
~flags:(Ocaml_flags.common flags)
|
||||||
; preprocess = Buildable.single_preprocess exes.buildable
|
~preprocess:(Buildable.single_preprocess exes.buildable)
|
||||||
; libname = None
|
~objs_dirs:(Path.Set.singleton obj_dir)
|
||||||
; source_dirs = Path.Set.empty
|
|
||||||
; objs_dirs = Path.Set.singleton obj_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
(* +-----------------------------------------------------------------+
|
(* +-----------------------------------------------------------------+
|
||||||
| Aliases |
|
| Aliases |
|
||||||
|
@ -892,19 +887,11 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
Path.parent (Path.relative src_dir src_glob ~error_loc:loc)
|
Path.parent (Path.relative src_dir src_glob ~error_loc:loc)
|
||||||
in
|
in
|
||||||
Some
|
Some
|
||||||
{ Merlin.requires = Build.return []
|
(Merlin.make ()
|
||||||
; flags = Build.return []
|
~source_dirs:(Path.Set.singleton src_dir))
|
||||||
; preprocess = Jbuild.Preprocess.No_preprocessing
|
|
||||||
; libname = None
|
|
||||||
; source_dirs = Path.Set.singleton src_dir
|
|
||||||
; objs_dirs = Path.Set.empty
|
|
||||||
}
|
|
||||||
| _ -> None)
|
| _ -> None)
|
||||||
|> Merlin.merge_all
|
|> Merlin.merge_all
|
||||||
|> Option.map ~f:(fun (m : Merlin.t) ->
|
|> Option.map ~f:(fun m -> Merlin.add_source_dir m src_dir)
|
||||||
{ m with source_dirs =
|
|
||||||
Path.Set.add m.source_dirs (Path.relative src_dir ".")
|
|
||||||
})
|
|
||||||
|> Option.iter ~f:(Merlin.add_rules sctx ~dir:ctx_dir ~scope);
|
|> Option.iter ~f:(Merlin.add_rules sctx ~dir:ctx_dir ~scope);
|
||||||
Utop.setup sctx ~dir:ctx_dir ~libs:(
|
Utop.setup sctx ~dir:ctx_dir ~libs:(
|
||||||
List.filter_map stanzas ~f:(function
|
List.filter_map stanzas ~f:(function
|
||||||
|
|
|
@ -13,6 +13,25 @@ type t =
|
||||||
; objs_dirs : Path.Set.t
|
; objs_dirs : Path.Set.t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let make
|
||||||
|
?(requires=Build.return [])
|
||||||
|
?(flags=Build.return [])
|
||||||
|
?(preprocess=Jbuild.Preprocess.No_preprocessing)
|
||||||
|
?libname
|
||||||
|
?(source_dirs=Path.Set.empty)
|
||||||
|
?(objs_dirs=Path.Set.empty)
|
||||||
|
() =
|
||||||
|
{ requires
|
||||||
|
; flags
|
||||||
|
; preprocess
|
||||||
|
; libname
|
||||||
|
; source_dirs
|
||||||
|
; objs_dirs
|
||||||
|
}
|
||||||
|
|
||||||
|
let add_source_dir t dir =
|
||||||
|
{ t with source_dirs = Path.Set.add t.source_dirs dir }
|
||||||
|
|
||||||
let ppx_flags sctx ~dir:_ ~scope ~src_dir:_ { preprocess; libname; _ } =
|
let ppx_flags sctx ~dir:_ ~scope ~src_dir:_ { preprocess; libname; _ } =
|
||||||
match preprocess with
|
match preprocess with
|
||||||
| Pps { pps; flags } ->
|
| Pps { pps; flags } ->
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
(** Merlin rules *)
|
(** Merlin rules *)
|
||||||
|
|
||||||
type t =
|
type t
|
||||||
{ requires : (unit, Lib.t list) Build.t
|
|
||||||
; flags : (unit, string list) Build.t
|
val make
|
||||||
; preprocess : Jbuild.Preprocess.t
|
: ?requires:(unit, Lib.t list) Build.t
|
||||||
; libname : string option
|
-> ?flags:(unit, string list) Build.t
|
||||||
; source_dirs: Path.Set.t
|
-> ?preprocess:Jbuild.Preprocess.t
|
||||||
; objs_dirs : Path.Set.t
|
-> ?libname:string
|
||||||
}
|
-> ?source_dirs: Path.Set.t
|
||||||
|
-> ?objs_dirs:Path.Set.t
|
||||||
|
-> unit
|
||||||
|
-> t
|
||||||
|
|
||||||
|
val add_source_dir : t -> Path.t -> t
|
||||||
|
|
||||||
val merge_all : t list -> t option
|
val merge_all : t list -> t option
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue