         var buildPhases: [String] = []
 
         func getBuildFilesForPhase(_ buildPhase: BuildPhase) -> [String] {
-            let files = sourceFilePaths.filter { getBuildPhaseForPath($0) == buildPhase }.map(generateSourceFile)
+            let files = sourceFiles.filter { getBuildPhaseForPath($0.path) == buildPhase }
+            files.forEach { addObject($0.buildFile) }
             return files.map { $0.buildFile.reference }
         }
 


    var fileReferencesByPath: [Path: String] = [:]
    var groupsByPath: [Path: PBXGroup] = [:]

    var targetNativeReferences: [String: String] = [:]
    var targetBuildFileReferences: [String: String] = [:]

            settings = ["ATTRIBUTES": ["Public"]]
        }
        let buildFile = PBXBuildFile(reference: generateUUID(PBXBuildFile.self, fileReference), fileRef: fileReference, settings: settings)
        return SourceFile(path: path, fileReference: fileReference, buildFile: buildFile)
    }

