Skip to content

Commit

Permalink
add option to compilecache so that Pkg precompilation can not skip …
Browse files Browse the repository at this point in the history
…different versions of loaded modules (#40345)

* allow Pkg precomp to not skip loaded modules

* rename to ignore_loaded_modules

* arg alignment

(cherry picked from commit 0da808d)
  • Loading branch information
IanButterworth authored and KristofferC committed May 11, 2021
1 parent 3267f48 commit 17e51de
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1301,15 +1301,18 @@ end

const MAX_NUM_PRECOMPILE_FILES = Ref(10)

function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, internal_stdout::IO = stdout)
function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, internal_stdout::IO = stdout,
ignore_loaded_modules::Bool = true)
# decide where to put the resulting cache file
cachepath = compilecache_dir(pkg)

# build up the list of modules that we want the precompile process to preserve
concrete_deps = copy(_concrete_dependencies)
for (key, mod) in loaded_modules
if !(mod === Main || mod === Core || mod === Base)
push!(concrete_deps, key => module_build_id(mod))
if ignore_loaded_modules
for (key, mod) in loaded_modules
if !(mod === Main || mod === Core || mod === Base)
push!(concrete_deps, key => module_build_id(mod))
end
end
end
# run the expression and cache the result
Expand Down

0 comments on commit 17e51de

Please sign in to comment.