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
|
module Named_artifacts = struct
|
||||||
open Named_artifacts
|
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 binary name = Build.arr (fun _ -> binary t name)
|
||||||
let in_findlib ~dir ~dep_kind name =
|
let in_findlib ~dir ~dep_kind name =
|
||||||
|
|
|
@ -2,12 +2,12 @@ open Import
|
||||||
open Jbuild_types
|
open Jbuild_types
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ context : Context.t
|
{ path : Path.t list
|
||||||
; findlib : Findlib.t
|
; findlib : Findlib.t
|
||||||
; artifacts : (string, Path.t) Hashtbl.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
|
let artifacts : (string, Path.t) Hashtbl.t = Hashtbl.create 1024 in
|
||||||
List.iter stanzas ~f:(fun (dir, stanzas) ->
|
List.iter stanzas ~f:(fun (dir, stanzas) ->
|
||||||
List.iter stanzas ~f:(fun stanza ->
|
List.iter stanzas ~f:(fun stanza ->
|
||||||
|
@ -15,13 +15,13 @@ let create context findlib stanzas =
|
||||||
| Provides { name; file } ->
|
| Provides { name; file } ->
|
||||||
Hashtbl.add artifacts ~key:name ~data:(Path.relative dir file)
|
Hashtbl.add artifacts ~key:name ~data:(Path.relative dir file)
|
||||||
| _ -> ()));
|
| _ -> ()));
|
||||||
{ context; findlib; artifacts }
|
{ path; findlib; artifacts }
|
||||||
|
|
||||||
let binary t name =
|
let binary t name =
|
||||||
match Hashtbl.find t.artifacts name with
|
match Hashtbl.find t.artifacts name with
|
||||||
| Some p -> p
|
| Some p -> p
|
||||||
| None ->
|
| None ->
|
||||||
match Context.which t.context name with
|
match Bin.which ~path:t.path name with
|
||||||
| Some p ->
|
| Some p ->
|
||||||
Hashtbl.add t.artifacts ~key:name ~data:p;
|
Hashtbl.add t.artifacts ~key:name ~data:p;
|
||||||
p
|
p
|
||||||
|
|
|
@ -7,7 +7,7 @@ open! Import
|
||||||
|
|
||||||
type t
|
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
|
(** In the three following functions, the string argument matches the first argument of
|
||||||
the [(provides ...)] stanza in the jbuild. *)
|
the [(provides ...)] stanza in the jbuild. *)
|
||||||
|
|
Loading…
Reference in New Issue