Docs/ProjectSpec.md
The project spec can be written in either YAML or JSON. All the examples below use YAML.
Some of the YAML examples below don't show all the required properties. For example not all target examples will have a platform or type, even though they are required.
You can also use environment variables in your configuration file, by using ${SOME_VARIABLE} in a string.
LastUpgradeCheck, it will be defaulted to {"LastUpgradeCheck": "XcodeVersion"} with xcodeVersion being set by Options.xcodeVersionDebug and Release configs.xcconfig files per configtemplate property. They can be used to extract common scheme settings. Works great in combination with include.template property. They can be used to extract common target settings. Works great in combination with include.One or more specs can be included in the project spec. This can be used to split your project spec into multiple files, for easier structuring or sharing between multiple specs. Included specs can also include other specs and so on.
Include can either be a list of includes or a single include. They will be merged in order and then the current spec will be merged on top.
An include can be provided via a string (the path) or an object of the form:
Include Object
include:
- includedFile.yml
- path: path/to/includedFile.yml
relativePaths: false
enable: ${INCLUDE_ADDITIONAL_YAML}
By default specs are merged additively. That is for every value:
This merging behaviour can be overridden on a value basis. If you wish to replace a whole value (set a new dictionary or new array instead of merging them) then just affix :REPLACE to the key
include:
- base.yml
name: CustomSpec
targets:
MyTarget: # target lives in base.yml
sources:REPLACE:
- my_new_sources
Note that target names can also be changed by adding a name property to a target.
minimumXcodeGenVersion: String - The minimum version of XcodeGen required.
carthageBuildPath: String - The path to the carthage build directory. Defaults to Carthage/Build. This is used when specifying target carthage dependencies
carthageExecutablePath: String - The path to the carthage executable. Defaults to carthage. You can specify when you use custom built or locally installed Carthage using Mint, for example.
createIntermediateGroups: Bool - If this is specified and set to true, then intermediate groups will be created for every path component between the folder containing the source and next existing group it finds or the base path. For example, when enabled if a source path is specified as Vendor/Foo/Hello.swift, the group Vendor will created as a parent of the Foo group. This can be overridden in a specific Target source
bundleIdPrefix: String - If this is specified then any target that doesn't have an PRODUCT_BUNDLE_IDENTIFIER (via all levels of build settings) will get an autogenerated one by combining bundleIdPrefix and the target name: bundleIdPrefix.name. The target name will be stripped of all characters that aren't alphanumerics, hyphens, or periods. Underscores will be replaced with hyphens.
settingPresets: String - This controls the settings that are automatically applied to the project and its targets. These are the same build settings that Xcode would add when creating a new project. Project settings are applied by config type. Target settings are applied by the product type and platform. By default this is set to all
all: project and target settingsproject: only project settingstargets: only target settingsnone: no settings are automatically applied developmentLanguage: String - Sets the development language of the project. Defaults to en
usesTabs: Bool - If this is specified, the Xcode project will override the user's setting determining whether or not tabs or spaces should be used in the project.
indentWidth: Int - If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.
tabWidth: Int - If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.
xcodeVersion: String - The version of Xcode. This defaults to the latest version periodically. You can specify it in the format 0910 or 9.1
projectFormat: String - The version of Xcode project. By default this is set to xcode16_0
xcode16_3: Xcode 16.3xcode16_0: Xcode 16.0xcode15_3: Xcode 15.3xcode15_0: Xcode 15.0xcode14_0: Xcode 14.0 deploymentTarget: [Platform: String] - A project wide deployment target can be specified for each platform otherwise the default SDK version in Xcode will be used. This will be overridden by any custom build settings that set the deployment target eg IPHONEOS_DEPLOYMENT_TARGET. Target specific deployment targets can also be set with Target.deploymentTarget.
disabledValidations: [String] - A list of validations that can be disabled if they're too strict for your use case. By default this is set to an empty array. Currently these are the available options:
missingConfigs: Disable errors for configurations in yaml files that don't exist in the project itself. This can be useful if you include the same yaml file in different projectsmissingConfigFiles: Disable checking for the existence of configuration files. This can be useful for generating a project in a context where config files are not available.missingTestPlans: Disable checking if test plan paths exist. This can be useful if your test plans haven't been created yet.defaultConfig: String - The default configuration for command line builds from Xcode. If the configuration provided here doesn't match one in your configs key, XcodeGen will fail. If you don't set this, the first configuration alphabetically will be chosen.
groupSortPosition: String - Where groups are sorted in relation to other files. Either:
none - sorted alphabetically with all the other filestop - at the top, before filesbottom (default) - at the bottom, after other filesgroupOrdering: [GroupOrdering] - An order of groups.
transitivelyLinkDependencies: Bool - If this is true then targets will link to the dependencies of their target dependencies. If a target should embed its dependencies, such as application and test bundles, it will embed these transitive dependencies as well. Some complex setups might want to set this to false and explicitly specify dependencies at every level. Targets can override this with Target.transitivelyLinkDependencies. Defaults to false.
generateEmptyDirectories: Bool - If this is true then empty directories will be added to project too else will be missed. Defaults to false.
findCarthageFrameworks: Bool - When this is set to true, all the individual frameworks for Carthage framework dependencies will automatically be found. This property can be overridden individually for each carthage dependency - for more details see See findFrameworks in the Dependency section. Defaults to false.
localPackagesGroup: String - The group name that local packages are put into. This defaults to Packages. Use "" to specify the project root.
fileTypes: [String: FileType] - A list of default file options for specific file extensions across the project. Values in Sources will overwrite these settings.
preGenCommand: String - A bash command to run before the project has been generated. If the project isn't generated due to no changes when using the cache then this won't run. This is useful for running things like generating resources files before the project is regenerated.
postGenCommand: String - A bash command to run after the project has been generated. If the project isn't generated due to no changes when using the cache then this won't run. This is useful for running things like pod install only if the project is actually regenerated.
useBaseInternationalization: Bool If this is false and your project does not include resources located in a Base.lproj directory then Base will not be included in the projects 'known regions'. The default value is true.
schemePathPrefix: String - A path prefix for relative paths in schemes, such as StoreKitConfiguration. The default is "../../", which is suitable for non-workspace projects. For use in workspaces, use "../".
defaultSourceDirectoryType: String - When a Target source doesn't specify a type and is a directory, this is the type that will be used. If nothing is specified for either then group will be used.
group (default)foldersyncedFolder: Can be used starting from projectFormat xcode16_0options:
deploymentTarget:
watchOS: "2.0"
tvOS: "10.0"
postGenCommand: pod install
Describe an order of groups. Available parameters:
options:
groupOrdering:
- order: [Sources, Resources, Tests, Support files, Configurations]
- pattern: '^.*Screen$'
order: [View, Presenter, Interactor, Entities, Assembly]
In this example, we set up the order of two groups. First one is the main group, i.e. the project, note that in this case, we shouldn't set pattern option and the second group order is for groups whose names ends with Screen.
Default settings for file extensions. See Sources for more documentation on properties. If you overwrite an extension that XcodeGen already provides by default, you will need to provide all the settings.
File: file breakpointException: exception breakpointSwiftError: swift error breakpointOpenGLError: OpenGL breakpointSymbolic: symbolic breakpointIDEConstraintError: IDE constraint breakpointIDETestFailure: IDE test failure breakpointRuntimeIssue: Runtime issue breakpointtrue0falseAllObjective-C (default)C++throw (default)
-catchbreakpoints:
- type: ExceptionBreakpoint
enabled: true
ignoreCount: 0
continueAfterRunningActions: false
DebuggerCommand: execute debugger commandLog: log messageShellCommand: execute shell commandGraphicsTrace: capture GPU frameAppleScript: execute AppleScriptSound: play soundconsole: log message to console (default)speak: speak messagefalseBasso (default)BlowBottleFrogFunkGlassHeroMorsePingPopPurrSosumiSubmarineTinkactions:
- type: Sound
sound: Blow
Each config maps to a build type of either debug or release which will then apply default Build Settings to the project. Any value other than debug or release (for example none), will mean no default Build Settings will be applied to the project.
configs:
Debug: debug
Beta: release
AppStore: release
If no configs are specified, default Debug and Release configs will be created automatically.
Setting groups are named groups of Build Settings that can be reused elsewhere. Each preset is a Settings schema, so can include other groups or define settings by configs.
settingGroups:
preset_generic:
CUSTOM_SETTING: value_custom
preset_debug:
BUILD_SETTING: value_debug
preset_release:
base:
BUILD_SETTING: value_release
preset_all:
groups:
- preset_generic
configs:
debug:
groups:
- preset_debug
release:
groups:
- preset_release
targets:
Application:
settings:
groups:
- preset_all
Settings correspond to Build Settings tab in Xcode. To display Setting Names instead of Setting Titles, select Editor -> Show Setting Names in Xcode.
Settings can either be a simple map of Build Settings [String:String], or can be more advanced with the following properties:
Staging Debug and Staging Release, you could apply settings to both of them using staging. However if a config name is an exact match to a config it won't be applied to any others. eg Release will be applied to config Release but not Staging Releasesettings:
GENERATE_INFOPLIST_FILE: NO
CODE_SIGNING_ALLOWED: NO
WRAPPER_EXTENSION: bundle
Don't mix simple maps with groups, base and configs.
If groups, base, configs are used then simple maps is silently ignored.
In this example, CURRENT_PROJECT_VERSION will be set, but MARKETING_VERSION will be ignored:
settings:
MARKETING_VERSION: 100.0.0
base:
CURRENT_PROJECT_VERSION: 100.0
settings:
base:
PRODUCT_NAME: XcodeGenProduct
configs:
debug:
CODE_SIGN_IDENTITY: iPhone Developer
PRODUCT_BUNDLE_IDENTIFIER: com.tomtom.debug_app
release:
CODE_SIGN_IDENTITY: iPhone Distribution
PRODUCT_BUNDLE_IDENTIFIER: com.tomtom.app
PROVISIONING_PROFILE_SPECIFIER: "Xcodegen Release"
groups:
- my_settings
Settings are merged in the following order: groups, base, configs (simple maps are ignored).
9.2). If this is not specified the value from the project set in Options.deploymentTarget.PLATFORM will be used..xcconfig files per configINFOPLIST_FILE: If it doesn't exist your sources will be searched for Info.plist files and the first one found will be used for this settingFRAMEWORK_SEARCH_PATHS: If carthage framework dependencies are used, the platform build path will be added to this settingOTHER_LDFLAGS: See requiresObjCLinking belowTEST_TARGET_NAME: for ui tests that target an applicationTEST_HOST: for unit tests that target an applicationInfo.plist to the specified path and use it by setting the INFOPLIST_FILE build setting for every configuration, unless INFOPLIST_FILE is already defined in settings for this configuration. The following properties are generated automatically if appropriate, the rest will have to be provided.
CFBundleIdentifierCFBundleInfoDictionaryVersionCFBundleExecutable Not generated for targets of type bundleCFBundleNameCFBundleDevelopmentRegionCFBundleShortVersionStringCFBundleVersionCFBundlePackageType.entitlements file, and use it by setting CODE_SIGN_ENTITLEMENTS build setting for every configuration. All properties must be provided${target_name} within these templates will be replaced with the target name.${attributeName} within the templates listed in templates will be replaced with the value specified..transitivelyLinkDependencies will be used.true Carthage framework dependencies will be embedded using an Embed Frameworks build phase instead of the copy-frameworks script. Defaults to true for all targets except iOS/tvOS/watchOS Applications.true any targets that link to this target will have -ObjC added to their OTHER_LDFLAGS. This is required if a static library has any categories or extensions on Objective-C code. See this guide for more details. Defaults to true if type is library.static. If you are 100% sure you don't have categories or extensions on Objective-C code (pure Swift with no use of Foundation/UIKit) you can set this to false, otherwise it's best to leave it alone.true, the Embed Frameworks and Embed App Extensions (if available) build phases will have the "Copy only when installing" chekbox checked. Defaults to false.TargetAttributes. It is merged with attributes from the project and anything automatically added by XcodeGen, with any duplicate values being override by values specified here. This is for advanced use only. Properties that are already set include:
DevelopmentTeam: if all configurations have the same DEVELOPMENT_TEAM settingProvisioningStyle: if all configurations have the same CODE_SIGN_STYLE settingTestTargetID: if all configurations have the same TEST_TARGET_NAME settingtrue the Copy Resources step will be placed before the Compile Sources build step.This will provide default build settings for a certain product type. It can be any of the following:
applicationapplication.on-demand-install-capableapplication.messagesapplication.watchappapplication.watchapp2application.watchapp2-containerapp-extensionapp-extension.intents-serviceapp-extension.messagesapp-extension.messages-sticker-packbundlebundle.ocunit-testbundle.ui-testingbundle.unit-testextensionkit-extensionframeworkinstruments-packagelibrary.dynamiclibrary.staticframework.statictooltv-app-extensionwatchkit-extensionwatchkit2-extensionxcode-extensiondriver-extensionsystem-extensionxpc-service"" (used for legacy targets)This will provide default build settings for a certain platform. It can be any of the following:
auto (available only when we use supportedDestinations)iOStvOSmacOSwatchOSvisionOS (visionOS doesn't support Carthage usage)Note that when we use supported destinations with Xcode 14+ we can avoid the definition of platform that fallbacks to the auto value.
Multi Platform targets
You can also specify an array of platforms. This will generate a target for each platform.
If deploymentTarget is specified for a multi platform target, it can have different values per platform similar to how it's defined in Options. See below for an example.
If you reference the string ${platform} anywhere within the target spec, that will be replaced with the platform.
The generated targets by default will have a suffix of _${platform} applied, you can change this by specifying a platformSuffix or platformPrefix.
If no PRODUCT_NAME build setting is specified for a target, this will be set to the target name, so that this target can be imported under a single name.
targets:
MyFramework:
sources: MyFramework
platform: [iOS, tvOS]
deploymentTarget:
iOS: 9.0
tvOS: 10.0
type: framework
settings:
base:
INFOPLIST_FILE: MyApp/Info.plist
PRODUCT_BUNDLE_IDENTIFIER: com.myapp
MY_SETTING: platform ${platform}
groups:
- ${platform}
The above will generate 2 targets named MyFramework_iOS and MyFramework_tvOS, with all the relevant platform build settings. They will both have a PRODUCT_NAME of MyFramework
This will provide a mix of default build settings for the chosen platform destinations. It can be any of the following:
iOStvOSmacOSmacCatalystvisionOSwatchOStargets:
MyFramework:
type: framework
supportedDestinations: [iOS, tvOS]
deploymentTarget:
iOS: 9.0
tvOS: 10.0
sources:
- path: MySources
inferDestinationFiltersByPath: true
- path: OtherSources
destinationFilters: [iOS]
Note that the definition of supported destinations can be applied to almost every type of bundle making everything more easy to manage (app targets, unit tests, UI tests etc). App targets currently do not support the watchOS destination. Create a separate target using platform for watchOS apps. See Apple's Configuring a multiplatform app for details.
Specifies the source directories for a target. This can either be a single source or a list of sources. Applicable source files, resources, headers, and .lproj files will be parsed appropriately.
A source can be provided via a string (the path) or an object of the form:
createIntermediateGroups is set to true. Multiple groups can be created by separating each one using a /. If multiple target sources share the same group, they will be put together in the same parent group.path and not the directory where project.yml resides. XcodeGen uses Bash 4's Glob behaviors where globstar (**) is enabled.excludes representing the files to include. These rules are relative to path and not the directory where project.yml resides. If excludes is present and file conflicts with includes, excludes will override the includes behavior.syncedFolder type. A list of global patterns in the same format as excludes to child folders that Xcode should treat as folder references.**/<supportedDestination>/* or *_<supportedDestination>.swift. Note, if you use destinationFilters this flag will be ignored.Info.plist files will never be added to any build phases, no matter what this setting is. Possible values are:
sources - Compile Sources phaseresources - Copy Bundle Resources phaseheaders - Headers PhasecopyFiles - Copy Files Phase. Must be specified as an object with the following fields:
absolutePathproductsDirectorywrapperexecutablesresourcesjavaResourcesframeworkssharedFrameworkssharedSupportpluginsnone - Will not be added to any build phasesfile: a file reference with a parent group will be created (Default for files or directories with extensions)group: a group with all it's containing files. (Default for directories without extensions)folder: a folder reference.syncedFolder: Xcode 16's synchronized folders, also knows as buildable folderspublic, but can be either:
publicprivateprojecttargets:
MyTarget:
sources: MyTargetSource
MyOtherTarget:
supportedDestinations: [iOS, tvOS]
sources:
- MyOtherTargetSource1
- path: MyOtherTargetSource2
inferDestinationFiltersByPath: true
name: MyNewName
excludes:
- "ios/*.[mh]"
- "configs/server[0-2].json"
- "*-Private.h"
- "**/*.md" # excludes all files with the .md extension
- "ios/**/*Tests.[hm]" # excludes all files with an h or m extension within the ios directory.
compilerFlags:
- "-Werror"
- "-Wextra"
- path: MyOtherTargetSource3
destinationFilters: [iOS]
compilerFlags: "-Werror -Wextra"
- path: ModuleMaps
buildPhase:
copyFiles:
destination: productsDirectory
subpath: include/$(PRODUCT_NAME)
- path: Resources
type: folder
- path: Path/To/File.asset
resourceTags: [tag1, tag2]
A dependency can be one of a 6 types:
target: name - links to another target. If you are using project references you can specify a target within another project by using ProjectName/TargetName for the nameframework: path - links to a framework or XCFrameworkcarthage: name - helper for linking to a Carthage framework (not XCFramework)sdk: name - links to a dependency with the SDK. This can either be a relative path within the sdk root or a single filename that references a framework (.framework) or lib (.tbd)package: name - links to a Swift Package. The name must match the name of a package defined in the top level packagesbundle: name - adds the pre-built bundle for the supplied name to the copy resources build phase. This is useful when a dependency exists on a static library target that has an associated bundle target, both existing in a separate project. Only usable in target types which can copy resources.Linking options:
true depending on the type of the dependency and the type of the target (e.g. static libraries will only link to executables by default).codeSignOnCopy setting is applied when embedding framework. Defaults to true.removeHeadersOnCopy setting is applied when embedding the framework. Defaults to true.Weak setting is applied when linking the framework. Defaults to false.embed is true. Must be specified as an object with the following fields:
absolutePathproductsDirectorywrapperexecutablesresourcesjavaResourcesframeworkssharedFrameworkssharedSupportpluginsImplicit Framework options:
This only applies to framework dependencies. Implicit framework dependencies are useful in Xcode Workspaces which have multiple .xcodeproj that are not embedded within each other yet have a dependency on a framework built in an adjacent .xcodeproj. By having Find Implicit Dependencies checked within your scheme Build Options Xcode can link built frameworks in BUILT_PRODUCTS_DIR.
false .Carthage Dependency
true .dynamic or static. Default value is dynamic .Carthage frameworks are expected to be in CARTHAGE_BUILD_PATH/PLATFORM/FRAMEWORK.framework where:
CARTHAGE_BUILD_PATH = options.carthageBuildPath or Carthage/Build by defaultPLATFORM = the target's platformFRAMEWORK = the specified name.To link an XCFramework produced by Carthage (in CARTHAGE_BUILD_PATH/FRAMEWORK.xcframework), use a normal framework:
dependency. The helper logic provided by this dependency type is not necessary.
All the individual frameworks of a Carthage dependency can be automatically found via findFrameworks: true. This overrides the value of Options.findCarthageFrameworks. Otherwise each one will have to be listed individually.
Xcodegen uses .version files generated by Carthage in order for this framework lookup to work, so the Carthage dependencies will need to have already been built at the time XcodeGen is run.
If any applications contain carthage dependencies within itself or any dependent targets, a carthage copy files script is automatically added to the application containing all the relevant frameworks. A FRAMEWORK_SEARCH_PATHS setting is also automatically added
Carthage officially supports static frameworks. In this case, frameworks are expected to be in CARTHAGE_BUILD_PATH/PLATFORM/Static/FRAMEWORK.framework.
You can specify linkType to static to integrate static ones.
projectReferences:
FooLib:
path: path/to/FooLib.xcodeproj
targets:
MyTarget:
supportedDestinations: [iOS, tvOS]
dependencies:
- target: MyFramework
destinationFilters: [iOS]
- target: FooLib/FooTarget
- framework: path/to/framework.framework
destinationFilters: [tvOS]
- carthage: Result
findFrameworks: false
linkType: static
destinationFilters: [iOS]
- sdk: Contacts.framework
- sdk: libc++.tbd
- sdk: libz.dylib
MyFramework:
type: framework
SDK Dependency
DEVELOPER_DIR. Default value is BUILT_PRODUCTS_DIRtargets:
MyTestTarget:
dependencies:
- target: MyFramework
- framework: path/to/framework.framework
- sdk: Contacts.framework
- sdk: Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest
root: DEVELOPER_DIR
MyFramework:
type: framework
Package dependency
products when you want to define different linking options per product.packages:
Yams:
url: https://github.com/jpsim/Yams
majorVersion: 2.0.0
SwiftPM:
url: https://github.com/apple/swift-package-manager
branch: swift-5.0-branch
targets:
App:
dependencies:
- package: Yams
- package: SwiftPM
product: SPMUtility
Depending on multiple products from a package:
packages:
FooFeature:
path: Packages/FooFeature
targets:
App:
dependencies:
- package: FooFeature
products:
- FooDomain
- FooUI
Specifies .xcconfig files for each configuration.
configFiles:
Debug: debug.xcconfig
Release: release.xcconfig
targets:
App:
configFiles:
Debug: App/debug.xcconfig
Release: App/release.xcconfig
Plists are created on disk on every generation of the project. They can be used as a way to define Info.plist or .entitlement files. Some Info.plist properties are generated automatically.
targets:
App:
info:
path: App/Info.plist
properties:
UISupportedInterfaceOrientations: [UIInterfaceOrientationPortrait]
UILaunchStoryboardName: LaunchScreen
entitlements:
path: App/App.entitlements
properties:
com.apple.security.application-groups: group.com.app
To add Build Tool Plug-ins, you need to add information about plugins to Target:
Each plugin includes information:
Сonnect the plugin to the desired target:
targets:
App:
buildToolPlugins:
- plugin: MyPlugin
package: MyPackage
Don't forget to add a package containing the plugin we need:
packages:
MyPackage:
url: https://github.com/MyPackage
from: 1.3.0
Run script build phases can be added at 3 different points in the build:
Each script can contain:
Run Script/bin/shtruerunOnlyForDeploymentPostprocessing). Defaults to falsetrueEither a path or script must be defined, the rest are optional.
A multiline script can be written using the various YAML multiline methods, for example with | as below:
targets:
MyTarget:
preBuildScripts:
- path: myscripts/my_script.sh
name: My Script
inputFiles:
- $(SRCROOT)/file1
- $(SRCROOT)/file2
inputFileLists:
- $(SRCROOT)/inputFiles.xcfilelist
outputFiles:
- $(DERIVED_FILE_DIR)/file1
- $(DERIVED_FILE_DIR)/file2
outputFileLists:
- $(SRCROOT)/outputFiles.xcfilelist
discoveredDependencyFile: $(DERIVED_FILE_DIR)/target.d
postCompileScripts:
- script: swiftlint
name: Swiftlint
- script: |
command do
othercommand
postBuildScripts:
- path: myscripts/my_final_script.sh
name: My Final Script
fileType must be definedProcess dropdown in the Xcode interface. For example sourcecode.swift or file.xib. This or filePattern must be defined.compilerSpec must be defined.script must be defined.Build Ruletargets:
MyTarget:
buildRules:
- filePattern: "*.xcassets"
script: generate_assets.py
- fileType: sourcecode.swift
script: pre_process_swift.py
- filePattern: "*.txt"
name: My Build Rule
compilerSpec: com.apple.xcode.tools.swift.compiler
outputFiles:
- $(SRCROOT)/Generated.swift
runOncePerArchitecture: false
This is a convenience used to automatically generate schemes for a target based on different configs or included tests. If you want more control check out the top level Scheme.
true if not set.String) to if it is enabled (Bool). These arguments will be added to the Test, Profile and Run scheme actionsFor example, the spec below would create 3 schemes called:
Each scheme would use different build configuration for the different build types, specifically debug configs for run, test, and analyze, and release configs for profile and archive.
The MyUnitTests target would also be linked.
configs:
Test Debug: debug
Staging Debug: debug
Production Debug: debug
Test Release: release
Staging Release: release
Production Release: release
targets:
MyApp:
scheme:
testTargets:
- MyUnitTests
configVariants:
- Test
- Staging
- Production
gatherCoverageData: true
coverageTargets:
- MyTarget1
- ExternalTarget/OtherTarget1
commandLineArguments:
"-MyEnabledArg": true
"-MyDisabledArg": false
environmentVariables:
MY_ENV_VAR: VALUE
MyUnitTests:
sources: Tests
By providing a legacy target, you are opting in to the "Legacy Target" mode. This is the "External Build Tool" from the Xcode GUI. This is useful for scripts that you want to run as dependencies of other targets, but you want to make sure that it only runs once even if it is specified as a dependency from multiple other targets.
This is used to override settings or run build scripts in specific targets
.xcconfig files per configTargetAttributes. It is merged with attributes from the project and anything automatically added by XcodeGen, with any duplicate values being override by values specified hereThis is a template that can be referenced from a normal target using the templates property. The properties of this template are the same as a Target.
Any instances of ${target_name} within each template will be replaced by the final target name which references the template.
Any attributes defined within a targets templateAttributes will be used to replace any attribute references in the template using the syntax ${attribute_name}.
targets:
MyFramework:
templates:
- Framework
templateAttributes:
frameworkName: AwesomeFramework
sources:
- SomeSources
targetTemplates:
Framework:
platform: iOS
type: framework
sources:
- ${frameworkName}/${target_name}
Schemes allows for more control than the convenience Target Scheme on Target
targets: [String:String] or [String:[String]] - A map of target names to build and which build types they should be enabled for. The build types can be all, none, or an array of the following types:
run or runningtest or testingprofile or profilinganalyze or analyzingarchive or archiving parallelizeBuild: Bool - Whether or not your targets should be built in parallel. By default this is true if not set.
true: Build targets in parallelfalse: Build targets serially buildImplicitDependencies: Bool - Flag to determine if Xcode should build implicit dependencies of this scheme. By default this is true if not set.
true: Discover implicit dependencies of this schemefalse: Only build explicit dependencies of this scheme runPostActionsOnFailure: Bool - Flag to determine if Xcode should run post scripts despite failure build. By default this is false if not set.
true: Run post scripts even if build is failed
false: Only run post scripts if build success
targets:
MyTarget: all
FooLib/FooTarget: [test, run]
parallelizeBuild: true
buildImplicitDependencies: true
The different actions share some properties:
debug: run, test, analyzerelease: profile, archiverun, test and profile actions have a map of command line arguments to whether they are enabledrun, test and profile actions can define the environment variables. When passing a dictionary, every key-value entry maps to a corresponding variable that is enabled.GPU Frame Capture. Possible values are autoEnabled, metal, openGL, disabled. Default is autoEnabled.Metal API Validation. This defaults to true.run and test actions can define a boolean that indicates that this scheme should disable the Main Thread Checker. This defaults to falserun action can define a boolean that indicates that this scheme should disable the Thread Performance Checker. This defaults to falserun and test actions can define a language that is used for Application Languagerun and test actions can define a language that is used for Application Regionrun and test actions can define a whether debugger should be used. This defaults to true.run action can define a simulated locationrun and profile actions can define the executable set to ask to launch. This defaults to false.run action can define the launch automatically substyle ('2' for extensions).run action can specify a storekit configuration. See Options.run and test actions can define the macro expansion from other target. This defaults to nil.Scheme run scripts added via preActions or postActions. They run before or after a build action, respectively, and in the order defined. Each execution action can contain:
Run ScriptA multiline script can be written using the various YAML multiline methods, for example with |. See Build Script.
.lldbinit file.lldbinit filecaptureScreenshotsAutomatically is false, this value is ignored. This defaults to true.screenshots, screenRecording. Default is screenRecording.A target can be one of a 2 types:
name:.As syntax sugar, you can also specify Testable Target Reference without target.
skippedTests if providedA Testable Target Reference can be one of 3 types:
package: {local-swift-package-name}/{target-name}: Name of local swift package and its target.local: {target-name}: Name of local target.project: {project-reference-name}/{target-name}: Name of local swift package and its target.London, EnglandJohannesburg, South AfricaMoscow, RussiaMumbai, IndiaTokyo, JapanSydney, AustraliaHong Kong, ChinaHonolulu, HI, USASan Francisco, CA, USAMexico City, MexicoNew York, NY, USARio de Janeiro, Brazil<relative-path-to-gpx-file> (e.g. ./location.gpx)fileGroups for Xcode be able to use it:targets:
MyTarget:
fileGroups:
- location.gpx
Note that the path the gpx file will be prefixed according to the schemePathPrefix option in order to support both .xcodeproj and .xcworkspace setups. See Options.
schemes:
Production:
build:
targets:
MyTarget1: all
MyTarget2: [run, archive]
run:
config: prod-debug
commandLineArguments:
"-MyEnabledArg": true
"-MyDisabledArg": false
environmentVariables:
RUN_ENV_VAR: VALUE
test:
config: prod-debug
commandLineArguments:
"-MyEnabledArg": true
"-MyDisabledArg": false
gatherCoverageData: true
coverageTargets:
- MyTarget1
- ExternalTarget/OtherTarget1
- package: LocalPackage/TestTarget
targets:
- Tester1
- name: Tester2
parallelizable: true
randomExecutionOrder: true
skippedTests: [Test/testExample()]
- package: APIClient/APIClientTests
parallelizable: true
randomExecutionOrder: true
environmentVariables:
- variable: TEST_ENV_VAR
value: VALUE
isEnabled: false
profile:
config: prod-release
analyze:
config: prod-debug
archive:
config: prod-release
customArchiveName: MyTarget
revealArchiveInOrganizer: false
For now test plans are not generated by XcodeGen and must be created in Xcode and checked in, and then referenced by path. If the test targets are added, removed or renamed, the test plans may need to be updated in Xcode.
xctestplan location.schemes:
TestTarget:
test:
testPlans:
- path: app.xctestplan
defaultPlan: true
This is a template that can be referenced from a normal scheme using the templates property. The properties of this template are the same as a Scheme. This functions identically in practice to Target Template.
Any instances of ${scheme_name} within each template will be replaced by the final scheme name which references the template.
Any attributes defined within a scheme's templateAttributes will be used to replace any attribute references in the template using the syntax ${attribute_name}.
schemes:
MyModule:
templates:
- FeatureModuleScheme
templateAttributes:
testTargetName: MyModuleTests
schemeTemplates:
FeatureModuleScheme:
templates:
- TestScheme
build:
targets:
${scheme_name}: build
TestScheme:
test:
gatherCoverageData: true
targets:
- name: ${testTargetName}
parallelizable: true
randomExecutionOrder: true
The result will be a scheme that builds MyModule when you request a build, and will test against MyModuleTests when you request to run tests. This is particularly useful when you work in a very modular application and each module has a similar structure.
Swift packages are defined at a project level, and then linked to individual targets via a Dependency.
majorVersion: 1.2.0 or from: 1.2.0minorVersion: 1.2.1exactVersion: 1.2.1 or version: 1.2.1minVersion: 1.0.0, maxVersion: 1.2.9branch: masterrevision: xxxxxxurl you can just specify the github org and repoPackage.swift."" to specify the project root.falsepackages:
Yams:
url: https://github.com/jpsim/Yams
from: 2.0.0
Ink:
github: JohnSundell/Ink
from: 0.5.0
RxClient:
path: ../RxClient
AppFeature:
path: ../Packages
group: Domains/AppFeature
excludeFromProject: false
Project References are defined at a project level, and then you can use the project name to refer its target via a Scheme
xcodeproj file to reference.projectReferences:
YamsProject:
path: ./Carthage/Checkouts/Yams/Yams.xcodeproj
schemes:
TestTarget:
build:
targets:
YamsProject/Yams: ["run"]