Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 17 additions & 37 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,42 +222,21 @@ end
# This has to be done after the packages have been downloaded
# since we need access to the Project file to read the information
# about extensions
function fixups_from_projectfile!(ctx::Context)
env = ctx.env
function fixups_from_projectfile!(env::EnvCache)
for pkg in values(env.manifest)
if ctx.julia_version !== VERSION && is_stdlib(pkg.uuid, ctx.julia_version)
# Special handling for non-current julia_version resolving given the source for historical stdlibs
# isn't available at this stage as Pkg thinks it should not be needed, so rely on STDLIBS_BY_VERSION
stdlibs = Types.get_last_stdlibs(ctx.julia_version)
p = stdlibs[pkg.uuid]
pkg.weakdeps = Dict{String, Base.UUID}(stdlibs[uuid].name => uuid for uuid in p.weakdeps)
# pkg.exts = p.exts # TODO: STDLIBS_BY_VERSION doesn't record this
# pkg.entryfile = p.entryfile # TODO: STDLIBS_BY_VERSION doesn't record this
for (name, _) in pkg.weakdeps
# isfile_casesenstive within locate_project_file used to error on Windows if given a
# relative path so abspath it to be extra safe https://github.com/JuliaLang/julia/pull/55220
project_file = Base.locate_project_file(abspath(source_path(env.manifest_file, pkg)))
if project_file isa String && isfile(project_file)
p = Types.read_project(project_file)
pkg.weakdeps = p.weakdeps
pkg.exts = p.exts
pkg.entryfile = p.entryfile
for (name, _) in p.weakdeps
if !haskey(p.deps, name)
delete!(pkg.deps, name)
end
end
else
# normal mode based on project files.
# isfile_casesenstive within locate_project_file used to error on Windows if given a
# relative path so abspath it to be extra safe https://github.com/JuliaLang/julia/pull/55220
sourcepath = source_path(env.manifest_file, pkg)
if sourcepath === nothing
pkgerror("could not find source path for package $(pkg.name) based on manifest $(env.manifest_file)")
end
project_file = Base.locate_project_file(abspath(sourcepath))
if project_file isa String && isfile(project_file)
p = Types.read_project(project_file)
pkg.weakdeps = p.weakdeps
pkg.exts = p.exts
pkg.entryfile = p.entryfile
for (name, _) in p.weakdeps
if !haskey(p.deps, name)
delete!(pkg.deps, name)
end
end
end
end
end
prune_manifest(env)
Expand Down Expand Up @@ -1679,7 +1658,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}, new_git=Set{UUID}();
man_pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, pkgs, preserve, ctx.julia_version)
update_manifest!(ctx.env, man_pkgs, deps_map, ctx.julia_version)
new_apply = download_source(ctx)
fixups_from_projectfile!(ctx)
fixups_from_projectfile!(ctx.env)

# After downloading resolutionary packages, search for (Julia)Artifacts.toml files
# and ensure they are all downloaded and unpacked as well:
Expand Down Expand Up @@ -1726,7 +1705,7 @@ function develop(ctx::Context, pkgs::Vector{PackageSpec}, new_git::Set{UUID};
pkgs, deps_map = _resolve(ctx.io, ctx.env, ctx.registries, pkgs, preserve, ctx.julia_version)
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
new_apply = download_source(ctx)
fixups_from_projectfile!(ctx)
fixups_from_projectfile!(ctx.env)
download_artifacts(ctx; platform=platform, julia_version=ctx.julia_version)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down Expand Up @@ -1867,7 +1846,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}, level::UpgradeLevel;
end
update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
new_apply = download_source(ctx)
fixups_from_projectfile!(ctx)
fixups_from_projectfile!(ctx.env)
download_artifacts(ctx, julia_version=ctx.julia_version)
write_env(ctx.env; skip_writing_project) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io, hidden_upgrades_info = true)
Expand Down Expand Up @@ -1913,7 +1892,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec})

update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
new = download_source(ctx)
fixups_from_projectfile!(ctx)
fixups_from_projectfile!(ctx.env)
download_artifacts(ctx; julia_version=ctx.julia_version)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down Expand Up @@ -1961,7 +1940,7 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; err_if_free=true)

update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
new = download_source(ctx)
fixups_from_projectfile!(ctx)
fixups_from_projectfile!(ctx.env)
download_artifacts(ctx)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down Expand Up @@ -2574,7 +2553,8 @@ end

function is_package_downloaded(manifest_file::String, pkg::PackageSpec; platform=HostPlatform())
sourcepath = source_path(manifest_file, pkg)
sourcepath === nothing && return false
identifier = pkg.name !== nothing ? pkg.name : pkg.uuid
(sourcepath === nothing) && pkgerror("Could not locate the source code for the $(identifier) package. Are you trying to use a manifest generated by a different version of Julia?")
isdir(sourcepath) || return false
check_artifacts_downloaded(sourcepath; platform) || return false
return true
Expand Down
2 changes: 1 addition & 1 deletion test/extensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using UUIDs
Pkg.status(; extensions=true, mode=Pkg.PKGMODE_MANIFEST, io)
# TODO: Test output when ext deps are loaded etc.
str = String(take!(io))
@test contains(str, "└─ OffsetArraysExt [OffsetArrays]" )
@test contains(str, "OffsetArraysExt [OffsetArrays]" )
@test !any(endswith(".cov"), readdir(joinpath(hdwe_root, "src")))
@test !any(endswith(".cov"), readdir(joinpath(he_root, "src")))
@test !any(endswith(".cov"), readdir(joinpath(he_root, "ext")))
Expand Down
Loading