@@ -1425,6 +1425,29 @@ const uuid_package = UUID("cfb74b52-ec16-5bb7-a574-95d9e393895e")
1425
1425
# For even more interesting historical reasons, we append an extra
1426
1426
# "_jll" to the name of the new package before computing its UUID.
1427
1427
jll_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
+
1428
1451
function build_project_dict (name, version, dependencies:: Array{Dependency} , julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC; lazy_artifacts:: Bool = false , kwargs... )
1429
1452
Pkg. Types. semver_spec (julia_compat) # verify julia_compat is valid
1430
1453
project = Dict (
@@ -1437,9 +1460,16 @@ function build_project_dict(name, version, dependencies::Array{Dependency}, juli
1437
1460
" compat" => Dict {String,Any} (" JLLWrappers" => " 1.2.0" ,
1438
1461
" julia" => " $(julia_compat) " )
1439
1462
)
1463
+
1464
+ ctx = Pkg. Types. Context ()
1440
1465
for dep in dependencies
1466
+ pkgspec = getpkg (dep)
1441
1467
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)
1443
1473
if dep isa Dependency && length (dep. compat) > 0
1444
1474
Pkg. Types. semver_spec (dep. compat) # verify dep.compat is valid
1445
1475
project[" compat" ][depname] = dep. compat
0 commit comments