Skip to content

Commit

Permalink
Use OrderedSet for resolving products
Browse files Browse the repository at this point in the history
  • Loading branch information
giginet committed Jul 10, 2024
1 parent 49e534d commit a17b41a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Sources/ScipioKit/DescriptionPackage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct DescriptionPackage {
}

extension DescriptionPackage {
func resolveBuildProducts() throws -> [BuildProduct] {
func resolveBuildProducts() throws -> OrderedSet<BuildProduct> {
let targetsToBuild = try targetsToBuild()
var products = try targetsToBuild.flatMap(resolveBuildProduct(from:))

Expand Down Expand Up @@ -186,7 +186,7 @@ extension DescriptionPackage {
}
}

return products.reversed()
return OrderedSet(products.reversed())
}

private func targetsToBuild() throws -> [ScipioResolvedModule] {
Expand Down Expand Up @@ -267,6 +267,11 @@ struct BuildProduct: Hashable, Sendable {
target.underlying as? ScipioBinaryModule
}

static func == (lhs: Self, rhs: Self) -> Bool {
lhs.target.name == rhs.target.name &&
lhs.package.identity == rhs.package.identity
}

func hash(into hasher: inout Hasher) {
// Important: Relevant for swift-6.0+ toolchain versions. For the versions below
// this change has no effect as SwiftPM provides its own proper `Hashable`
Expand Down

0 comments on commit a17b41a

Please sign in to comment.