Avoid generating useless .utop/.merlin files
This commit is contained in:
parent
dd3eaf2695
commit
b965c66af5
|
@ -268,6 +268,7 @@ module Gen(P : Params) = struct
|
|||
~libraries:lib.buildable.libraries
|
||||
~preprocess:lib.buildable.preprocess
|
||||
~virtual_deps:lib.virtual_deps
|
||||
~has_dot_merlin:lib.buildable.gen_dot_merlin
|
||||
in
|
||||
|
||||
SC.Libs.setup_runtime_deps sctx ~dir ~dep_kind ~item:lib.name
|
||||
|
@ -520,6 +521,7 @@ module Gen(P : Params) = struct
|
|||
~libraries:exes.buildable.libraries
|
||||
~preprocess:exes.buildable.preprocess
|
||||
~virtual_deps:[]
|
||||
~has_dot_merlin:exes.buildable.gen_dot_merlin
|
||||
in
|
||||
|
||||
SC.Libs.add_select_rules sctx ~dir exes.buildable.libraries;
|
||||
|
@ -794,7 +796,6 @@ Add it to your jbuild file to remove this warning.
|
|||
Option.iter (Utop.exe_stanzas stanzas) ~f:(fun (exe, all_modules) ->
|
||||
let dir = Utop.utop_exe_dir ~dir:ctx_dir in
|
||||
let merlin = executables_rules exe ~dir ~all_modules ~scope in
|
||||
Merlin.add_rules sctx ~dir merlin;
|
||||
Utop.add_module_rules sctx ~dir merlin.requires;
|
||||
)
|
||||
|
||||
|
|
|
@ -442,6 +442,7 @@ module Buildable = struct
|
|||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
||||
; js_of_ocaml : Js_of_ocaml.t
|
||||
; gen_dot_merlin : bool
|
||||
}
|
||||
|
||||
let v1 =
|
||||
|
@ -471,6 +472,7 @@ module Buildable = struct
|
|||
; ocamlc_flags
|
||||
; ocamlopt_flags
|
||||
; js_of_ocaml
|
||||
; gen_dot_merlin = true
|
||||
}
|
||||
|
||||
let single_preprocess t =
|
||||
|
|
|
@ -109,6 +109,9 @@ module Buildable : sig
|
|||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
||||
; js_of_ocaml : Js_of_ocaml.t
|
||||
; (** [true] except for on-demand utops, to avoid generation
|
||||
[.utop/.merlin] files everywhere. *)
|
||||
gen_dot_merlin : bool
|
||||
}
|
||||
|
||||
(** Preprocessing specification used by all modules or [No_preprocessing] *)
|
||||
|
|
|
@ -338,12 +338,13 @@ module Libs = struct
|
|||
Build.store_vfile vrequires);
|
||||
Build.vpath vrequires
|
||||
|
||||
let requires t ~dir ~dep_kind ~item ~libraries ~preprocess ~virtual_deps =
|
||||
let requires t ~dir ~dep_kind ~item ~libraries ~preprocess ~virtual_deps
|
||||
~has_dot_merlin =
|
||||
let real_requires =
|
||||
real_requires t ~dir ~dep_kind ~item ~libraries ~preprocess ~virtual_deps
|
||||
in
|
||||
let requires =
|
||||
if t.context.merlin then
|
||||
if t.context.merlin && has_dot_merlin then
|
||||
(* We don't depend on the dot_merlin directly, otherwise everytime it changes we
|
||||
would have to rebuild everything.
|
||||
|
||||
|
|
|
@ -82,9 +82,10 @@ module Libs : sig
|
|||
(** Add rules for (select ...) forms *)
|
||||
val add_select_rules : t -> dir:Path.t -> Lib_deps.t -> unit
|
||||
|
||||
(** Returns the closed list of dependencies for a dependency list in a stanza. The
|
||||
second arrow is the same as the first one but with an added dependency on the
|
||||
.merlin. *)
|
||||
(** Returns the closed list of dependencies for a dependency list in
|
||||
a stanza. The second arrow is the same as the first one but with
|
||||
an added dependency on the .merlin if [has_dot_merlin] is
|
||||
[true]. *)
|
||||
val requires
|
||||
: t
|
||||
-> dir:Path.t
|
||||
|
@ -93,6 +94,7 @@ module Libs : sig
|
|||
-> libraries:Lib_deps.t
|
||||
-> preprocess:Preprocess_map.t
|
||||
-> virtual_deps:string list
|
||||
-> has_dot_merlin:bool
|
||||
-> (unit, Lib.t list) Build.t * (unit, Lib.t list) Build.t
|
||||
|
||||
(** Setup the rules for ppx runtime dependencies *)
|
||||
|
|
|
@ -54,6 +54,7 @@ let utop_of_libs (libs : Library.t list) =
|
|||
; ocamlc_flags = Ordered_set_lang.Unexpanded.standard
|
||||
; ocamlopt_flags = Ordered_set_lang.Unexpanded.standard
|
||||
; js_of_ocaml = Js_of_ocaml.default
|
||||
; gen_dot_merlin = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue