Skip to content

Commit

Permalink
tweak how Pkg is loaded for precompiling when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Aug 28, 2023
1 parent 5261b3b commit a1694e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,13 @@ end
function gen_test_precompile_code(source_path::String; coverage, julia_args::Cmd, test_args::Cmd)
# Note that we cannot load the dev-ed Pkg here during Pkg testing
# so the `Pkg.precompile` that is run here is the one in the sysimage
pkgdir = joinpath(@__DIR__, "..")
code = """
Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
$(Base.load_path_setup_code(false))
append!(empty!(ARGS), $(repr(test_args.exec)))
pushfirst!(LOAD_PATH, $(repr(pkgdir)))
try using Pkg
catch e
@warn "Pkg not loaded, skipping precompilation."
end
Pkg.precompile(warn_loaded = false)
"""
return gen_subprocess_cmd(code, source_path; coverage, julia_args)
Expand Down

0 comments on commit a1694e5

Please sign in to comment.