Skip to content

Commit

Permalink
Add eager_mode() definition and call in __init__()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
staticfloat committed Aug 30, 2024
1 parent c121344 commit 41d6411
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/wrapper_generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,31 @@ 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

return excat(
# 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...,
)
Expand Down

0 comments on commit 41d6411

Please sign in to comment.