From b528d1346dcd9e8cec4f537d98ead17f14a47dcf Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Mon, 25 Mar 2024 17:08:47 -0700 Subject: [PATCH] Add `eager_mode()` definition and call in `__init__()` New work on BB2 will create a `LazyJLLWrappers` that has a (slightly) different API, and is lazily-loaded. In order to be compatible with JLLs that still use `JLLWrappers`, we define an `eager_mode()` method that eagerly loads all libraries for use in a downstream JLL that still uses `JLLWrappers`. This PR adds no-op `eager_mode()` implementations for all old JLLs, and invokes `eager_mode()` on all dependencies to pave the way for this interopability. --- src/wrapper_generators.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wrapper_generators.jl b/src/wrapper_generators.jl index 4c2f831..d686a11 100644 --- a/src/wrapper_generators.jl +++ b/src/wrapper_generators.jl @@ -20,18 +20,21 @@ macro generate_wrapper_header(src_name) if ccall(:jl_generating_output, Cint, ()) == 1 Base.precompile(find_artifact_dir, ()) # to precompile this into Pkgimage end + eager_mode() = nothing end) end macro generate_init_header(dependencies...) deps_path_add = Expr[] + eager_mode = Expr[] if !isempty(dependencies) for dep in dependencies push!(deps_path_add, quote isdefined($(dep), :PATH_list) && append!(PATH_list, $(dep).PATH_list) isdefined($(dep), :LIBPATH_list) && append!(LIBPATH_list, $(dep).LIBPATH_list) end) + push!(eager_mode, :(isdefined($(dep), :eager_mode) && $(dep).eager_mode())) end end @@ -39,6 +42,9 @@ macro generate_init_header(dependencies...) # This either calls `@artifact_str()`, or returns a constant string if we're overridden. :(global artifact_dir = find_artifact_dir()), + # Add `eager_mode` invocations on all our dependencies + eager_mode..., + # Initialize PATH_list and LIBPATH_list deps_path_add..., )