Skip to content

Commit

Permalink
refactor: make Artifacts.t abstract (#8739)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Sep 22, 2023
1 parent 60aeed1 commit 85a6b7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/dune_rules/artifacts.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ type t =
; bin : Bin.t
}

let bin t = t.bin
let public_libs t = t.public_libs

let create (context : Context.t) ~public_libs ~local_bins =
{ public_libs = Public_libs.create ~context ~public_libs
; bin = Bin.create ~context ~local_bins
Expand Down
7 changes: 3 additions & 4 deletions src/dune_rules/artifacts.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ module Public_libs : sig
}
end

type t = private
{ public_libs : Public_libs.t
; bin : Bin.t
}
type t

val bin : t -> Bin.t
val public_libs : t -> Public_libs.t
val create : Context.t -> public_libs:Lib.DB.t -> local_bins:Bin.Local.t Memo.Lazy.t -> t
10 changes: 5 additions & 5 deletions src/dune_rules/super_context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ let make_default_env_node
~expander_for_artifacts
~default_context_flags
~default_env:root_env
~default_bin_artifacts:artifacts.bin
~default_bin_artifacts:(Artifacts.bin artifacts)
~default_bin_annot:true
in
make
Expand Down Expand Up @@ -504,9 +504,9 @@ let create ~(context : Context.t) ~(host : t option) ~packages ~stanzas =
~scope_host
~context
~env:expander_env
~lib_artifacts:artifacts.public_libs
~bin_artifacts_host:artifacts_host.bin
~lib_artifacts_host:artifacts_host.public_libs
~lib_artifacts:(Artifacts.public_libs artifacts)
~bin_artifacts_host:(Artifacts.bin artifacts_host)
~lib_artifacts_host:(Artifacts.public_libs artifacts_host)
and+ root_env =
add_packages_env (Context.name context) ~base:expander_env stanzas packages
in
Expand All @@ -529,7 +529,7 @@ let create ~(context : Context.t) ~(host : t option) ~packages ~stanzas =
~default_env
~host_env_tree:host
~root_expander
~bin_artifacts:artifacts.bin
~bin_artifacts:(Artifacts.bin artifacts)
~context_env:root_env
;;

Expand Down

0 comments on commit 85a6b7e

Please sign in to comment.