Hive Hive
Sign in

fix(cli): restore SwifterPM package submodules

GitHub issue · Closed

Metadata
Source
tuist/tuist #11553
Updated
Jul 5, 2026
Domains
Generated projects
Details

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.swift exists.
  • 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:

  1. git diff --check
    • Confirmed the final patch has no whitespace errors.
  2. swift test --replace-scm-with-registry --filter RestoreTests
    • Built SwifterPM from the PR branch.
    • Ran the focused RestoreTests suite.
    • Passed 13 tests, including the new coverage for initializing required Git submodules and refreshing stale cached sources with missing submodule contents.
Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments

No GitHub comments yet.