@@ -1425,6 +1425,29 @@ const uuid_package = UUID("cfb74b52-ec16-5bb7-a574-95d9e393895e")
14251425# For even more interesting historical reasons, we append an extra
14261426# "_jll" to the name of the new package before computing its UUID.
14271427jll_uuid (name) = bb_specific_uuid5 (uuid_package, " $(name) _jll" )
1428+
1429+ function find_uuid (ctx, pkg)
1430+ if Pkg. Types. has_uuid (pkg)
1431+ return pkg. uuid
1432+ end
1433+ depname = getname (pkg)
1434+ @static if VERSION >= v " 1.7"
1435+ uuids = Pkg. Types. registered_uuids (ctx. registries, depname)
1436+ else
1437+ uuids = Pkg. Types. registered_uuids (ctx, depname)
1438+ end
1439+ if isempty (uuids)
1440+ return nothing
1441+ end
1442+ if length (uuids) == 1
1443+ return first (uuids)
1444+ end
1445+ error ("""
1446+ Multiple UUIDs found for package `$(depname) `.
1447+ Use `PackageSpec(name = \" $(depname) \" , uuid = ..." to specify the UUID explicitly.
1448+ """ )
1449+ end
1450+
14281451function build_project_dict (name, version, dependencies:: Array{Dependency} , julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC; lazy_artifacts:: Bool = false , kwargs... )
14291452 Pkg. Types. semver_spec (julia_compat) # verify julia_compat is valid
14301453 project = Dict (
@@ -1437,9 +1460,16 @@ function build_project_dict(name, version, dependencies::Array{Dependency}, juli
14371460 " compat" => Dict {String,Any} (" JLLWrappers" => " 1.2.0" ,
14381461 " julia" => " $(julia_compat) " )
14391462 )
1463+
1464+ ctx = Pkg. Types. Context ()
14401465 for dep in dependencies
1466+ pkgspec = getpkg (dep)
14411467 depname = getname (dep)
1442- project[" deps" ][depname] = string (jll_uuid (depname))
1468+ uuid = find_uuid (ctx, pkgspec)
1469+ if uuid === nothing
1470+ uuid = jll_uuid (depname)
1471+ end
1472+ project[" deps" ][depname] = string (uuid)
14431473 if dep isa Dependency && length (dep. compat) > 0
14441474 Pkg. Types. semver_spec (dep. compat) # verify dep.compat is valid
14451475 project[" compat" ][depname] = dep. compat
0 commit comments