Skip to content

Commit 61b3e0e

Browse files
support new manifest format during code load
1 parent 8402463 commit 61b3e0e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

base/loading.jl

+17-2
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,27 @@ function explicit_project_deps_get(project_file::String, name::String)::Union{No
498498
return nothing
499499
end
500500

501+
# Handles returning deps list for both old and new manifest formats.
502+
function get_deps(d)
503+
if haskey(d, "manifest_format")
504+
if haskey(d, "deps")
505+
return d["deps"]
506+
else
507+
# if there are no deps, then the `deps` field isn't present so return an empty dict
508+
return Dict{String, Any}()
509+
end
510+
else
511+
# older flat version manifest. Return the entire dict
512+
return d
513+
end
514+
end
515+
501516
# find `where` stanza and return the PkgId for `name`
502517
# return `nothing` if it did not find `where` (indicating caller should continue searching)
503518
function explicit_manifest_deps_get(project_file::String, where::UUID, name::String)::Union{Nothing,PkgId}
504519
manifest_file = project_file_manifest_path(project_file)
505520
manifest_file === nothing && return nothing # manifest not found--keep searching LOAD_PATH
506-
d = parsed_toml(manifest_file)
521+
d = get_deps(parsed_toml(manifest_file))
507522
found_where = false
508523
found_name = false
509524
for (dep_name, entries) in d
@@ -551,7 +566,7 @@ function explicit_manifest_uuid_path(project_file::String, pkg::PkgId)::Union{No
551566
manifest_file = project_file_manifest_path(project_file)
552567
manifest_file === nothing && return nothing # no manifest, skip env
553568

554-
d = parsed_toml(manifest_file)
569+
d = get_deps(parsed_toml(manifest_file))
555570
entries = get(d, pkg.name, nothing)::Union{Nothing, Vector{Any}}
556571
entries === nothing && return nothing # TODO: allow name to mismatch?
557572
for entry in entries

0 commit comments

Comments
 (0)