Skip to content

Commit 04b26ea

Browse files
committed
Switch ProvidedLibrary.vesion to produce a Version
1 parent 78c68fe commit 04b26ea

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Sources/PackageGraph/Resolution/PubGrub/PubGrubDependencyResolver.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ public struct PubGrubDependencyResolver {
242242
}
243243

244244
if let library = package.matchingPrebuiltLibrary(in: availableLibraries),
245-
boundVersion == .version(.init(stringLiteral: library.version))
245+
boundVersion == .version(library.version)
246246
{
247247
guard case .remoteSourceControl(let url) = package.kind else {
248248
throw InternalError("Matched provided library against invalid package: \(package)")
@@ -748,11 +748,9 @@ public struct PubGrubDependencyResolver {
748748
continue
749749
}
750750

751-
let version = Version(stringLiteral: library.version)
752-
753-
if pkgTerm.requirement.contains(version) {
754-
self.delegate?.didResolve(term: pkgTerm, version: version, duration: start.distance(to: .now()))
755-
state.decide(pkgTerm.node, at: version)
751+
if pkgTerm.requirement.contains(library.version) {
752+
self.delegate?.didResolve(term: pkgTerm, version: library.version, duration: start.distance(to: .now()))
753+
state.decide(pkgTerm.node, at: library.version)
756754
return completion(.success(pkgTerm.node))
757755
}
758756
}

Sources/PackageModel/InstalledLibrariesSupport/LibraryMetadata.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import Basics
14-
import Foundation
14+
import struct TSCUtility.Version
1515

1616
public struct ProvidedLibrary {
1717
public let location: AbsolutePath
1818
public let metadata: LibraryMetadata
1919

20-
public var version: String {
21-
metadata.version
20+
public var version: Version {
21+
.init(stringLiteral: metadata.version)
2222
}
2323
}
2424

0 commit comments

Comments
 (0)