Skip to content

Commit 76536c1

Browse files
authored
fix bug when the same artifact was used more than once in the project (#627)
1 parent 72d3c9c commit 76536c1

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/PackageCompiler.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ function create_sysimage(packages::Union{Symbol, Vector{String}, Vector{Symbol}}
551551

552552
@debug "instantiating project at $(repr(project))"
553553
Pkg.instantiate(ctx, verbose=true, allow_autoprecomp = false)
554-
554+
555555

556556
check_packages_in_project(ctx, packages)
557557

@@ -1031,7 +1031,7 @@ function _create_app(package_dir::String,
10311031
bundle_julia_libraries(dest_dir)
10321032
bundle_artifacts(ctx, dest_dir; include_lazy_artifacts=include_lazy_artifacts)
10331033
isapp && bundle_julia_executable(dest_dir)
1034-
# TODO: Should also bundle project and update load_path for library
1034+
# TODO: Should also bundle project and update load_path for library
10351035
isapp && bundle_project(ctx, dest_dir)
10361036

10371037
library_only && bundle_headers(dest_dir, header_files)
@@ -1174,7 +1174,8 @@ function bundle_artifacts(ctx, dest_dir; include_lazy_artifacts=true)
11741174
platform = Base.BinaryPlatforms.HostPlatform()
11751175
depot_path = joinpath(dest_dir, "share", "julia")
11761176
artifact_app_path = joinpath(depot_path, "artifacts")
1177-
1177+
1178+
bundled_shas = Set{String}()
11781179
for pkg in pkgs
11791180
pkg_source_path = source_path(ctx, pkg)
11801181
pkg_source_path === nothing && continue
@@ -1187,15 +1188,18 @@ function bundle_artifacts(ctx, dest_dir; include_lazy_artifacts=true)
11871188
for name in keys(artifacts)
11881189
@debug " \"$name\""
11891190
artifact_path = Pkg.ensure_artifact_installed(name, artifacts[name], artifacts_toml_path; platform)
1190-
mkpath(artifact_app_path)
1191-
cp(artifact_path, joinpath(artifact_app_path, basename(artifact_path)))
1191+
git_tree_sha_artifact = basename(artifact_path)
1192+
if !(git_tree_sha_artifact in bundled_shas)
1193+
mkpath(artifact_app_path)
1194+
cp(artifact_path, joinpath(artifact_app_path, git_tree_sha_artifact))
1195+
push!(bundled_shas, git_tree_sha_artifact)
1196+
end
11921197
end
11931198
break
11941199
end
11951200
end
11961201
end
11971202

1198-
11991203
return
12001204
end
12011205

0 commit comments

Comments
 (0)