From 8de02da33ed4b8ebdf578c70da4009670d667444 Mon Sep 17 00:00:00 2001 From: gsdali <51393997+gsdali@users.noreply.github.com> Date: Wed, 1 Jul 2026 22:15:14 +0900 Subject: [PATCH] fix(deps): guard sibling-path detection against SwiftPM's own checkout layout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit occtDep's sibling probe (..//Package.swift) is filesystem-based and fires whenever a same-named directory happens to exist next to this manifest — including when THIS manifest is itself a transitively-resolved SwiftPM checkout under a consumer's .build/checkouts/, where SwiftPM lays every dependency out as a flat sibling. Once a sibling checkout exists (a side effect of resolving it), ../ spuriously matches, flipping this manifest's own dependency declaration from url to path mid-resolution -- SwiftPM then reports the whole graph unresolvable for any lean consumer. Root-caused + verified via OCCTSwiftScripts#69/#70; matches the guard OCCTSwiftIO already adopted 2026-06-23. Co-Authored-By: Claude Opus 4.8 (1M context) --- Package.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index a9e4b3c..d68fdf0 100644 --- a/Package.swift +++ b/Package.swift @@ -7,9 +7,13 @@ import Foundation // OCCT ecosystem SHARES the single OCCTSwift/Libraries/OCCT.xcframework instead of each repo // extracting its own 1.3 GB copy. CI / fresh clones (no sibling) use the URL pin. `#filePath`-relative // so it's independent of build CWD. +// Guarded against SwiftPM's own checkout layout: a transitively-resolved checkout under a +// consumer's .build/ must never be treated as a local dev sibling (ecosystem issue +// OCCTSwiftScripts#69 / #70). func occtDep(_ name: String, from version: String) -> Package.Dependency { let manifestDir = URL(fileURLWithPath: #filePath).deletingLastPathComponent().path - if FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { + if !manifestDir.contains("/.build/"), + FileManager.default.fileExists(atPath: manifestDir + "/../\(name)/Package.swift") { return .package(path: "../\(name)") } return .package(url: "https://github.com/SecondMouseAU/\(name).git", from: Version(version)!)