@@ -402,7 +402,6 @@ function precompilepkgs(pkgs::Vector{String}=String[];
402
402
depsmap[pkg] = filter! (! Base. in_sysimage, deps)
403
403
# add any extensions
404
404
pkg_exts = Dict {Base.PkgId, Vector{Base.PkgId}} ()
405
- prev_ext = nothing
406
405
for (ext_name, extdep_uuids) in env. extensions[dep]
407
406
ext_deps = Base. PkgId[]
408
407
push! (ext_deps, pkg) # depends on parent package
@@ -417,13 +416,8 @@ function precompilepkgs(pkgs::Vector{String}=String[];
417
416
end
418
417
end
419
418
all_extdeps_available || continue
420
- if prev_ext isa Base. PkgId
421
- # also make the exts depend on eachother sequentially to avoid race
422
- push! (ext_deps, prev_ext)
423
- end
424
419
ext_uuid = Base. uuid5 (pkg. uuid, ext_name)
425
420
ext = Base. PkgId (ext_uuid, ext_name)
426
- prev_ext = ext
427
421
filter! (! Base. in_sysimage, ext_deps)
428
422
depsmap[ext] = ext_deps
429
423
exts[ext] = pkg. name
@@ -434,6 +428,51 @@ function precompilepkgs(pkgs::Vector{String}=String[];
434
428
end
435
429
end
436
430
431
+ # An extension effectively depends on another extension if it has all the the
432
+ # dependencies of that other extension
433
+ function expand_dependencies (depsmap)
434
+ function visit! (visited, node, all_deps)
435
+ if node in visited
436
+ return
437
+ end
438
+ push! (visited, node)
439
+ for dep in get (Set{Base. PkgId}, depsmap, node)
440
+ if ! (dep in all_deps)
441
+ push! (all_deps, dep)
442
+ visit! (visited, dep, all_deps)
443
+ end
444
+ end
445
+ end
446
+
447
+ depsmap_transitive = Dict {Base.PkgId, Set{Base.PkgId}} ()
448
+ for package in keys (depsmap)
449
+ # Initialize a set to keep track of all dependencies for 'package'
450
+ all_deps = Set {Base.PkgId} ()
451
+ visited = Set {Base.PkgId} ()
452
+ visit! (visited, package, all_deps)
453
+ # Update depsmap with the complete set of dependencies for 'package'
454
+ depsmap_transitive[package] = all_deps
455
+ end
456
+ return depsmap_transitive
457
+ end
458
+
459
+ depsmap_transitive = expand_dependencies (depsmap)
460
+
461
+ for (_, extensions_1) in pkg_exts_map
462
+ for extension_1 in extensions_1
463
+ deps_ext_1 = depsmap_transitive[extension_1]
464
+ for (_, extensions_2) in pkg_exts_map
465
+ for extension_2 in extensions_2
466
+ extension_1 == extension_2 && continue
467
+ deps_ext_2 = depsmap_transitive[extension_2]
468
+ if issubset (deps_ext_2, deps_ext_1)
469
+ push! (depsmap[extension_1], extension_2)
470
+ end
471
+ end
472
+ end
473
+ end
474
+ end
475
+
437
476
@debug " precompile: deps collected"
438
477
# this loop must be run after the full depsmap has been populated
439
478
for (pkg, pkg_exts) in pkg_exts_map
@@ -748,6 +787,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
748
787
end
749
788
@debug " precompile: starting precompilation loop" depsmap direct_deps
750
789
# # precompilation loop
790
+
751
791
for (pkg, deps) in depsmap
752
792
cachepaths = Base. find_all_in_cache_path (pkg)
753
793
sourcepath = Base. locate_package (pkg)
@@ -820,6 +860,7 @@ function precompilepkgs(pkgs::Vector{String}=String[];
820
860
end
821
861
loaded && (n_loaded += 1 )
822
862
catch err
863
+ @show err
823
864
close (std_pipe. in) # close pipe to end the std output monitor
824
865
wait (t_monitor)
825
866
if err isa ErrorException || (err isa ArgumentError && startswith (err. msg, " Invalid header in cache file" ))
@@ -843,7 +884,8 @@ function precompilepkgs(pkgs::Vector{String}=String[];
843
884
notify (was_processed[pkg_config])
844
885
catch err_outer
845
886
# For debugging:
846
- # println("Task failed $err_outer") # logging doesn't show here
887
+ println (" Task failed $err_outer " )
888
+ Base. display_error (ErrorException (" " ), Base. catch_backtrace ())# logging doesn't show here
847
889
handle_interrupt (err_outer) || rethrow ()
848
890
notify (was_processed[pkg_config])
849
891
finally
0 commit comments