The build system transforms source code and assets into products such as iOS, macOS, tvOS, and watchOS apps. Throughout the development process, the build system is invoked whenever you:
Build, run, test, profile, analyze, or archive your project.
Use Xcode Server to perform continuous integration of your projects.
Use the xcodebuild
command-line tool outside of Xcode.
Each invocation of the build system is a build, which is performed by executing an ordered sequence of tasks. The most common tasks involve running command-line tools such as compilers and linkers, performing file system operations such as copying files, and performing custom file processing such as transforming an Info.plist
file.
The build system interacts with numerous components.
Workspaces organize projects.
Projects organize source code and assets within a workspace.
Schemes specify targets to build and actions (build, run, test, profile, analyze, and archive) to perform. A workspace may include multiple schemes.
Actions specify build configurations and other settings required for building, running, testing, profiling, analyzing, and archiving.
Targets describe how to build a finished product. Targets define build settings, build phases, and build rules. A project may include multiple targets. For example, a single project might have an iOS app target, a watchOS app target, and a watchOS app extension target.
Build setting provide information necessary for building the product of a target.
Build configurations are variations of build setting values for particular use cases. Most apps have two build configurations—Debug and Release.
Build phases define tasks to be performed when building a target, such as compiling source code and copying files.
Build rules define how the build system compiles specific types of files.
Build configuration (xcconfig) files are plain text files that define build settings for particular build configurations of projects and targets. These files can be edited outside of Xcode and integrate well with source control systems.
When an action (build, run, test, profile, analyze, or archive) is initiated for a scheme, the build system:
Determines which targets must be built.
Retrieves a list of build configurations, build settings, build phases, and build rules.
Checks for dependencies on other targets and builds those targets.
Prepares a complete list of build tasks that must be performed.
If incremental building is possible, prepares a list of incremental build tasks.
Executes the build tasks, which involves moving through all build phases. For each build phase, applies custom build rules when necessary.
Produces products.