From cee115bc6784ceb8c28b80e4ef1fa1b29b9c190f Mon Sep 17 00:00:00 2001 From: Michael Gerasymenko Date: Thu, 10 Jul 2025 17:56:20 +0200 Subject: [PATCH] Resilience: figure out the workspace path automatically --- Sources/DependencyCalculator/DependencyGraph.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/DependencyCalculator/DependencyGraph.swift b/Sources/DependencyCalculator/DependencyGraph.swift index e50c93e..ff76c36 100644 --- a/Sources/DependencyCalculator/DependencyGraph.swift +++ b/Sources/DependencyCalculator/DependencyGraph.swift @@ -88,10 +88,18 @@ extension WorkspaceInfo { } } - public static func parseWorkspace(at path: Path, + public static func parseWorkspace(at proposedPath: Path, config: WorkspaceInfo.AdditionalConfig? = nil, exclude: [String]) throws -> WorkspaceInfo { + var path = proposedPath + + if path.extension != "xcworkspace" && path.extension != "xcodeproj" { + if let altPath = path.glob("*.xcworkspace").first ?? path.glob("*.xcodeproj").first { + path = altPath + } + } + let includeRootPackage = try shouldIncludeRootPackage(at: path) var (packageWorkspaceInfo, packages) = try parsePackages(in: path, includeRootPackage: includeRootPackage, exclude: exclude) @@ -102,6 +110,7 @@ extension WorkspaceInfo { let allProjects: [(XcodeProj, Path)] var workspaceDefinitionPath: Path? = nil + if path.extension == "xcworkspace" { let workspace = try XCWorkspace(path: path)