@@ -34,8 +34,8 @@ public struct PackageReference {
34
34
/// A package from a registry.
35
35
case registry( PackageIdentity )
36
36
37
- /// A prebuilt library provided by a toolchain
38
- case providedLibrary( AbsolutePath )
37
+ /// A prebuilt library provided by a toolchain for a package identified by the given "origin" URL.
38
+ case providedLibrary( SourceControlURL , AbsolutePath )
39
39
40
40
// FIXME: we should not need this once we migrate off URLs
41
41
//@available(*, deprecated)
@@ -52,8 +52,8 @@ public struct PackageReference {
52
52
case . registry( let identity) :
53
53
// FIXME: this is a placeholder
54
54
return identity. description
55
- case . providedLibrary( let path ) :
56
- return path . pathString
55
+ case . providedLibrary( let url , _ ) :
56
+ return url . absoluteString
57
57
}
58
58
}
59
59
@@ -75,8 +75,8 @@ public struct PackageReference {
75
75
return " remoteSourceControl \( url) "
76
76
case . registry( let identity) :
77
77
return " registry \( identity) "
78
- case . providedLibrary( let path) :
79
- return " library \( path) "
78
+ case . providedLibrary( let url , let path) :
79
+ return " provided library for \( url ) @ \( path) "
80
80
}
81
81
}
82
82
@@ -131,8 +131,8 @@ public struct PackageReference {
131
131
case . registry( let identity) :
132
132
// FIXME: this is a placeholder
133
133
self . deprecatedName = name ?? identity. description
134
- case . providedLibrary( let path ) :
135
- self . deprecatedName = name ?? PackageIdentityParser . computeDefaultName ( fromPath : path )
134
+ case . providedLibrary( let url , _ ) :
135
+ self . deprecatedName = name ?? PackageIdentityParser . computeDefaultName ( fromURL : url )
136
136
}
137
137
}
138
138
@@ -161,8 +161,12 @@ public struct PackageReference {
161
161
PackageReference ( identity: identity, kind: . registry( identity) )
162
162
}
163
163
164
- public static func library( identity: PackageIdentity , path: AbsolutePath ) -> PackageReference {
165
- PackageReference ( identity: identity, kind: . providedLibrary( path) )
164
+ public static func providedLibrary(
165
+ identity: PackageIdentity ,
166
+ origin: SourceControlURL ,
167
+ path: AbsolutePath
168
+ ) -> PackageReference {
169
+ PackageReference ( identity: identity, kind: . providedLibrary( origin, path) )
166
170
}
167
171
}
168
172
@@ -183,6 +187,11 @@ extension PackageReference: Equatable {
183
187
switch ( self . kind, other. kind) {
184
188
case ( . remoteSourceControl( let lurl) , . remoteSourceControl( let rurl) ) :
185
189
return lurl. canonicalURL == rurl. canonicalURL
190
+ case ( . remoteSourceControl( let lurl) , . providedLibrary( let rurl, _) ) ,
191
+ ( . providedLibrary( let lurl, _) , . remoteSourceControl( let rurl) ) :
192
+ return lurl. canonicalURL == rurl. canonicalURL
193
+ case ( . providedLibrary( _, let lpath) , . providedLibrary( _, let rpath) ) :
194
+ return lpath == rpath
186
195
default :
187
196
return true
188
197
}
@@ -237,8 +246,9 @@ extension PackageReference.Kind: Encodable {
237
246
case . registry:
238
247
var unkeyedContainer = container. nestedUnkeyedContainer ( forKey: . registry)
239
248
try unkeyedContainer. encode ( self . isRoot)
240
- case . providedLibrary( let path) :
249
+ case . providedLibrary( let url , let path) :
241
250
var unkeyedContainer = container. nestedUnkeyedContainer ( forKey: . providedLibrary)
251
+ try unkeyedContainer. encode ( url)
242
252
try unkeyedContainer. encode ( path)
243
253
}
244
254
}
0 commit comments