@@ -1368,14 +1368,20 @@ end
13681368const StaleCacheKey = Tuple{Base. PkgId, UInt128, String, String}
13691369
13701370"""
1371- Base.isprecompiled(pkg::PkgId)
1371+ Base.isprecompiled(pkg::PkgId; ignore_loaded::Bool=false )
13721372
13731373Returns whether a given PkgId within the active project is precompiled.
13741374
1375+ By default this check observes the same approach that code loading takes
1376+ with respect to when different versions of dependencies are currently loaded
1377+ to that which is expected. To ignore loaded modules and answer as if in a
1378+ fresh julia session specify `ignore_loaded=true`.
1379+
13751380!!! compat "Julia 1.10"
13761381 This function requires at least Julia 1.10.
13771382"""
13781383function isprecompiled (pkg:: PkgId ;
1384+ ignore_loaded:: Bool = false ,
13791385 stale_cache:: Dict{StaleCacheKey,Bool} = Dict {StaleCacheKey, Bool} (),
13801386 cachepaths:: Vector{String} = Base. find_all_in_cache_path (pkg),
13811387 sourcepath:: Union{String,Nothing} = Base. locate_package (pkg)
@@ -1395,7 +1401,7 @@ function isprecompiled(pkg::PkgId;
13951401 modpaths = find_all_in_cache_path (modkey)
13961402 for modpath_to_try in modpaths:: Vector{String}
13971403 stale_cache_key = (modkey, modbuild_id, modpath, modpath_to_try):: StaleCacheKey
1398- if get! (() -> stale_cachefile (stale_cache_key... , ignore_loaded= true ) === true ,
1404+ if get! (() -> stale_cachefile (stale_cache_key... ; ignore_loaded) === true ,
13991405 stale_cache, stale_cache_key)
14001406 continue
14011407 end
0 commit comments