From 8e95044d553f689f30a57c43aab05c9cac9eb771 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Wed, 25 Oct 2017 21:05:53 +0200 Subject: [PATCH] fix carthage file references from being duplicated --- Sources/XcodeGenKit/PBXProjGenerator.swift | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 98b243056..bfe12c904 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -27,7 +27,7 @@ public class PBXProjGenerator { var targetBuildFiles: [String: PBXBuildFile] = [:] var targetFileReferences: [String: String] = [:] var topLevelGroups: [PBXGroup] = [] - var carthageFrameworksByPlatform: [String: [String]] = [:] + var carthageFrameworksByPlatform: [String: Set] = [:] var frameworkFiles: [String] = [] var uuids: Set = [] @@ -103,11 +103,11 @@ public class PBXProjGenerator { if !carthageFrameworksByPlatform.isEmpty { var platforms: [PBXGroup] = [] for (platform, fileReferences) in carthageFrameworksByPlatform { - let platformGroup = PBXGroup(reference: generateUUID(PBXGroup.self, platform), children: fileReferences, sourceTree: .group, name: platform, path: platform) + let platformGroup = PBXGroup(reference: generateUUID(PBXGroup.self, platform), children: fileReferences.sorted(), sourceTree: .group, name: platform, path: platform) addObject(platformGroup) platforms.append(platformGroup) } - let carthageGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Carthage"), children: platforms.references, sourceTree: .group, name: "Carthage", path: carthageBuildPath) + let carthageGroup = PBXGroup(reference: generateUUID(PBXGroup.self, "Carthage"), children: platforms.references.sorted(), sourceTree: .group, name: "Carthage", path: carthageBuildPath) addObject(carthageGroup) frameworkFiles.append(carthageGroup.reference) } @@ -291,9 +291,6 @@ public class PBXProjGenerator { copyFrameworksReferences.append(embedFile.reference) } case .carthage: - if carthageFrameworksByPlatform[target.platform.carthageDirectoryName] == nil { - carthageFrameworksByPlatform[target.platform.carthageDirectoryName] = [] - } var platformPath = Path(getCarthageBuildPath(platform: target.platform)) var frameworkPath = platformPath + dependency.reference if frameworkPath.extension == nil { @@ -303,7 +300,7 @@ public class PBXProjGenerator { let buildFile = PBXBuildFile(reference: generateUUID(PBXBuildFile.self, fileReference + target.name), fileRef: fileReference) addObject(buildFile) - carthageFrameworksByPlatform[target.platform.carthageDirectoryName]?.append(fileReference) + carthageFrameworksByPlatform[target.platform.carthageDirectoryName, default: []].insert(fileReference) targetFrameworkBuildFiles.append(buildFile.reference) if target.platform == .macOS && target.type.isApp {