Xcode 14 beta 2/Xcode cloud fails to build Swift package dependencies that use Swift build tools

I have an Xcode project where I have the following targets being built:

  1. A build tool plugin
  2. A Swift package exporting a library product that depends and uses the said build tool plugin to generate it’s sources
  3. An iOS app target that depends on the Swift package mentioned above

What I’m noticing is that with Xcode 14 beta 2 (and with beta 1) there seems to be some sort of race condition that I can sometimes reproduce locally, and 100% of the time on Xcode cloud, where transitively building the target as a dependency will fail to run the build tool.

The build might succeed but any downstream dependents that were depending on the generated sources will fail to build etc. You can notice it in the build log because of the absence of steps related to the build tool plugin, such as:
“Write Script-asdf.sh”, “Run custom shell script ‘foo’” etc.

If you select the scheme for the library using the build tool manually and build it, it usually completes fine.

I’ve filed a feedback report for it at FB10290725, but this is a blocker for me as it prevents me from using Xcode cloud with project entirely. Is there any known workaround for this?

Hello,

did you get any more information from Apple regarding this? I think I've hit the same bug–Xcode half-builds a target, gets to "unblock downstream dependents of X", which triggers X, which then fails because the linking hasn't happened yet. This happens in a project which doesn't have any build tool plugins.