Move stanzas_per_dir to super_context.ml
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
b6108d7091
commit
e7e28b2044
|
@ -17,11 +17,6 @@ module Gen(P : Install_rules.Params) = struct
|
|||
let sctx = P.sctx
|
||||
let ctx = SC.context sctx
|
||||
|
||||
let stanzas_per_dir =
|
||||
List.map (SC.stanzas sctx) ~f:(fun stanzas ->
|
||||
(stanzas.SC.Dir_with_jbuild.ctx_dir, stanzas))
|
||||
|> Path.Map.of_list_exn
|
||||
|
||||
(* +-----------------------------------------------------------------+
|
||||
| Interpretation of [modules] fields |
|
||||
+-----------------------------------------------------------------+ *)
|
||||
|
@ -195,7 +190,7 @@ module Gen(P : Install_rules.Params) = struct
|
|||
|
||||
(* As a side-effect, setup user rules and copy_files rules. *)
|
||||
let load_text_files ~dir =
|
||||
match Path.Map.find stanzas_per_dir dir with
|
||||
match SC.stanzas_in sctx ~dir with
|
||||
| None -> String.Set.empty
|
||||
| Some { stanzas; src_dir; scope; _ } ->
|
||||
(* Interpret a few stanzas in order to determine the list of
|
||||
|
@ -1006,7 +1001,7 @@ module Gen(P : Install_rules.Params) = struct
|
|||
| "_doc" :: rest -> Odoc.gen_rules rest ~dir
|
||||
| ".ppx" :: rest -> Preprocessing.gen_rules sctx rest
|
||||
| _ ->
|
||||
match Path.Map.find stanzas_per_dir dir with
|
||||
match SC.stanzas_in sctx ~dir with
|
||||
| Some x -> gen_rules x
|
||||
| None ->
|
||||
if components <> [] &&
|
||||
|
|
|
@ -40,6 +40,7 @@ type t =
|
|||
; public_libs : Lib.DB.t
|
||||
; installed_libs : Lib.DB.t
|
||||
; stanzas : Dir_with_jbuild.t list
|
||||
; stanzas_per_dir : Dir_with_jbuild.t Path.Map.t
|
||||
; packages : Package.t Package.Name.Map.t
|
||||
; file_tree : File_tree.t
|
||||
; artifacts : Artifacts.t
|
||||
|
@ -55,6 +56,7 @@ type t =
|
|||
|
||||
let context t = t.context
|
||||
let stanzas t = t.stanzas
|
||||
let stanzas_in t ~dir = Path.Map.find t.stanzas_per_dir dir
|
||||
let packages t = t.packages
|
||||
let libs_by_package t = t.libs_by_package
|
||||
let artifacts t = t.artifacts
|
||||
|
@ -248,6 +250,11 @@ let create
|
|||
; kind
|
||||
})
|
||||
in
|
||||
let stanzas_per_dir =
|
||||
List.map stanzas ~f:(fun stanzas ->
|
||||
(stanzas.Dir_with_jbuild.ctx_dir, stanzas))
|
||||
|> Path.Map.of_list_exn
|
||||
in
|
||||
let stanzas_to_consider_for_install =
|
||||
if not external_lib_deps_mode then
|
||||
List.concat_map stanzas ~f:(fun { ctx_dir; stanzas; scope; kind; _ } ->
|
||||
|
@ -305,6 +312,7 @@ let create
|
|||
; public_libs
|
||||
; installed_libs
|
||||
; stanzas
|
||||
; stanzas_per_dir
|
||||
; packages
|
||||
; file_tree
|
||||
; stanzas_to_consider_for_install
|
||||
|
|
|
@ -43,6 +43,7 @@ val create
|
|||
|
||||
val context : t -> Context.t
|
||||
val stanzas : t -> Dir_with_jbuild.t list
|
||||
val stanzas_in : t -> dir:Path.t -> Dir_with_jbuild.t option
|
||||
val packages : t -> Package.t Package.Name.Map.t
|
||||
val libs_by_package : t -> (Package.t * Lib.Set.t) Package.Name.Map.t
|
||||
val file_tree : t -> File_tree.t
|
||||
|
|
Loading…
Reference in New Issue