Hive
fix(cli): restore SwifterPM package submodules
GitHub issue · Closed
What changed
- Initialize Git submodules when SwifterPM falls back to a shallow Git checkout.
- Treat cached source checkouts with missing submodule contents as stale instead of accepting them just because
Package.swiftexists. - Add regression coverage for packages whose target sources live inside a required submodule, modeled after
libwebp-Xcode.
Why
A reported SwifterPM install generated a checkout for SDWebImage/libwebp-Xcode 1.3.1, but Tuist graph loading later failed with invalid source globs for libwebp/src/** and libwebp/sharpyuv/**.
The upstream package declares those source folders in Package.swift, while the actual folders live inside the libwebp Git submodule. SwifterPM correctly rejected GitHub source archives for repositories with .gitmodules and fell back to Git, but the fallback checkout did not initialize submodules. The cache then considered that incomplete checkout valid because the manifest file existed, so retries after tuist clean could keep reusing the bad cached source.
Impact
SwifterPM restores source-control packages with required submodules fully enough for Tuist to map package target sources. Existing incomplete cache entries are refreshed automatically the next time the package is restored.
Validation
All validation was run from the clean PR worktree based on origin/main:
git diff --check- Confirmed the final patch has no whitespace errors.
swift test --replace-scm-with-registry --filter RestoreTests- Built SwifterPM from the PR branch.
- Ran the focused
RestoreTestssuite. - Passed 13 tests, including the new coverage for initializing required Git submodules and refreshing stale cached sources with missing submodule contents.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.