Skip to content

Commit

Permalink
refactor: move findlib predicates (ocaml#8634)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg authored Sep 12, 2023
1 parent 846db4a commit 6a828e8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/dune_findlib/package0.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ val ppx_runtime_deps : t -> Lib_name.t list
val kind : t -> Lib_kind.t
val archives : t -> Path.t list Mode.Dict.t
val plugins : t -> Path.t list Mode.Dict.t
val findlib_predicates_set_by_dune : Ocaml.Variant.Set.t

module Exists
(Monad : sig
Expand Down
2 changes: 0 additions & 2 deletions src/dune_rules/findlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ let hash { stdlib_dir; paths; builtins; ext_lib } =
, String.hash ext_lib )
;;

let findlib_predicates_set_by_dune = Ps.of_list [ P.ppx_driver; P.mt; P.mt_posix ]

let has_double_underscore s =
let len = String.length s in
len >= 2
Expand Down
2 changes: 0 additions & 2 deletions src/dune_rules/findlib.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ open Import
(** Findlib database *)
type t

val findlib_predicates_set_by_dune : Variant.Set.t

module Unavailable_reason : sig
type t =
| Not_found
Expand Down
6 changes: 4 additions & 2 deletions src/dune_rules/link_time_code_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ let findlib_predicates_set_by_dune pred =
match Sys.backend_type, pred with
| Sys.Native, "native" -> true
| Sys.Bytecode, "byte" -> true|ocaml};
Variant.Set.iter Findlib.findlib_predicates_set_by_dune ~f:(fun variant ->
Variant.Set.iter Dune_findlib.Package.findlib_predicates_set_by_dune ~f:(fun variant ->
pr buf " | _, %S -> true" (Variant.to_string variant));
pr buf " | _, _ -> false";
prlist buf "already_linked_libraries" (sorted_public_lib_names libs) ~f:(fun lib ->
Expand Down Expand Up @@ -253,7 +253,9 @@ let findlib_dynload cctx lib loc =
~name
~code:
(Action_builder.delayed (fun () ->
findlib_init_code ~preds:Findlib.findlib_predicates_set_by_dune ~libs:all_libs))
findlib_init_code
~preds:Dune_findlib.Package.findlib_predicates_set_by_dune
~libs:all_libs))
~requires
~precompiled_cmi:false
;;
Expand Down

0 comments on commit 6a828e8

Please sign in to comment.