Skip to content

Commit a22da0c

Browse files
committed
fix Core.Boxes in the package by
Found using the script in JuliaLang/julia#60478
1 parent cae80fb commit a22da0c

File tree

5 files changed

+213
-153
lines changed

5 files changed

+213
-153
lines changed

src/API.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,17 +1218,17 @@ function precompile(
12181218
return
12191219
end
12201220

1221-
io = ctx.io
1222-
if io isa IOContext{IO} && !isa(io.io, Base.PipeEndpoint)
1223-
# precompile does quite a bit of output and using the IOContext{IO} can cause
1224-
# some slowdowns, the important part here is to not specialize the whole
1225-
# precompile function on the io.
1226-
# But don't unwrap the IOContext if it is a PipeEndpoint, as that would
1227-
# cause the output to lose color.
1228-
io = io.io
1229-
end
1230-
12311221
return activate(dirname(ctx.env.project_file)) do
1222+
io = if ctx.io isa IOContext{IO} && !isa(ctx.io.io, Base.PipeEndpoint)
1223+
# precompile does quite a bit of output and using the IOContext{IO} can cause
1224+
# some slowdowns, the important part here is to not specialize the whole
1225+
# precompile function on the io.
1226+
# But don't unwrap the IOContext if it is a PipeEndpoint, as that would
1227+
# cause the output to lose color.
1228+
ctx.io.io
1229+
else
1230+
ctx.io
1231+
end
12321232
pkgs_name = String[pkg.name for pkg in pkgs]
12331233
return Base.Precompilation.precompilepkgs(pkgs_name; internal_call, strict, warn_loaded, timing, _from_loading, configs, manifest = workspace, io)
12341234
end
@@ -1599,6 +1599,23 @@ set_current_compat(; kwargs...) = set_current_compat(Context(); kwargs...)
15991599
# why #
16001600
#######
16011601

1602+
function why_find_paths!(final_paths, incoming, project_deps, current, path)
1603+
push!(path, current)
1604+
current in project_deps && push!(final_paths, path) # record once we've traversed to a project dep
1605+
haskey(incoming, current) || return # but only return if we've reached a leaf that nothing depends on
1606+
for p in incoming[current]
1607+
if p in path
1608+
# detected dependency cycle and none of the dependencies in the cycle
1609+
# are in the project could happen when manually modifying
1610+
# the project and running this function function before a
1611+
# resolve
1612+
continue
1613+
end
1614+
why_find_paths!(final_paths, incoming, project_deps, p, copy(path))
1615+
end
1616+
return
1617+
end
1618+
16021619
function why(ctx::Context, pkgs::Vector{PackageSpec}; io::IO, workspace::Bool = false, kwargs...)
16031620
require_not_empty(pkgs, :why)
16041621

@@ -1623,29 +1640,12 @@ function why(ctx::Context, pkgs::Vector{PackageSpec}; io::IO, workspace::Bool =
16231640
end
16241641
end
16251642

1626-
function find_paths!(final_paths, current, path = UUID[])
1627-
push!(path, current)
1628-
current in project_deps && push!(final_paths, path) # record once we've traversed to a project dep
1629-
haskey(incoming, current) || return # but only return if we've reached a leaf that nothing depends on
1630-
for p in incoming[current]
1631-
if p in path
1632-
# detected dependency cycle and none of the dependencies in the cycle
1633-
# are in the project could happen when manually modifying
1634-
# the project and running this function function before a
1635-
# resolve
1636-
continue
1637-
end
1638-
find_paths!(final_paths, p, copy(path))
1639-
end
1640-
return
1641-
end
1642-
16431643
first = true
16441644
for pkg in pkgs
16451645
!first && println(io)
16461646
first = false
16471647
final_paths = Set{Vector{UUID}}()
1648-
find_paths!(final_paths, pkg.uuid)
1648+
why_find_paths!(final_paths, incoming, project_deps, pkg.uuid, UUID[])
16491649
foreach(reverse!, final_paths)
16501650
final_paths_names = map(x -> [ctx.env.manifest[uuid].name for uuid in x], collect(final_paths))
16511651
sort!(final_paths_names, by = x -> (x, length(x)))

0 commit comments

Comments
 (0)