Skip to content

Commit

Permalink
[Prefix] Fix installation of packages in nightly
Browse files Browse the repository at this point in the history
With Julia v1.9 we have to use `Pkg.respect_sysimage_versions(false)` to install
stdlib JLLs in our projects.
  • Loading branch information
giordano committed Mar 1, 2022
1 parent f78a16a commit 28903a3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Prefix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,20 @@ function get_addable_spec(name::AbstractString, version::VersionNumber;
)
end

# Helper function to install packages also in Julia v1.9
function Pkg_add(args...; kwargs...)
if VERSION < v"1.9.0-DEV"
Pkg.add(args...; kwargs...)
else
try
Pkg.respect_sysimage_versions(false)
Pkg.add(args...; kwargs...)
finally
Pkg.respect_sysimage_versions(true)
end
end
end

"""
setup_dependencies(prefix::Prefix, dependencies::Vector{PackageSpec}, platform::AbstractPlatform; verbose::Bool = false)
Expand Down Expand Up @@ -586,7 +600,7 @@ function setup_dependencies(prefix::Prefix,
update_registry(outs)

# Add all dependencies
Pkg.add(ctx, dependencies; platform=platform, io=outs)
Pkg_add(ctx, dependencies; platform=platform, io=outs)

# Ony Julia v1.6, `Pkg.add()` doesn't mutate `dependencies`, so we can't use the `UUID`
# that was found during resolution there. Instead, we'll make use of `ctx.env` to figure
Expand Down Expand Up @@ -628,7 +642,7 @@ function setup_dependencies(prefix::Prefix,

# Re-install stdlib dependencies, but this time with `julia_version = nothing`
if !isempty(stdlib_pkgspecs)
Pkg.add(ctx, stdlib_pkgspecs; io=outs, julia_version=nothing)
Pkg_add(ctx, stdlib_pkgspecs; io=outs, julia_version=nothing)
end

# Load their Artifacts.toml files
Expand Down

0 comments on commit 28903a3

Please sign in to comment.