Skip to content

Commit 6e0c20f

Browse files
authored
only bundle stdlibs in sysimage when filter_stdlibs=false (#902)
The reason we still bundle some stdlibs is due to potential type piracy in stdlibs but that can only be a problem if the stdlibs are already in the sysimage.
1 parent 2076919 commit 6e0c20f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/PackageCompiler.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ sysimage_modules() = map(x->x.name, Base._sysimage_modules)
101101
stdlibs_in_sysimage() = intersect(_STDLIBS, sysimage_modules())
102102

103103
# TODO: Also check UUIDs for stdlibs, not only names<
104-
function gather_stdlibs_project(ctx; only_in_sysimage::Bool=true)
104+
function gather_stdlibs_project(ctx)
105105
@assert ctx.env.manifest !== nothing
106-
stdlibs = only_in_sysimage ? stdlibs_in_sysimage() : _STDLIBS
107106
stdlib_names = String[pkg.name for (_, pkg) in ctx.env.manifest]
108-
filter!(pkg -> pkg in stdlibs, stdlib_names)
107+
filter!(pkg -> pkg in _STDLIBS, stdlib_names)
109108
return stdlib_names
110109
end
111110

@@ -822,11 +821,14 @@ function create_app(package_dir::String,
822821
executables = [ctx.env.pkg.name => "julia_main"]
823822
end
824823
try_rm_dir(app_dir; force)
825-
bundle_artifacts(ctx, app_dir; include_lazy_artifacts)
826-
stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx; only_in_sysimage=false) : _STDLIBS
824+
stdlibs = gather_stdlibs_project(ctx)
825+
if !filter_stdlibs
826+
stdlibs = unique(vcat(stdlibs, stdlibs_in_sysimage()))
827+
end
827828
bundle_julia_libraries(app_dir, stdlibs)
828829
bundle_julia_libexec(ctx, app_dir)
829830
bundle_julia_executable(app_dir)
831+
bundle_artifacts(ctx, app_dir; include_lazy_artifacts)
830832
bundle_project(ctx, app_dir)
831833
include_preferences && bundle_preferences(ctx, app_dir)
832834
bundle_cert(app_dir)
@@ -1038,7 +1040,10 @@ function create_library(package_or_project::String,
10381040
end
10391041
try_rm_dir(dest_dir; force)
10401042
mkpath(dest_dir)
1041-
stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx; only_in_sysimage=false) : _STDLIBS
1043+
stdlibs = gather_stdlibs_project(ctx)
1044+
if !filter_stdlibs
1045+
stdlibs = unique(vcat(stdlibs, stdlibs_in_sysimage()))
1046+
end
10421047
bundle_julia_libraries(dest_dir, stdlibs)
10431048
bundle_julia_libexec(ctx, dest_dir)
10441049
bundle_artifacts(ctx, dest_dir; include_lazy_artifacts)

0 commit comments

Comments
 (0)