Xcode Build Tuner
Before invoking Apple-only binaries, confirm the execution context is macOS. From Windows or Linux, run those steps in a Mac SSH project or through an already configured remote transport; do not retry missing Apple binaries locally.
Bundled commands use $PLUGIN_ROOT for the plugin root. Use the host's plugin-root variable when defined; otherwise set it to the absolute path of this plugin before running a helper from the app repository.
Implement only approved build optimization changes, verify compilation, and prove the result with the same benchmark contract.
Rules
- Require either checked items in
.build-benchmark/optimization-plan.md or an explicit user instruction.
- Apply one logical fix at a time; keep edits reviewable and reversible.
- Re-benchmark after changes and report wall-clock deltas.
- If a speculative change regresses or shows no useful benefit, flag it and recommend revert when appropriate.
- Do not revert recommended build settings only because one noisy benchmark failed to improve.
Fix Types
- Build settings:
DEBUG_INFORMATION_FORMAT=dwarf for Debug, SWIFT_COMPILATION_MODE=singlefile, COMPILATION_CACHE_ENABLE_CACHING=YES, EAGER_LINKING=YES, SWIFT_USE_INTEGRATED_DRIVER=YES, ONLY_ACTIVE_ARCH=YES, and cross-target setting alignment. Verify with xcodebuild -showBuildSettings.
- Script phases: declare inputs/outputs, add configuration guards, move long lists to
.xcfilelist, and enable dependency analysis when possible.
- Source compilation: add types, break generic/chained expressions, mark non-subclassed classes
final, tighten access control, extract huge SwiftUI builders, and add explicit closure return types. Read references/fix-patterns.md for examples.
- SwiftPM graph: split oversized modules, remove upward/circular dependencies, extract interface modules, remove unnecessary
@_exported import, align options, and pin branch dependencies to tags or revisions. Confirm tags with git ls-remote --tags; verify with xcodebuild -resolvePackageDependencies.
Workflow
- Read the approved plan or user instruction.
- Identify exact files/settings for each approved item.
- Apply the change.
- Run a quick build to catch compiler/linker errors.
- Re-run the original baseline command, usually:
python3 "$PLUGIN_ROOT/shared/build-optimization/scripts/benchmark_builds.py" \
--project App.xcodeproj --scheme MyApp --configuration Debug \
--destination "platform=iOS Simulator,name=<latest available iPhone simulator>,OS=latest" \
--output-dir .build-benchmark
- Compare clean, cached clean when present, and incremental medians.
Regression Policy
- Evaluate wall-clock time first; cumulative task time is supporting evidence.
- A slower standard clean build can still be acceptable when cached clean or incremental builds improve.
- Keep best-practice settings even without immediate measurable improvement; they align with current Xcode direction and may compound later.
- For speculative source/script/graph changes, recommend revert if all measured build types regress or if there is no median/cached/incremental benefit.
- Distinguish "outlier reduction only" from true median improvement.
Report
Lead with plain wall-clock impact:
Clean build: X.Xs (was Y.Ys) - Z.Zs faster/slower.
Incremental build: X.Xs (was Y.Ys) - Z.Zs faster/slower.
Then include files changed, status per fix (Kept, Kept (best practice), Reverted, Blocked, No improvement), confidence/noise notes, and any deviation from the approved plan. If task work decreased but wall-clock did not, say that parallel Xcode work hid the improvement.
References
references/fix-patterns.md
../../shared/build-optimization/references/build-settings-best-practices.md
../../shared/build-optimization/references/recommendation-format.md
1---2name: xcode-build-tuner3description: Implement approved Xcode build-speed fixes after strategist approval or explicit requests covering build settings, script phases, Swift compilation, or SwiftPM graphs; re-benchmark results.4---56# Xcode Build Tuner78Before invoking Apple-only binaries, confirm the execution context is macOS. From Windows or Linux, run those steps in a Mac SSH project or through an already configured remote transport; do not retry missing Apple binaries locally.910Bundled commands use `$PLUGIN_ROOT` for the plugin root. Use the host's plugin-root variable when defined; otherwise set it to the absolute path of this plugin before running a helper from the app repository.1112Implement only approved build optimization changes, verify compilation, and prove the result with the same benchmark contract.1314## Rules1516- Require either checked items in `.build-benchmark/optimization-plan.md` or an explicit user instruction.17- Apply one logical fix at a time; keep edits reviewable and reversible.18- Re-benchmark after changes and report wall-clock deltas.19- If a speculative change regresses or shows no useful benefit, flag it and recommend revert when appropriate.20- Do not revert recommended build settings only because one noisy benchmark failed to improve.2122## Fix Types2324- Build settings: `DEBUG_INFORMATION_FORMAT=dwarf` for Debug, `SWIFT_COMPILATION_MODE=singlefile`, `COMPILATION_CACHE_ENABLE_CACHING=YES`, `EAGER_LINKING=YES`, `SWIFT_USE_INTEGRATED_DRIVER=YES`, `ONLY_ACTIVE_ARCH=YES`, and cross-target setting alignment. Verify with `xcodebuild -showBuildSettings`.25- Script phases: declare inputs/outputs, add configuration guards, move long lists to `.xcfilelist`, and enable dependency analysis when possible.26- Source compilation: add types, break generic/chained expressions, mark non-subclassed classes `final`, tighten access control, extract huge SwiftUI builders, and add explicit closure return types. Read `references/fix-patterns.md` for examples.27- SwiftPM graph: split oversized modules, remove upward/circular dependencies, extract interface modules, remove unnecessary `@_exported import`, align options, and pin branch dependencies to tags or revisions. Confirm tags with `git ls-remote --tags`; verify with `xcodebuild -resolvePackageDependencies`.2829## Workflow30311. Read the approved plan or user instruction.322. Identify exact files/settings for each approved item.333. Apply the change.344. Run a quick build to catch compiler/linker errors.355. Re-run the original baseline command, usually:36 ```bash37 python3 "$PLUGIN_ROOT/shared/build-optimization/scripts/benchmark_builds.py" \38 --project App.xcodeproj --scheme MyApp --configuration Debug \39 --destination "platform=iOS Simulator,name=<latest available iPhone simulator>,OS=latest" \40 --output-dir .build-benchmark41 ```426. Compare clean, cached clean when present, and incremental medians.4344## Regression Policy4546- Evaluate wall-clock time first; cumulative task time is supporting evidence.47- A slower standard clean build can still be acceptable when cached clean or incremental builds improve.48- Keep best-practice settings even without immediate measurable improvement; they align with current Xcode direction and may compound later.49- For speculative source/script/graph changes, recommend revert if all measured build types regress or if there is no median/cached/incremental benefit.50- Distinguish "outlier reduction only" from true median improvement.5152## Report5354Lead with plain wall-clock impact:5556```text57Clean build: X.Xs (was Y.Ys) - Z.Zs faster/slower.58Incremental build: X.Xs (was Y.Ys) - Z.Zs faster/slower.59```6061Then include files changed, status per fix (`Kept`, `Kept (best practice)`, `Reverted`, `Blocked`, `No improvement`), confidence/noise notes, and any deviation from the approved plan. If task work decreased but wall-clock did not, say that parallel Xcode work hid the improvement.6263## References6465- `references/fix-patterns.md`66- `../../shared/build-optimization/references/build-settings-best-practices.md`67- `../../shared/build-optimization/references/recommendation-format.md`