Skip to content

Commit 14afdf6

Browse files
authored
fix bug when the same artifact was used more than once in the project (#626)
1 parent 9648afb commit 14afdf6

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/PackageCompiler.jl

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,23 +1081,33 @@ function bundle_artifacts(ctx, dest_dir; include_lazy_artifacts::Bool)
10811081
total_size = 0
10821082
sort!(bundled_artifacts)
10831083

1084+
bundled_shas = Set{String}()
10841085
for (i, (pkg, artifacts)) in enumerate(bundled_artifacts)
10851086
last_pkg = i == length(bundled_artifacts)
10861087
mark_pkg = last_pkg ? "└──" : "├──"
10871088
print(" $mark_pkg $pkg")
1089+
# jlls often only have a single artifact with the same name as the package itself
1090+
std_jll = endswith(pkg, "_jll") && length(artifacts) == 1
1091+
if !std_jll
1092+
println()
1093+
end
10881094
for (j, (artifact, artifact_path)) in enumerate(artifacts)
1089-
size = recursive_dir_size(artifact_path)
1095+
git_tree_sha_artifact = basename(artifact_path)
1096+
already_bundled = git_tree_sha_artifact in bundled_shas
1097+
size = already_bundled ? 0 : recursive_dir_size(artifact_path)
10901098
total_size += size
1091-
# jlls only have a single artifact with the same name as the package itself
1092-
if endswith(pkg, "_jll") && length(artifacts) == 1
1093-
println(" - ", pretty_byte_str(size), "")
1099+
size_str = already_bundled ? "[already bundled]" : pretty_byte_str(size)
1100+
if std_jll
1101+
println(" - ", size_str, "")
10941102
else
1095-
println("")
10961103
mark_artifact = j == length(artifacts) ? "└──" : "├──"
10971104
mark_init = last_pkg ? " " : ""
1098-
println(" $mark_init ", mark_artifact, " ", artifact, " - ", pretty_byte_str(size), "")
1105+
println(" $mark_init ", mark_artifact, " ", artifact, " - ", size_str, "")
1106+
end
1107+
if !already_bundled
1108+
cp(artifact_path, joinpath(artifact_app_path, git_tree_sha_artifact))
1109+
push!(bundled_shas, git_tree_sha_artifact)
10991110
end
1100-
cp(artifact_path, joinpath(artifact_app_path, basename(artifact_path)))
11011111
end
11021112
end
11031113
if total_size > 0

0 commit comments

Comments
 (0)