Skip to content

Commit 4c3ef33

Browse files
authored
Resilience: figure out the workspace path automatically (#60)
1 parent fdddbfe commit 4c3ef33

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Sources/DependencyCalculator/DependencyGraph.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,18 @@ extension WorkspaceInfo {
8888
}
8989
}
9090

91-
public static func parseWorkspace(at path: Path,
91+
public static func parseWorkspace(at proposedPath: Path,
9292
config: WorkspaceInfo.AdditionalConfig? = nil,
9393
exclude: [String]) throws -> WorkspaceInfo
9494
{
95+
var path = proposedPath
96+
97+
if path.extension != "xcworkspace" && path.extension != "xcodeproj" {
98+
if let altPath = path.glob("*.xcworkspace").first ?? path.glob("*.xcodeproj").first {
99+
path = altPath
100+
}
101+
}
102+
95103
let includeRootPackage = try shouldIncludeRootPackage(at: path)
96104
var (packageWorkspaceInfo, packages) = try parsePackages(in: path, includeRootPackage: includeRootPackage, exclude: exclude)
97105

@@ -102,6 +110,7 @@ extension WorkspaceInfo {
102110

103111
let allProjects: [(XcodeProj, Path)]
104112
var workspaceDefinitionPath: Path? = nil
113+
105114
if path.extension == "xcworkspace" {
106115
let workspace = try XCWorkspace(path: path)
107116

0 commit comments

Comments
 (0)