parallelizeBuildables flag can result in failed builds

My app SolarWatch has two framework targets, SolarKit for iOS and SolarKitWatch for watchOS. For the iOS app both the app and widget extension depend on SolarKit. For the watchOS app only the watch app extension used to depend of SolarKitWatch. Everything used to build fine.

Today I added a widget extension for watchOS which depends on SolarKitWatch. This resulted in builds starting to fail because watch widget extension was unable to find SolarKitWatch-Swift.h during SwiftEmitModule step, using Xcode 14 beta 6 (14A5294g)

According to the build timeline this failure is happening after the Planning target SolarKitWatch steps for both arm64 and arm64_32 architectures. But it seems like the SolarKitWatch-Swift.h has not been created at that step yet.

One workaround is to manually build the SolarKitWatch target before building the whole app but this only works for debug builds and not archive builds.

I spent half a day trying to figure this out but nothing worked except turning off parallelizeBuildables and buildImplicitDependencies.

Is there a setting which I can use to enforce a build order besides turning off all parallelization?

Answered by ekurutepe in 726238022

After many attempts trying to figure out what was going on, I was able to resolve this by modernizing the project structure:

  • Getting rid of the two single platform targets building the SolarKit framework in favor of splitting the SolarKit framework into two multi-platform frameworks which build on top of each other: CoreSolarKit for the basic functionality with watchOS support and ExtendedSolarKit which does not support watchOS.
  • Converting the watch app target to a single watch app instead of old fashioned app+extension.
  • Ensuring all target dependencies are explicit and that the app targets correctly bundle the correct non-system frameworks.

I hope this helps somebody.

Accepted Answer

After many attempts trying to figure out what was going on, I was able to resolve this by modernizing the project structure:

  • Getting rid of the two single platform targets building the SolarKit framework in favor of splitting the SolarKit framework into two multi-platform frameworks which build on top of each other: CoreSolarKit for the basic functionality with watchOS support and ExtendedSolarKit which does not support watchOS.
  • Converting the watch app target to a single watch app instead of old fashioned app+extension.
  • Ensuring all target dependencies are explicit and that the app targets correctly bundle the correct non-system frameworks.

I hope this helps somebody.

parallelizeBuildables flag can result in failed builds
 
 
Q