Skip to content

Commit 0ccdeaf

Browse files
committed
Add comment about how package identity is determined
1 parent 36ed8cf commit 0ccdeaf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/PackageGraph/PackageModel+Extensions.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ extension PackageDependencyDescription {
1515
/// Create the package reference object for the dependency.
1616
public func createPackageRef(config: SwiftPMConfig) -> PackageReference {
1717
let effectiveURL = config.mirroredURL(forURL: url)
18+
19+
// FIXME: The identity of a package dependency is currently based on
20+
// the explicit name provided in the package manifest, if provided,
21+
// falling back on a name computed from its effective URL.
22+
// We should instead use the declared URL of a package dependency as its identity,
23+
// as it will be necessary for supporting package registries.
24+
let identity = explicitName?.lowercased() ?? PackageReference.computeIdentity(packageURL: effectiveURL)
25+
1826
return PackageReference(
19-
identity: explicitName?.lowercased() ?? PackageReference.computeIdentity(packageURL: effectiveURL),
27+
identity: identity,
2028
path: effectiveURL,
2129
kind: requirement == .localPackage ? .local : .remote
2230
)

0 commit comments

Comments
 (0)