Filter out duplicate file references from sources build phase

This commit is contained in:
Alvar Hansen
2018-01-03 13:08:04 +02:00
parent 64d635096b
commit fc9bb5f4e0
2 changed files with 30 additions and 0 deletions
@@ -408,6 +408,11 @@ public class PBXProjGenerator {
func getBuildFilesForPhase(_ buildPhase: BuildPhase) -> [String] {
let files = sourceFiles
.filter { $0.buildPhase == buildPhase }
.reduce(into: [SourceFile]()) { (output, sourceFile) in
if !output.contains(where: { $0.fileReference == sourceFile.fileReference }) {
output.append(sourceFile)
}
}
.sorted { $0.path.lastComponent < $1.path.lastComponent }
files.forEach { addObject($0.buildFile) }
return files.map { $0.buildFile.reference }