Skip to content

Commit 09502ed

Browse files
committed
Remove sysimg creation workaround.
1 parent 57505ca commit 09502ed

File tree

1 file changed

+23
-58
lines changed

1 file changed

+23
-58
lines changed

src/PackageCompiler.jl

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,10 +1097,29 @@ function create_library(package_or_project::String,
10971097
compat_file = get_library_filename(lib_name; version, compat_level)
10981098
soname = (Sys.isunix() && !Sys.isapple()) ? compat_file : nothing
10991099

1100-
create_sysimage_workaround(ctx, sysimg_path, precompile_execution_file,
1101-
precompile_statements_file, incremental, filter_stdlibs, cpu_target;
1102-
sysimage_build_args, include_transitive_dependencies, julia_init_c_file,
1103-
julia_init_h_file, version, soname, script, base_sysimage)
1100+
if ctx.env.pkg === nothing
1101+
# If environment is not a package, create sysimage with all packages in project
1102+
packages = nothing
1103+
else
1104+
# Otherwise, only include package in sysimage
1105+
packages = [ctx.env.pkg.name]
1106+
end
1107+
1108+
create_sysimage(packages;
1109+
sysimage_path=sysimg_path,
1110+
project=dirname(ctx.env.project_file),
1111+
incremental,
1112+
script,
1113+
precompile_execution_file,
1114+
precompile_statements_file,
1115+
cpu_target,
1116+
base_sysimage,
1117+
julia_init_c_file,
1118+
julia_init_h_file,
1119+
version,
1120+
soname,
1121+
sysimage_build_args,
1122+
include_transitive_dependencies)
11041123

11051124
if version !== nothing && Sys.isunix()
11061125
cd(dirname(sysimg_path)) do
@@ -1146,60 +1165,6 @@ function get_library_filename(name::String;
11461165
return sysimg_file
11471166
end
11481167

1149-
# Use workaround at https://github.com/JuliaLang/julia/issues/34064#issuecomment-563950633
1150-
# by first creating a normal "empty" sysimage and then use that to finally create the one
1151-
# with the @ccallable function.
1152-
# This function can be removed when https://github.com/JuliaLang/julia/pull/37530 is merged
1153-
function create_sysimage_workaround(
1154-
ctx,
1155-
sysimage_path::String,
1156-
precompile_execution_file::Union{String, Vector{String}},
1157-
precompile_statements_file::Union{String, Vector{String}},
1158-
incremental::Bool,
1159-
filter_stdlibs::Bool,
1160-
cpu_target::String;
1161-
sysimage_build_args::Cmd,
1162-
include_transitive_dependencies::Bool,
1163-
julia_init_c_file::Union{Nothing,String,Vector{String}},
1164-
julia_init_h_file::Union{Nothing,String,Vector{String}},
1165-
version::Union{Nothing,VersionNumber},
1166-
soname::Union{Nothing,String},
1167-
script::Union{Nothing,String},
1168-
base_sysimage::Union{Nothing, String} = nothing
1169-
)
1170-
project = dirname(ctx.env.project_file)
1171-
1172-
if !incremental
1173-
tmp = mktempdir()
1174-
base_sysimage = joinpath(tmp, "tmp_sys." * Libdl.dlext)
1175-
create_sysimage(String[]; sysimage_path=base_sysimage, project,
1176-
incremental=false, filter_stdlibs, cpu_target)
1177-
end
1178-
1179-
if ctx.env.pkg === nothing
1180-
# If environment is not a package, create sysimage with all packages in project
1181-
packages = nothing
1182-
else
1183-
# Otherwise, only include package in sysimage
1184-
packages = [ctx.env.pkg.name]
1185-
end
1186-
1187-
create_sysimage(packages; sysimage_path, project,
1188-
incremental=true,
1189-
script=script,
1190-
precompile_execution_file,
1191-
precompile_statements_file,
1192-
cpu_target,
1193-
base_sysimage,
1194-
julia_init_c_file,
1195-
julia_init_h_file,
1196-
version,
1197-
soname,
1198-
sysimage_build_args,
1199-
include_transitive_dependencies)
1200-
1201-
return
1202-
end
12031168
############
12041169
# Bundling #
12051170
############

0 commit comments

Comments
 (0)