Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicated carthage file references #107

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 4 additions & 7 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>] = [:]
var frameworkFiles: [String] = []

var uuids: Set<String> = []
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down