Hive Hive
Sign in

fix(cli): copy module maps with cp -f so CAS-cached builds can overwrite read-only outputs

GitHub issue · Closed

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

What changed

The Copy Module Map script phase that ModuleMapMapper appends to framework targets now copies with cp -f instead of plain cp.

Why / root cause

With Xcode compilation caching enabled (COMPILATION_CACHE_ENABLE_CACHING=YES), build outputs are materialized from the CAS as read-only files. Plain cp refuses to overwrite a read-only destination, so the phase failed with:

cp: .../Build/Products/Debug-iphonesimulator/_AtomicsShims.framework/Modules/module.modulemap: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code

Any generated project with SPM dependencies that carry custom module maps (Objective-C packages, swift-atomics’ shims, etc.) cannot build under xcode-cache today; the same build succeeds with caching disabled, which is what isolated this phase. cp -f removes the unwritable destination and recreates it, which is the intended semantics of this copy.

Impact

Unblocks Xcode compilation cache adoption for generated projects with module-map-carrying SPM dependencies. No behavior change for non-cached builds.

Validation

  • Found and reproduced on a staging runner benchmarking the Mastodon fixture: build green with caching off, red with caching on, green again with the copy patched to cp -f.
  • TuistGenerator builds via SwiftPM; swiftformat clean; the mapper unit test’s expected script updated to match.

🤖 Generated with Claude Code

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