Remove dependency Named_artifacts --> Context
This commit is contained in:
parent
2ee522be52
commit
0462d4a11f
|
@ -243,7 +243,7 @@ module Gen(P : Params) = struct
|
|||
module Named_artifacts = struct
|
||||
open Named_artifacts
|
||||
|
||||
let t = create ctx findlib (List.map P.stanzas ~f:(fun d -> (d.ctx_dir, d.stanzas)))
|
||||
let t = create ~path:ctx.path findlib (List.map P.stanzas ~f:(fun d -> (d.ctx_dir, d.stanzas)))
|
||||
|
||||
let binary name = Build.arr (fun _ -> binary t name)
|
||||
let in_findlib ~dir ~dep_kind name =
|
||||
|
|
|
@ -2,12 +2,12 @@ open Import
|
|||
open Jbuild_types
|
||||
|
||||
type t =
|
||||
{ context : Context.t
|
||||
{ path : Path.t list
|
||||
; findlib : Findlib.t
|
||||
; artifacts : (string, Path.t) Hashtbl.t
|
||||
}
|
||||
|
||||
let create context findlib stanzas =
|
||||
let create ~path findlib stanzas =
|
||||
let artifacts : (string, Path.t) Hashtbl.t = Hashtbl.create 1024 in
|
||||
List.iter stanzas ~f:(fun (dir, stanzas) ->
|
||||
List.iter stanzas ~f:(fun stanza ->
|
||||
|
@ -15,13 +15,13 @@ let create context findlib stanzas =
|
|||
| Provides { name; file } ->
|
||||
Hashtbl.add artifacts ~key:name ~data:(Path.relative dir file)
|
||||
| _ -> ()));
|
||||
{ context; findlib; artifacts }
|
||||
{ path; findlib; artifacts }
|
||||
|
||||
let binary t name =
|
||||
match Hashtbl.find t.artifacts name with
|
||||
| Some p -> p
|
||||
| None ->
|
||||
match Context.which t.context name with
|
||||
match Bin.which ~path:t.path name with
|
||||
| Some p ->
|
||||
Hashtbl.add t.artifacts ~key:name ~data:p;
|
||||
p
|
||||
|
|
|
@ -7,7 +7,7 @@ open! Import
|
|||
|
||||
type t
|
||||
|
||||
val create : Context.t -> Findlib.t -> (Path.t * Jbuild_types.Stanza.t list) list -> t
|
||||
val create : path:Path.t list -> Findlib.t -> (Path.t * Jbuild_types.Stanza.t list) list -> t
|
||||
|
||||
(** In the three following functions, the string argument matches the first argument of
|
||||
the [(provides ...)] stanza in the jbuild. *)
|
||||
|
|
Loading…
Reference in New Issue