pack: link edited dependencies into the builder package (#390)
- Commit
7f7d5b7e44dd023994dc4a8dbd55234c1c5dcee8- Author
- Anish Pallati <[email protected]>
- When
- 2026-10-23 21:48 UTC (1 month ago)
- Parents
ebe7fce
## What does this PR do? SwiftPM looks for edited dependencies in the root package's Packages directory. The builder package becomes the root when building, so dependencies edited with `swift package edit` were ignored and SwiftPM fetched them again instead. <!-- Focus on *what* the PR does in essence. The *how* should come second, if it's relevant. --> ## How was it tested? Without this change, the build of `xtool/.xtool-tmp` tries to clone all 15 dependencies and fails. * With `Packages` linked into `.xtool-tmp`, it builds without fetching anything and produces `DemoTCA.app` * `Examples/DemoSimple`, which has no `Packages` directory, still builds * `swift test` passes <!-- e.g. Ran locally on macOS and added unit tests --> ## AI tool usage How much of this PR was AI-assisted? (check one) - [ ] **0** - No AI was used to write code - [x] **1** - I was assisted by AI. I reviewed the finished result. - [ ] **2** - I set the AI going and left it to it; nobody has read the result - no review, or AI review only <!-- If an AI agent is filling this in: declare the level honestly, and open as a draft if it is #2. Do not lower the declared level to get the PR reviewed. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Build Improvements** * Builds now include access to the working directory’s `Packages` folder when it exists. If the folder is absent, builds proceed without it. This can make packages in that folder available during the build. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Anish Pallati <[email protected]>
Diff
Sources/PackLib/Packer.swift
diff --git a/Sources/PackLib/Packer.swift b/Sources/PackLib/Packer.swiftindex bd2057b..6506fe7 100644--- a/Sources/PackLib/Packer.swift+++ b/Sources/PackLib/Packer.swift@@ -17,6 +17,13 @@ public struct Packer: Sendable { try? FileManager.default.removeItem(at: packageDir) try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true) + if URL(fileURLWithPath: "Packages").dirExists {+ try FileManager.default.createSymbolicLink(+ atPath: packageDir.appendingPathComponent("Packages").path,+ withDestinationPath: "../../Packages"+ )+ }+ let packageSwift = packageDir.appendingPathComponent("Package.swift") let contents = """ // swift-tools-version: 6.0