-
Notifications
You must be signed in to change notification settings - Fork 217
Description
FB11020478 - Xcode 14 incremental builds are all serial(expecting parallel wherever applicable)
We have enclosed the Xcode project("SerialReproducer.zip") and a video("Xcode14-repro.mov") demonstrating the issue in this ticket. (Repro1 as well as Repro 2).
Attachments:
Setup:
The Xcode project was created from the latest Xcode Version 14.0.
In the reproducer, there are 5 libraries - LibA, LibB, LibC, LibD, LibE.
Scenario:
- LibA, LibB, LibC, LibD → all depend on LibE.
- This means if there are changes in LibE, it should trigger a recompilation of files in LibA, LibB, LibC, LibD targets.
- Since LibA, LibB, LibC, LibD targets are disjoint from each other, they should compile in parallel.
Repro1: Repro to get all serial incremental builds:
- Select the scheme: "All".
- Do a clean build. Notice LibA-LibD targets are compiled in parallel.
- Now, make any changes in "LibE.swift". It can be adding a new class or struct, any meaningful change inside Xcode.
- Build the Scheme "All".
- Notice that targets: LibA, LibB, LibC, LibD follow a serial compilation sequence. Ideally, LibA-LibD should compile in parallel in the same way as they were compiled in the Clean Build case.
- Make any change in LibE.swift and you will always see serial incremental builds for all successive changes/invocations.
But this is not always the case. The new build system in Xcode 14 does give parallel builds under a very special edge-case.
Repro2: Repro to get parallel builds:
- Follow the steps in "Repro1" to setup the initial state.
- Now make a change in LibA.swift, LibB.swift, LibC.swift, LibD.swift, LibE.swift.(it can be commenting out code, adding a new class etc) Notice: we have made changes to all the files that are a part of the compilation sequence.
- Now build the scheme: "All".
- Notice that the parallel incremental builds are back. We can see from the Xcode's assistant build timeline that LibA, LibB, LibC, LibD are being compiled in parallel.
- Now, make any change just in "LibE.swift". It can be adding a new class, anything.
- Build the scheme and notice that LibA-LibD are compiled in parallel.
- We now get parallel builds for all the successive changes in LibE.swift.
- This initially in Repro 1 was only giving serial builds for the exact same change. Maybe there is a state that is missing in the initial incremental build and that's why it's all serial.
For any medium to large projects, not getting parallel incremental builds brings a significant regression that will be affecting the developer experience. Can the fix be prioritized and are there any workarounds that we can explore till the fix lands in an Xcode 14 release?