Skip to content

Commit

Permalink
Merge pull request #70 from JuliaPackaging/gb/eager_mode12
Browse files Browse the repository at this point in the history
Fix type instabilities in the init_header
  • Loading branch information
topolarity authored Oct 11, 2024
2 parents b5f2a74 + 45cc049 commit 889f388
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/wrapper_generators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro generate_wrapper_header(src_name)
@static if isdir(joinpath(dirname($(pkg_dir)), "override"))
return joinpath(dirname($(pkg_dir)), "override")
elseif @isdefined(augment_platform!) && VERSION >= v"1.6"
$(Expr(:macrocall, Symbol("@artifact_str"), __source__, src_name, :(host_platform)))
$(Expr(:macrocall, Symbol("@artifact_str"), __source__, src_name, __module__.host_platform))
else
# We explicitly use `macrocall` here so that we can manually pass the `__source__`
# argument, to avoid `@artifact_str` trying to lookup `Artifacts.toml` here.
Expand All @@ -30,17 +30,22 @@ macro generate_init_header(dependencies...)
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()))
depmod = getfield(__module__, dep)
if isdefined(depmod, :PATH_list)
push!(deps_path_add, :(append!(PATH_list, $(dep).PATH_list)))
end
if isdefined(depmod, :LIBPATH_list)
push!(deps_path_add, :(append!(LIBPATH_list, $(dep).LIBPATH_list)))
end
if isdefined(depmod, :eager_mode)
push!(eager_mode, :($(dep).eager_mode()))
end
end
end

return excat(
# This either calls `@artifact_str()`, or returns a constant string if we're overridden.
:(global artifact_dir = find_artifact_dir()),
:(global artifact_dir = find_artifact_dir()::String),

# Add `eager_mode` invocations on all our dependencies
eager_mode...,
Expand Down

0 comments on commit 889f388

Please sign in to comment.