Search code examples
xcodexcode10

Xcode 10 build phase sequencing


What logic does Xcode's modern build system use to sequence or parallelize build phases? I realize that input/output files can be defined to sequence interdependent build phases, but is that the only consideration?

A few of the more complex projects I work on have as many as 10 run-script build phases. While I'd like to benefit from the fact that some can run in parallel, we previously leveraged the legacy build system's respect for top-down sequencing to ensure things happen in order. Are there any simple ways to ensure sequencing that don't rely on input/output files?


Solution

  • Simply put, there's no great way.

    I wound up doing a couple of things to reduce complexity:

    1. Consolidate run-script build phases into two: pre-compile, post-compile
    2. Utilize multiprocessing in Python to run groups of scripts in sequence (builds on top of in-house tooling)

    I still define "output files" generated during either phase - for instance to ensure that a script-generated (or retrieved) file might be copied into the product bundle. It has reduced overhead, and improved build-times. I still think Apple needs to implement an improved mechanism for sequencing build run-script phases.