Deduplicate closure and closed_ppx_runtime_deps_of (#499)
This commit is contained in:
parent
b3838284c6
commit
c33269b914
|
@ -250,7 +250,7 @@ module Libs = struct
|
|||
| None -> build
|
||||
| Some f -> Build.fail f >>> build
|
||||
|
||||
let closure t ~scope ~dep_kind lib_deps =
|
||||
let closure' t ~findlib ~load_deps ~scope ~dep_kind lib_deps =
|
||||
let internals, externals, fail =
|
||||
Lib_db.Scope.interpret_lib_deps scope lib_deps in
|
||||
with_fail ~fail
|
||||
|
@ -258,35 +258,27 @@ module Libs = struct
|
|||
>>>
|
||||
Build.all
|
||||
(List.map internals ~f:(fun ((dir, lib) : Lib.Internal.t) ->
|
||||
load_requires t ~dir ~item:lib.name))
|
||||
load_deps t ~dir ~item:lib.name))
|
||||
>>^ (fun internal_deps ->
|
||||
let externals =
|
||||
Findlib.closure externals
|
||||
~required_by:scope.required_by
|
||||
findlib ~required_by:scope.required_by
|
||||
~local_public_libs:(local_public_libs t.libs)
|
||||
externals
|
||||
|> List.map ~f:(fun pkg -> Lib.External pkg)
|
||||
in
|
||||
Lib.remove_dups_preserve_order
|
||||
(List.concat (externals :: internal_deps) @
|
||||
List.map internals ~f:(fun x -> Lib.Internal x))))
|
||||
(internals, List.concat (externals :: internal_deps))))
|
||||
|
||||
let closure t ~scope ~dep_kind lib_deps =
|
||||
closure' t ~load_deps:load_requires ~findlib:Findlib.closure
|
||||
~scope ~dep_kind lib_deps >>^ fun (internals, deps) ->
|
||||
Lib.remove_dups_preserve_order
|
||||
(deps @ List.map internals ~f:(fun x -> Lib.Internal x))
|
||||
|
||||
let closed_ppx_runtime_deps_of t ~scope ~dep_kind lib_deps =
|
||||
let internals, externals, fail =
|
||||
Lib_db.Scope.interpret_lib_deps scope lib_deps in
|
||||
with_fail ~fail
|
||||
(Build.record_lib_deps ~kind:dep_kind lib_deps
|
||||
>>>
|
||||
Build.all
|
||||
(List.map internals ~f:(fun ((dir, lib) : Lib.Internal.t) ->
|
||||
load_runtime_deps t ~dir ~item:lib.name))
|
||||
>>^ (fun libs ->
|
||||
let externals =
|
||||
Findlib.closed_ppx_runtime_deps_of externals
|
||||
~required_by:scope.required_by
|
||||
~local_public_libs:(local_public_libs t.libs)
|
||||
|> List.map ~f:(fun pkg -> Lib.External pkg)
|
||||
in
|
||||
Lib.remove_dups_preserve_order (List.concat (externals :: libs))))
|
||||
closure' t ~load_deps:load_runtime_deps
|
||||
~findlib:Findlib.closed_ppx_runtime_deps_of
|
||||
~scope ~dep_kind lib_deps >>^ fun (_, deps) ->
|
||||
Lib.remove_dups_preserve_order deps
|
||||
|
||||
let add_select_rules t ~dir ~scope lib_deps =
|
||||
Lib_db.Scope.resolve_selects scope lib_deps
|
||||
|
|
Loading…
Reference in New Issue