Skip to content

Commit

Permalink
add option to allow stale_cachefile to ignore loaded modules (JuliaLa…
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored and LilithHafner committed Mar 8, 2022
1 parent 96dc99d commit 39647ec
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 39647ec

Please sign in to comment.