@@ -1080,6 +1080,7 @@ function register_restored_modules(sv::SimpleVector, pkg::PkgId, path::String)
1080
1080
end
1081
1081
1082
1082
function run_package_callbacks (modkey:: PkgId )
1083
+ run_extension_callbacks (modkey)
1083
1084
assert_havelock (require_lock)
1084
1085
unlock (require_lock)
1085
1086
try
@@ -1204,55 +1205,51 @@ function run_extension_callbacks(extid::ExtensionId)
1204
1205
return succeeded
1205
1206
end
1206
1207
1207
- function run_extension_callbacks ()
1208
+ function run_extension_callbacks (pkgid :: PkgId )
1208
1209
assert_havelock (require_lock)
1209
- loaded_triggers = collect (intersect (keys (Base. loaded_modules), keys (Base. EXT_DORMITORY)))
1210
- sort! (loaded_triggers; by= x-> x. uuid)
1211
- for pkgid in loaded_triggers
1212
- # take ownership of extids that depend on this pkgid
1213
- extids = pop! (EXT_DORMITORY, pkgid, nothing )
1214
- extids === nothing && continue
1215
- for extid in extids
1216
- if extid. ntriggers > 0
1217
- # It is possible that pkgid was loaded in an environment
1218
- # below the one of the parent. This will cause a load failure when the
1219
- # pkg ext tries to load the triggers. Therefore, check this first
1220
- # before loading the pkg ext.
1221
- pkgenv = identify_package_env (extid. id, pkgid. name)
1222
- ext_not_allowed_load = false
1223
- if pkgenv === nothing
1210
+ # take ownership of extids that depend on this pkgid
1211
+ extids = pop! (EXT_DORMITORY, pkgid, nothing )
1212
+ extids === nothing && return
1213
+ for extid in extids
1214
+ if extid. ntriggers > 0
1215
+ # It is possible that pkgid was loaded in an environment
1216
+ # below the one of the parent. This will cause a load failure when the
1217
+ # pkg ext tries to load the triggers. Therefore, check this first
1218
+ # before loading the pkg ext.
1219
+ pkgenv = identify_package_env (extid. id, pkgid. name)
1220
+ ext_not_allowed_load = false
1221
+ if pkgenv === nothing
1222
+ ext_not_allowed_load = true
1223
+ else
1224
+ pkg, env = pkgenv
1225
+ path = locate_package (pkg, env)
1226
+ if path === nothing
1224
1227
ext_not_allowed_load = true
1225
- else
1226
- pkg, env = pkgenv
1227
- path = Base. locate_package (pkg, env)
1228
- if path === nothing
1229
- ext_not_allowed_load = true
1230
- end
1231
- end
1232
- if ext_not_allowed_load
1233
- @debug " Extension $(extid. id. name) of $(extid. parentid. name) will not be loaded \
1234
- since $(pkgid. name) loaded in environment lower in load path"
1235
- # indicate extid is expected to fail
1236
- extid. ntriggers *= - 1
1237
- else
1238
- # indicate pkgid is loaded
1239
- extid. ntriggers -= 1
1240
1228
end
1241
1229
end
1242
- if extid. ntriggers < 0
1243
- # indicate pkgid is loaded
1244
- extid. ntriggers += 1
1245
- succeeded = false
1230
+ if ext_not_allowed_load
1231
+ @debug " Extension $(extid. id. name) of $(extid. parentid. name) will not be loaded \
1232
+ since $(pkgid. name) loaded in environment lower in load path"
1233
+ # indicate extid is expected to fail
1234
+ extid. ntriggers *= - 1
1246
1235
else
1247
- succeeded = true
1248
- end
1249
- if extid. ntriggers == 0
1250
- # actually load extid, now that all dependencies are met,
1251
- # and record the result
1252
- succeeded = succeeded && run_extension_callbacks (extid)
1253
- succeeded || push! (EXT_DORMITORY_FAILED, extid)
1236
+ # indicate pkgid is loaded
1237
+ extid. ntriggers -= 1
1254
1238
end
1255
1239
end
1240
+ if extid. ntriggers < 0
1241
+ # indicate pkgid is loaded
1242
+ extid. ntriggers += 1
1243
+ succeeded = false
1244
+ else
1245
+ succeeded = true
1246
+ end
1247
+ if extid. ntriggers == 0
1248
+ # actually load extid, now that all dependencies are met,
1249
+ # and record the result
1250
+ succeeded = succeeded && run_extension_callbacks (extid)
1251
+ succeeded || push! (EXT_DORMITORY_FAILED, extid)
1252
+ end
1256
1253
end
1257
1254
return
1258
1255
end
@@ -1276,7 +1273,7 @@ function retry_load_extensions()
1276
1273
end
1277
1274
prepend! (EXT_DORMITORY_FAILED, failed)
1278
1275
end
1279
- nothing
1276
+ return
1280
1277
end
1281
1278
1282
1279
"""
@@ -1669,10 +1666,6 @@ function _require_prelocked(uuidkey::PkgId, env=nothing)
1669
1666
else
1670
1667
newm = root_module (uuidkey)
1671
1668
end
1672
- # Load extensions when not precompiling and not in a nested package load
1673
- if JLOptions (). incremental == 0 && isempty (package_locks)
1674
- run_extension_callbacks ()
1675
- end
1676
1669
return newm
1677
1670
end
1678
1671
0 commit comments