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

Add option to allow stale_cachefile to ignore loaded modules (for Pkg.precompile) #42545

Merged
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
6 changes: 5 additions & 1 deletion base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ get_compiletime_preferences(::Nothing) = String[]

# returns true if it "cachefile.ji" is stale relative to "modpath.jl"
# otherwise returns the list of dependencies to also check
function stale_cachefile(modpath::String, cachefile::String)
function stale_cachefile(modpath::String, cachefile::String; ignore_loaded = false)
io = open(cachefile, "r")
try
if !isvalid_cache_header(io)
Expand All @@ -1835,11 +1835,15 @@ function stale_cachefile(modpath::String, cachefile::String)
M = root_module(req_key)
if PkgId(M) == req_key && module_build_id(M) === req_build_id
depmods[i] = M
elseif ignore_loaded
# Used by Pkg.precompile given that there it's ok to precompile different versions of loaded packages
@goto locate_branch
else
@debug "Rejecting cache file $cachefile because module $req_key is already loaded and incompatible."
return true # Won't be able to fulfill dependency
end
else
@label locate_branch
path = locate_package(req_key)
get!(PkgOrigin, pkgorigins, req_key).path = path
if path === nothing
Expand Down