From a17b41a7d579757d33d266378d6ccbb239ab2dfd Mon Sep 17 00:00:00 2001 From: giginet Date: Wed, 10 Jul 2024 18:45:03 +0900 Subject: [PATCH] Use OrderedSet for resolving products --- Sources/ScipioKit/DescriptionPackage.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/ScipioKit/DescriptionPackage.swift b/Sources/ScipioKit/DescriptionPackage.swift index 4cc62c25..305e6b92 100644 --- a/Sources/ScipioKit/DescriptionPackage.swift +++ b/Sources/ScipioKit/DescriptionPackage.swift @@ -149,7 +149,7 @@ struct DescriptionPackage { } extension DescriptionPackage { - func resolveBuildProducts() throws -> [BuildProduct] { + func resolveBuildProducts() throws -> OrderedSet { let targetsToBuild = try targetsToBuild() var products = try targetsToBuild.flatMap(resolveBuildProduct(from:)) @@ -186,7 +186,7 @@ extension DescriptionPackage { } } - return products.reversed() + return OrderedSet(products.reversed()) } private func targetsToBuild() throws -> [ScipioResolvedModule] { @@ -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`