Skip to content

Commit

Permalink
Fix package info filtering when it needs to ignore macCatalyst (tuist…
Browse files Browse the repository at this point in the history
  • Loading branch information
DevYeom committed Aug 24, 2022
1 parent bdf582c commit 19fba5e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public final class SwiftPackageManagerGraphGenerator: SwiftPackageManagerGraphGe
let packageInfos: [
(id: String, name: String, folder: AbsolutePath, targetToArtifactPaths: [String: AbsolutePath], info: PackageInfo)
]

// Platforms include only iOS
let shouldIgnoreMacCatalyst = platforms.subtracting([.iOS]).isEmpty

packageInfos = try workspaceState.object.dependencies.map(context: .concurrent) { dependency in
let name = dependency.packageRef.name
let packageFolder: AbsolutePath
Expand All @@ -102,7 +106,19 @@ public final class SwiftPackageManagerGraphGenerator: SwiftPackageManagerGraphGe
throw SwiftPackageManagerGraphGeneratorError.unsupportedDependencyKind(dependency.packageRef.kind)
}

let packageInfo = try swiftPackageManagerController.loadPackageInfo(at: packageFolder)
var packageInfo: PackageInfo = try swiftPackageManagerController.loadPackageInfo(at: packageFolder)
if shouldIgnoreMacCatalyst {
let filteredPlatforms = packageInfo.platforms.filter { $0.platformName != "maccatalyst" }
packageInfo = PackageInfo(
products: packageInfo.products,
targets: packageInfo.targets,
platforms: filteredPlatforms,
cLanguageStandard: packageInfo.cLanguageStandard,
cxxLanguageStandard: packageInfo.cxxLanguageStandard,
swiftLanguageVersions: packageInfo.swiftLanguageVersions
)
}

let targetToArtifactPaths = workspaceState.object.artifacts
.filter { $0.packageRef.identity == dependency.packageRef.identity }
.reduce(into: [:]) { result, artifact in
Expand Down

0 comments on commit 19fba5e

Please sign in to comment.