@@ -1438,7 +1438,6 @@ function run_module_init(mod::Module, i::Int=1)
14381438end
14391439
14401440function run_package_callbacks (modkey:: PkgId )
1441- @assert modkey != precompilation_target
14421441 run_extension_callbacks (modkey)
14431442 assert_havelock (require_lock)
14441443 unlock (require_lock)
@@ -1568,7 +1567,7 @@ function _insert_extension_triggers(parent::PkgId, extensions::Dict{String, Any}
15681567 uuid_trigger = UUID (totaldeps[trigger]:: String )
15691568 trigger_id = PkgId (uuid_trigger, trigger)
15701569 push! (trigger_ids, trigger_id)
1571- if ! haskey (Base. loaded_modules, trigger_id) || haskey (package_locks, trigger_id) || (trigger_id == precompilation_target)
1570+ if ! haskey (Base. loaded_modules, trigger_id) || haskey (package_locks, trigger_id)
15721571 trigger1 = get! (Vector{ExtensionId}, EXT_DORMITORY, trigger_id)
15731572 push! (trigger1, gid)
15741573 else
@@ -1581,7 +1580,6 @@ end
15811580loading_extension:: Bool = false
15821581loadable_extensions:: Union{Nothing,Vector{PkgId}} = nothing
15831582precompiling_extension:: Bool = false
1584- precompilation_target:: Union{Nothing,PkgId} = nothing
15851583function run_extension_callbacks (extid:: ExtensionId )
15861584 assert_havelock (require_lock)
15871585 succeeded = try
@@ -2502,10 +2500,7 @@ function _require_prelocked(uuidkey::PkgId, env=nothing)
25022500 try
25032501 toplevel_load[] = false
25042502 m = __require_prelocked (uuidkey, env)
2505- if m === nothing
2506- error (" package `$(uuidkey. name) ` did not define the expected \
2507- module `$(uuidkey. name) `, check for typos in package module name" )
2508- end
2503+ m isa Module || check_package_module_loaded_error (uuidkey)
25092504 finally
25102505 toplevel_load[] = last
25112506 end_loading (uuidkey, m)
@@ -2995,6 +2990,9 @@ const newly_inferred = CodeInstance[]
29952990function include_package_for_output (pkg:: PkgId , input:: String , depot_path:: Vector{String} , dl_load_path:: Vector{String} , load_path:: Vector{String} ,
29962991 concrete_deps:: typeof (_concrete_dependencies), source:: Union{Nothing,String} )
29972992
2993+ @lock require_lock begin
2994+ m = start_loading (pkg, UInt128 (0 ), false )
2995+ @assert m === nothing
29982996 append! (empty! (Base. DEPOT_PATH ), depot_path)
29992997 append! (empty! (Base. DL_LOAD_PATH), dl_load_path)
30002998 append! (empty! (Base. LOAD_PATH ), load_path)
@@ -3003,6 +3001,8 @@ function include_package_for_output(pkg::PkgId, input::String, depot_path::Vecto
30033001 Base. _track_dependencies[] = true
30043002 get! (Base. PkgOrigin, Base. pkgorigins, pkg). path = input
30053003 append! (empty! (Base. _concrete_dependencies), concrete_deps)
3004+ end
3005+
30063006 uuid_tuple = pkg. uuid === nothing ? (UInt64 (0 ), UInt64 (0 )) : convert (NTuple{2 , UInt64}, pkg. uuid)
30073007
30083008 ccall (:jl_set_module_uuid , Cvoid, (Any, NTuple{2 , UInt64}), Base. __toplevel__, uuid_tuple)
@@ -3021,21 +3021,22 @@ function include_package_for_output(pkg::PkgId, input::String, depot_path::Vecto
30213021 ccall (:jl_set_newly_inferred , Cvoid, (Any,), nothing )
30223022 end
30233023 # check that the package defined the expected module so we can give a nice error message if not
3024- Base. check_package_module_loaded (pkg)
3024+ m = maybe_root_module (pkg)
3025+ m isa Module || check_package_module_loaded_error (pkg)
30253026
30263027 # Re-populate the runtime's newly-inferred array, which will be included
30273028 # in the output. We removed it above to avoid including any code we may
30283029 # have compiled for error handling and validation.
30293030 ccall (:jl_set_newly_inferred , Cvoid, (Any,), newly_inferred)
3031+ @lock require_lock end_loading (pkg, m)
3032+ # insert_extension_triggers(pkg)
3033+ # run_package_callbacks(pkg)
30303034end
30313035
3032- function check_package_module_loaded (pkg:: PkgId )
3033- if ! haskey (Base. loaded_modules, pkg)
3034- # match compilecache error type for non-125 errors
3035- error (" $(repr (" text/plain" , pkg)) did not define the expected module `$(pkg. name) `, \
3036- check for typos in package module name" )
3037- end
3038- return nothing
3036+ function check_package_module_loaded_error (pkg)
3037+ # match compilecache error type for non-125 errors
3038+ error (" package `$(pkg. name) ` did not define the expected \
3039+ module `$(pkg. name) `, check for typos in package module name" )
30393040end
30403041
30413042# protects against PkgId and UUID being imported and losing Base prefix
@@ -3111,7 +3112,6 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, output_o::
31113112 Base.track_nested_precomp($(_pkg_str (vcat (Base. precompilation_stack, pkg))) )
31123113 Base.loadable_extensions = $(_pkg_str (loadable_exts))
31133114 Base.precompiling_extension = $(loading_extension)
3114- Base.precompilation_target = $(_pkg_str (pkg))
31153115 Base.include_package_for_output($(_pkg_str (pkg)) , $(repr (abspath (input))) , $(repr (depot_path)) , $(repr (dl_load_path)) ,
31163116 $(repr (load_path)) , $(_pkg_str (concrete_deps)) , $(repr (source_path (nothing ))) )
31173117 """ )
0 commit comments