Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.10] Backports 1.10 #3965

Merged
merged 5 commits into from
Jul 24, 2024
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
35 changes: 17 additions & 18 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,18 @@ 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 fixup_ext!(env, pkgs)
for pkg in pkgs
v = joinpath(source_path(env.manifest_file, pkg), "Project.toml")
if haskey(env.manifest, pkg.uuid)
entry = env.manifest[pkg.uuid]
if isfile(v)
p = Types.read_project(v)
entry.weakdeps = p.weakdeps
entry.exts = p.exts
for (name, _) in p.weakdeps
if !haskey(p.deps, name)
delete!(entry.deps, name)
end
function fixup_ext!(env::EnvCache)
for pkg in values(env.manifest)
# 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
for (name, _) in p.weakdeps
if !haskey(p.deps, name)
delete!(pkg.deps, name)
end
end
end
Expand Down Expand Up @@ -1388,7 +1387,7 @@ function add(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)
fixup_ext!(ctx.env, pkgs)
fixup_ext!(ctx.env)

# After downloading resolutionary packages, search for (Julia)Artifacts.toml files
# and ensure they are all downloaded and unpacked as well:
Expand All @@ -1411,7 +1410,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)
fixup_ext!(ctx.env, pkgs)
fixup_ext!(ctx.env)
download_artifacts(ctx.env; platform=platform, julia_version=ctx.julia_version, io=ctx.io)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down Expand Up @@ -1539,7 +1538,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)
fixup_ext!(ctx.env, pkgs)
fixup_ext!(ctx.env)
download_artifacts(ctx.env, julia_version=ctx.julia_version, io=ctx.io)
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 @@ -1585,7 +1584,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec})

update_manifest!(ctx.env, pkgs, deps_map, ctx.julia_version)
new = download_source(ctx)
fixup_ext!(ctx.env, pkgs)
fixup_ext!(ctx.env)
download_artifacts(ctx.env; julia_version=ctx.julia_version, io=ctx.io)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down Expand Up @@ -1629,7 +1628,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)
fixup_ext!(ctx.env, pkgs)
fixup_ext!(ctx.env)
download_artifacts(ctx.env, io=ctx.io)
write_env(ctx.env) # write env before building
show_update(ctx.env, ctx.registries; io=ctx.io)
Expand Down
6 changes: 5 additions & 1 deletion src/Pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,18 @@ const update = API.up
Pkg.test(pkgs::Union{PackageSpec, Vector{PackageSpec}}; kwargs...)

**Keyword arguments:**
- `coverage::Bool=false`: enable or disable generation of coverage statistics.
- `coverage::Union{Bool,String}=false`: enable or disable generation of coverage statistics for the tested package.
If a string is passed it is passed directly to `--code-coverage` in the test process so e.g. "user" will test all user code.
- `allow_reresolve::Bool=true`: allow Pkg to reresolve the package versions in the test environment
- `julia_args::Union{Cmd, Vector{String}}`: options to be passed the test process.
- `test_args::Union{Cmd, Vector{String}}`: test arguments (`ARGS`) available in the test process.

!!! compat "Julia 1.9"
`allow_reresolve` requires at least Julia 1.9.

!!! compat "Julia 1.9"
Passing a string to `coverage` requires at least Julia 1.9.

Run the tests for package `pkg`, or for the current project (which thus needs to be a package) if no
positional argument is given to `Pkg.test`. A package is tested by running its
`test/runtests.jl` file.
Expand Down
7 changes: 6 additions & 1 deletion src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,12 @@ function write_env_usage(source_file::AbstractString, usage_filepath::AbstractSt
## Atomically write usage file using process id locking
FileWatching.mkpidlock(usage_file * ".pid", stale_age = 3) do
usage = if isfile(usage_file)
TOML.parsefile(usage_file)
try
TOML.parsefile(usage_file)
catch err
@warn "Failed to parse usage file `$usage_file`, ignoring." err
Dict{String, Any}()
end
else
Dict{String, Any}()
end
Expand Down
Loading