Skip to content

Commit 7e20f80

Browse files
committed
ensure that artifacts are installed in e.g. instantiate for projects that are not packages (#3075)
fixes #2979 (cherry picked from commit 91ebd1f)
1 parent 50961a3 commit 7e20f80

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/Operations.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ function is_instantiated(env::EnvCache; platform = HostPlatform())::Bool
116116
if idx === nothing
117117
push!(pkgs, Types.PackageSpec(name=env.pkg.name, uuid=env.pkg.uuid, version=env.pkg.version, path=dirname(env.project_file)))
118118
end
119+
else
120+
# Make sure artifacts for project exist even if it is not a package
121+
check_artifacts_downloaded(dirname(env.project_file); platform) || return false
119122
end
120123
# Make sure all paths/artifacts exist
121124
return all(pkg -> is_package_downloaded(env.project_file, pkg; platform), pkgs)
@@ -634,8 +637,7 @@ function download_artifacts(env::EnvCache;
634637
pkg_root = source_path(env.project_file, pkg, julia_version)
635638
pkg_root === nothing || push!(pkg_roots, pkg_root)
636639
end
637-
envpkg = env.pkg
638-
envpkg === nothing || push!(pkg_roots, envpkg.path)
640+
push!(pkg_roots, dirname(env.project_file))
639641
for pkg_root in pkg_roots
640642
for (artifacts_toml, artifacts) in collect_artifacts(pkg_root; platform)
641643
# For each Artifacts.toml, install each artifact we've collected from it

test/artifacts.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ end
488488
"AugmentedPlatform",
489489
"flooblecrank" => "disengaged",
490490
)
491-
491+
492492
p = HostPlatform()
493493
p["flooblecrank"] = "engaged"
494494
add_this_pkg(; platform=p)
@@ -770,4 +770,16 @@ end
770770
end
771771
end
772772

773+
@testset "artifacts for non package project" begin
774+
temp_pkg_dir() do tmpdir
775+
artifacts_toml = joinpath(tmpdir, "Artifacts.toml")
776+
cp(joinpath(@__DIR__, "test_packages", "ArtifactInstallation", "Artifacts.toml"), artifacts_toml)
777+
Pkg.activate(tmpdir)
778+
cts_hash = artifact_hash("collapse_the_symlink", artifacts_toml)
779+
@test !artifact_exists(cts_hash)
780+
Pkg.instantiate()
781+
@test artifact_exists(cts_hash)
782+
end
783+
end
784+
773785
end # module

0 commit comments

Comments
 (0)