Skip to content

Commit a26eade

Browse files
authored
loads packages before plugins to prevent failures in dune loader (#1573)
If bundled plugins are loaded before dune packaged plugins, the latter will fail on modules that were linked by the former. The old bap plugin system has now way to notify the dune plugin system on what units are loaded (no worries the dynlink system used by both will prevent double-loading). Instead of catching the Unit_already_loaded exception from dune, we better first load all dune packages and only after that handle the old bundled plugins with our old loader, which is capabled of handling correctly this exception.
1 parent da48522 commit a26eade

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/bap_main/bap_main_log.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ let log_plugin_events () =
107107
| `Linking lib ->
108108
message Debug ~section "Linking library %s" lib)
109109

110-
111-
112-
113110
let process_events ppf =
114111
Stream.observe Event.stream (function
115112
| Event.Log.Message message -> print_message ppf message

lib/bap_plugins/bap_plugins.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ module Plugins = struct
359359

360360

361361
let list ?env ?provides ?library () =
362-
list_bundles ?env ?provides ?library () @
363-
list_packages ()
362+
list_packages () @
363+
list_bundles ?env ?provides ?library ()
364364

365365
let collect ?env ?provides ?library () =
366-
collect_bundles ?env ?provides ?library () @
367-
List.map ~f:Result.return @@
368-
list_packages ()
366+
let packs = list_packages () |> List.map ~f:Result.return in
367+
let bunds = collect_bundles ?env ?provides ?library () in
368+
packs @ bunds
369369

370370
let loaded,finished = Future.create ()
371371

0 commit comments

Comments
 (0)