ci: build cmuxTests without emitting its Swift module
After #14349, a one-test-file edit still cost cmuxTests 31 s, and 26 s of that was its own SwiftEmitModule job, running serially on the critical path. Nothing imports cmuxTests.swiftmodule. CI now builds cmuxTests without emitting a module, and the same edit takes 4.1 s.
Change
scripts/ci/compile-app-host-test-product.shbuildscmuxTestswith the standalone Swift driver (SWIFT_USE_INTEGRATED_DRIVER=NO) and-no-emit-module-separately. Xcode's integrated driver always appends-experimental-emit-module-separately, so the standalone driver is the only way to pass the flag. With it, a non-WMO build plans no emit-module job, and current swift-driver has no merge-modules job to fall back on, so no module is written. Both settings are per target ($(X_$(TARGET_NAME)):default=...), so the app and every package keep their arguments.cmux.xcodeprojsetsSWIFT_OBJC_INTERFACE_HEADER_NAME = ""forcmuxTests. The generatedcmuxTests-Swift.hcomes from the module job and nothing includes it. Without this setting, the no-module build fails inSwiftMergeGeneratedHeaders(ENOENT). Local builds also stop generating the header. They keep the integrated driver and still emit the module.
Where the 26 s went
With -stats-output-dir -fine-grained-timers (canary #14352, run 36087174643; the timers roughly double the job's wall time), the emit-module job was 85% type checking. The largest slices were declaration checking, ExpandPeerMacroRequest (7,893 @Test macros), stored-property initializer expressions, and name lookup across the imported modules. Serialization was 1.3 s. Trimming the job's other outputs did not help: without the ObjC header, with -empty-abi-descriptor, or with -avoid-emit-module-source-info, it stayed at 50 to 54 s against 48 s for the control. -experimental-lazy-typecheck saved about 1 s.
Measurements
Canary #14352, run 36089490735, blacksmith-12vcpu-macos-26, Xcode 26.6 (Swift 6.3.3). Rows are cmux-unit rebuilds on the admission's DerivedData, without stats flags.
| cmuxTests mode | one-test-file edit, cmuxTests | same edit, whole rebuild | full cmuxTests rebuild |
|---|---|---|---|
| main (#14349) | 31.6 to 35.3 s | 47 to 55 s | 137 s |
| this PR | 4.1 s | 19 s | 105 s |
| standalone driver, module still emitted | 36 s | 51 s | 93 s |
| lazy typecheck | 31 s | 45 s | 86 s |
The third row shows the gain comes from dropping the module, not from the driver switch. The built bundle is unchanged where tests are concerned: the same 11,758 enumerated tests, the same __swift5_tests section size (0x44140), and the same 332 ObjC test classes. The full-rebuild column is noisy (each series' first build also re-planned other targets), so it shows only that the full rebuild did not get worse.
What this does not change
- Adding a top-level declaration in the app still recompiles every
cmuxTestsfile (see #14349). That rebuild no longer waits on the module job. - The first admissions after this lands rebuild
cmuxTestsonce, because its arguments changed. The seeds pick up the new arguments on their next build through this script. - No
cmuxTests.swiftmodulein CI DerivedData. CI never debugs the test bundle. app-host-test-rerun.ymlcompiles-target cmuxTestswithout these settings, so it keeps the integrated driver and emits the module. It already differs from admission (no cache setting, pruned source list), so it was not reusing admission's cmuxTests objects before this change either.- The canary did not measure a null rebuild. If Xcode still expects a module output from the standalone driver task, a null build would rerun the driver planning (about 3.5 s) and the link, not any compiles.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Chores
- Updated automated app-host test builds to compile without producing a separate Swift module for the test target. Build checks now verify the updated configuration, while retaining the existing compilation-cache behavior. These changes affect CI and test builds only; no user-facing app functionality or behavior has changed.