Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/XcodeGraphMapper/Mappers/Graph/XcodeGraphMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public struct XcodeGraphMapper: XcodeGraphMapping {
let xcodeProj = try XcodeProj(pathString: path.pathString)
let projectMapper = PBXProjectMapper()
let project = try await projectMapper.map(xcodeProj: xcodeProj)
projects[path] = project
projects[path.parentDirectory] = project
}

return projects
Expand Down Expand Up @@ -209,7 +209,7 @@ public struct XcodeGraphMapper: XcodeGraphMapping {

for (path, project) in projects {
for (name, target) in project.targets {
let sourceDependency = GraphDependency.target(name: name, path: path.parentDirectory)
let sourceDependency = GraphDependency.target(name: name, path: path)

// Build edges for each target dependency
let edgesAndDeps = try await target.dependencies.serialCompactMap { (dep: TargetDependency) async throws -> (
Expand All @@ -218,7 +218,7 @@ public struct XcodeGraphMapper: XcodeGraphMapping {
GraphDependency
) in
let graphDep = try await dep.graphDependency(
sourceDirectory: path.parentDirectory,
sourceDirectory: path,
allTargetsMap: allTargetsMap,
target: target
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ struct XCSchemeMapper: SchemeMapping {
let relPath = try RelativePath(validating: relativeContainerPath)
projectPath = xcworkspace.workspacePath.parentDirectory.appending(relPath)
case let .project(xcodeProj):
projectPath = xcodeProj.projectPath
projectPath = xcodeProj.projectPath.parentDirectory
}

return TargetReference(projectPath: projectPath, name: targetName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ struct XcodeGraphMapperTests {

// When
let graph = try await mapper.buildGraph(from: .workspace(xcworkspace))
print(projectA.path!)

// Then
#expect(graph.workspace.name == "Workspace")
#expect(graph.workspace.projects.contains(projectA.projectPath) == true)
#expect(graph.workspace.projects.contains(projectB.projectPath) == true)
#expect(graph.projects.count == 2)

let mappedProjectA = try #require(graph.projects[projectA.projectPath])
let mappedProjectB = try #require(graph.projects[projectB.projectPath])
let mappedProjectA = try #require(graph.projects[projectA.projectPath.parentDirectory])
let mappedProjectB = try #require(graph.projects[projectB.projectPath.parentDirectory])
#expect(mappedProjectA.targets["ATarget"] != nil)
#expect(mappedProjectB.targets["BTarget"] != nil)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ struct XCSchemeMapperTests {
// Then
#expect(mappedAction.targets.count == 1)
#expect(mappedAction.targets[0].name == "App")
#expect(mappedAction.targets[0].projectPath == xcodeProj.projectPath)
#expect(mappedAction.targets[0].projectPath == xcodeProj.projectPath.parentDirectory)
}

@Test("Handles schemes without any actions gracefully")
Expand Down