Skip to content

Commit

Permalink
skip manually mangled modules
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed Nov 23, 2020
1 parent a006048 commit f984c7c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/dune_rules/findlib/findlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ end = struct
(make_archives t "archive" (Ps.add preds Variant.plugin))
(make_archives t "plugin" preds)

let mangled_module_re =
lazy
(let open Re in
[ rep any; str "__"; rep any ] |> seq |> compile)

let exists t ~is_builtin =
let exists_if = Vars.get_words t.vars "exists_if" Ps.empty in
match exists_if with
Expand Down Expand Up @@ -387,12 +392,19 @@ end = struct
match Filename.check_suffix fname ext with
| false -> Ok None
| true -> (
match
let name = Filename.chop_extension fname in
Module_name.of_string_user_error (Loc.in_dir src_dir, name)
with
| Ok s -> Ok (Some s)
| Error e -> Error (User_error.E e) )) )
if
(* We add this hack to skip manually mangled libraries *)
Re.execp (Lazy.force mangled_module_re) fname
then
Ok None
else
match
let name = Filename.chop_extension fname in
Module_name.of_string_user_error
(Loc.in_dir src_dir, name)
with
| Ok s -> Ok (Some s)
| Error e -> Error (User_error.E e) )) )
in
Lib_info.create ~loc ~name:t.name ~kind ~status ~src_dir ~orig_src_dir
~obj_dir ~version ~synopsis ~main_module_name ~sub_systems ~requires
Expand Down

0 comments on commit f984c7c

Please sign in to comment.