diff --git a/Package.resolved b/Package.resolved index b4ca42d7..64056eaf 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "11c91097a7d3815aa19aa8bdc65446d1e51f2b556e7afb8fdff27ce1384ed4b6", + "originHash" : "e00b9b258083e5d180326ee4f3fedbcfea7db4ae854a2bf6745abd5db9a73971", "pins" : [ { "identity" : "aexml", @@ -24,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tuist/Command.git", "state" : { - "revision" : "07846291097a593de29846c0083b758471071cdf", - "version" : "0.12.2" + "revision" : "079a7803b581d3022469b3a331bccd51d48d2fc0", + "version" : "0.13.0" } }, { diff --git a/Sources/XcodeGraphMapper/Mappers/Phases/PBXCopyFilesBuildPhaseMapper.swift b/Sources/XcodeGraphMapper/Mappers/Phases/PBXCopyFilesBuildPhaseMapper.swift index c5e281a7..4074dac4 100644 --- a/Sources/XcodeGraphMapper/Mappers/Phases/PBXCopyFilesBuildPhaseMapper.swift +++ b/Sources/XcodeGraphMapper/Mappers/Phases/PBXCopyFilesBuildPhaseMapper.swift @@ -65,7 +65,7 @@ struct PBXCopyFilesBuildPhaseMapper: PBXCopyFilesBuildPhaseMapping { return .file(path: absolutePath, condition: nil, codeSignOnCopy: codeSignOnCopy) } .sorted { $0.path < $1.path } - let groupsFiles = fileSystemSynchronizedGroupsFiles( + let groupsFiles = try fileSystemSynchronizedGroupsFiles( phase, fileSystemSynchronizedGroups: fileSystemSynchronizedGroups, xcodeProj: xcodeProj @@ -83,17 +83,17 @@ struct PBXCopyFilesBuildPhaseMapper: PBXCopyFilesBuildPhaseMapping { _ phase: PBXCopyFilesBuildPhase, fileSystemSynchronizedGroups: [PBXFileSystemSynchronizedRootGroup], xcodeProj: XcodeProj - ) -> [CopyFileElement] { + ) throws -> [CopyFileElement] { var files: [CopyFileElement] = [] for fileSystemSynchronizedGroup in fileSystemSynchronizedGroups { if let path = fileSystemSynchronizedGroup.path { let buildPhaseExceptions = fileSystemSynchronizedGroup.exceptions? .compactMap { $0 as? PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet } .filter { $0.buildPhase == phase } ?? [] - let groupFiles = buildPhaseExceptions.compactMap { - $0.membershipExceptions?.map { + let groupFiles = try buildPhaseExceptions.compactMap { + try $0.membershipExceptions?.map { return CopyFileElement.file( - path: xcodeProj.srcPath.appending(component: path).appending(RelativePath($0)), + path: xcodeProj.srcPath.appending(component: path).appending(try RelativePath(validating: $0)), condition: nil, codeSignOnCopy: true ) diff --git a/Sources/XcodeGraphMapper/Mappers/Phases/PBXFrameworksBuildPhaseMapper.swift b/Sources/XcodeGraphMapper/Mappers/Phases/PBXFrameworksBuildPhaseMapper.swift index ca902961..fbc24a6f 100644 --- a/Sources/XcodeGraphMapper/Mappers/Phases/PBXFrameworksBuildPhaseMapper.swift +++ b/Sources/XcodeGraphMapper/Mappers/Phases/PBXFrameworksBuildPhaseMapper.swift @@ -57,7 +57,12 @@ struct PBXFrameworksBuildPhaseMapper: PBXFrameworksBuildPhaseMapping { condition: nil ) } - let fileRef = try buildFile.file.throwing(PBXFrameworksBuildPhaseMappingError.missingFileReference) + let fileRef = try buildFile.file.throwing( + PBXFrameworksBuildPhaseMappingError.missingFileReference( + buildFile.uuid, + xcodeProj.projectPath.appending(component: "project.pbxproj") + ) + ) if let path = fileRef.path { let name = path.replacingOccurrences(of: ".framework", with: "") let linkingStatus: LinkingStatus = (buildFile.settings?["ATTRIBUTES"] as? [String])? @@ -98,16 +103,16 @@ struct PBXFrameworksBuildPhaseMapper: PBXFrameworksBuildPhaseMapping { /// Errors that may occur when mapping framework build phase files. enum PBXFrameworksBuildPhaseMappingError: Error, LocalizedError { - case missingFileReference + case missingFileReference(String, AbsolutePath) case missingFilePath(name: String?) var errorDescription: String? { switch self { - case .missingFileReference: - return "Missing `PBXBuildFile.file` reference." + case let .missingFileReference(buildFileUUID, pbxprojPath): + return "Missing 'PBXBuildFile.file' reference for \(buildFileUUID) id. Make sure an element with that id is present in the \(pbxprojPath.pathString) file." case let .missingFilePath(name): let fileName = name ?? "Unknown" - return "Missing or invalid file path for `PBXBuildFile`: \(fileName)." + return "Missing or invalid file path for 'PBXBuildFile': \(fileName)." } } } diff --git a/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift b/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift index 4b6a2825..1d356f7a 100644 --- a/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift +++ b/Tests/XcodeGraphMapperTests/MapperTests/Graph/XcodeGraphMapperTests.swift @@ -285,7 +285,7 @@ struct XcodeGraphMapperTests { pbxProj: pbxProj ) - let appTarget = try PBXNativeTarget.test( + try PBXNativeTarget.test( name: "App", buildConfigurationList: configurationList, buildPhases: [],