Compare commits

...

9 Commits

Author SHA1 Message Date
Kila2
e26cbf2389
Merge 6e784e280a into f51719ce29 2024-05-29 18:22:35 -04:00
Yonas Kolb
f51719ce29
Update cache hook docs 2024-05-21 11:28:45 +10:00
Yonas Kolb
1b0720d139 Update to 2.41.0 2024-05-20 21:37:00 +10:00
Yonas Kolb
576739bcb5
Add cache command (#1476)
* add cache command

* docs: update git hook info
2024-05-20 21:32:24 +10:00
Tyler Milner
aa79a3ed0b
Fix typo in README (#1452) 2024-05-20 21:26:31 +10:00
John Flanagan
d99e448647
Include folder (SPM packages) in group sorting logic (#1466) 2024-05-17 23:14:20 +10:00
Tatsuki Otsuka
274ce7342c
Disallow the "watchOS" supported destination for multiplatform apps (#1470)
* Reject multiplatform apps that support the watchOS destination

This commit also fixes existing test cases.

* Add test cases

* Update docs

* Update changelog
2024-05-17 23:00:09 +10:00
Wolfgang Lutz
17acb4dc61
Update Examples.md (#1472)
We no longer use XcodeGen for this (because we switched this to pure SPM)
2024-04-25 11:28:06 +10:00
lijunliang.9819
6e784e280a add json-schema 2023-05-09 14:50:53 +08:00
35 changed files with 4718 additions and 38 deletions

View File

@ -0,0 +1,123 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Breakpoint Action Object",
"description": "XcodeGen Breakpoint Action Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#breakpoint-action",
"type": "object",
"properties": {
"type": {
"description": "Breakpoint action type",
"type": "string",
"enum": [
"DebuggerCommand",
"Log",
"ShellCommand",
"GraphicsTrace",
"AppleScript",
"Sound"
],
"examples": [
"DebuggerCommand",
"Log",
"ShellCommand",
"GraphicsTrace",
"AppleScript",
"Sound"
]
},
"command": {
"description": "Debugger command (only used by debugger command breakpoint action)",
"type": "string"
},
"message": {
"description": "Log message (only used log message breakpoint action)",
"type": "string"
},
"conveyanceType": {
"description": "Conveyance type (only used by log message breakpoint action)",
"type": "string",
"enum": ["console", "speak"],
"examples": ["console", "speak"]
},
"path": {
"description": "Shell command file path (only used by shell command breakpoint action)",
"type": "string"
},
"arguments": {
"description": "Shell command arguments (only used by shell command breakpoint action)",
"type": "string"
},
"waitUntilDone": {
"description": "Indicates whether it should wait until done (only used by shell command breakpoint action). Default to false",
"default": false,
"type": "boolean"
},
"script": {
"description": "AppleScript (only used by AppleScript breakpoint action)",
"type": "string"
},
"sound": {
"description": "Sound name (only used by sound breakpoint action)",
"type": "string",
"default": "Basso",
"enum": [
"Basso",
"Blow",
"Bottle",
"Frog",
"Funk",
"Glass",
"Hero",
"Morse",
"Ping",
"Pop",
"Purr",
"Sosumi",
"Submarine",
"Tink"
],
"examples": [
"Basso",
"Blow",
"Bottle",
"Frog",
"Funk",
"Glass",
"Hero",
"Morse",
"Ping",
"Pop",
"Purr",
"Sosumi",
"Submarine",
"Tink"
]
},
"module": {
"description": "Breakpoint module (only used by symbolic breakpoints)",
"type": "string"
},
"scope": {
"description": "Breakpoint scope (only used by exception breakpoints)",
"type": "string",
"default": "Objective-C",
"enum": ["All", "Objective-C", "C++"]
},
"stopOnStyle": {
"description": "Indicates if should stop on style (only used by exception breakpoints) -throw (default) -catch",
"type": "string"
},
"condition": {
"description": "Breakpoint condition",
"type": "string"
},
"actions": {
"description": "breakpoint actions",
"type": "array",
"items": {
"type": "object",
"$ref": "breakpoint_action.json"
}
}
},
"required": ["type"]
}

View File

@ -0,0 +1,98 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Breakpoints Object",
"description": "XcodeGen Breakpoints Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#breakpoints",
"type": "object",
"properties": {
"type": {
"description": "Breakpoint type",
"type": "string",
"enum": [
"File",
"Exception",
"SwiftError",
"OpenGLError",
"Symbolic",
"IDEConstraintError",
"IDETestFailure",
"FileBreakpoint",
"ExceptionBreakpoint",
"SwiftErrorBreakpoint",
"OpenGLErrorBreakpoint",
"SymbolicBreakpoint",
"IDEConstraintErrorBreakpoint",
"IDETestFailureBreakpoint"
],
"examples": [
"File",
"Exception",
"SwiftError",
"OpenGLError",
"Symbolic",
"IDEConstraintError",
"IDETestFailure",
"FileBreakpoint",
"ExceptionBreakpoint",
"SwiftErrorBreakpoint",
"OpenGLErrorBreakpoint",
"SymbolicBreakpoint",
"IDEConstraintErrorBreakpoint",
"IDETestFailureBreakpoint"
]
},
"enabled": {
"description": "Indicates whether it should be active. Default to true",
"default": true,
"type": "boolean"
},
"ignoreCount": {
"description": "Indicates how many times it should be ignored before stopping, Default to 0",
"type": "integer",
"default": 0
},
"continueAfterRunningActions": {
"description": "Indicates if should automatically continue after evaluating actions, Default to false",
"default": false,
"type": "boolean"
},
"path": {
"description": "Breakpoint file path (only required by file breakpoints)",
"type": "string"
},
"line": {
"description": "Breakpoint line (only required by file breakpoints)",
"type": "integer"
},
"symbol": {
"description": "Breakpoint symbol (only used by symbolic breakpoints)",
"type": "string"
},
"module": {
"description": "Breakpoint module (only used by symbolic breakpoints)",
"type": "string"
},
"scope": {
"description": "Breakpoint scope (only used by exception breakpoints)",
"type": "string",
"default": "Objective-C",
"enum": ["All", "Objective-C", "C++"]
},
"stopOnStyle": {
"description": "Indicates if should stop on style (only used by exception breakpoints) -throw (default) -catch",
"type": "string"
},
"condition": {
"description": "Breakpoint condition",
"type": "string"
},
"actions": {
"description": "breakpoint actions",
"type": "array",
"items": {
"type": "object",
"$ref": "breakpoint_action.json"
}
}
},
"required": ["type"]
}

View File

@ -0,0 +1,74 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Build Script Object",
"description": "https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#build-script",
"type": "object",
"properties": {
"script": {
"description": "an inline shell script",
"type": "string"
},
"name": {
"description": "name of a script. Defaults to Run Script",
"default": "Run Script",
"type": "string"
},
"inputFiles": {
"description": "list of input files",
"type": "array",
"items": {
"type": "string",
"examples": ["${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"]
}
},
"outputFiles": {
"description": "list of output files",
"type": "array",
"items": {
"type": "string",
"examples": ["${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"]
}
},
"inputFileLists": {
"description": "list of input .xcfilelist",
"type": "array",
"items": {
"type": "string",
"examples": ["${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"]
}
},
"outputFileLists": {
"description": "list of output .xcfilelist",
"type": "array",
"items": {
"type": "string",
"examples": ["${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"]
}
},
"shell": {
"description": "shell used for the script. Defaults to /bin/sh",
"type": "string",
"default": "/bin/sh"
},
"showEnvVars": {
"description": "whether the environment variables accessible to the script show be printed to the build log. Defaults to true",
"type": "boolean",
"default": "true"
},
"runOnlyWhenInstalling": {
"description": "whether the script is only run when installing (runOnlyForDeploymentPostprocessing). Defaults to false",
"type": "boolean",
"default": "false"
},
"basedOnDependencyAnalysis": {
"description": "whether to skip the script if inputs, context, or outputs haven't changed. Defaults to true",
"type": "boolean",
"default": "true"
},
"discoveredDependencyFile": {
"description": " discovered dependency .d file. Defaults to none",
"type": "string",
"default": "none"
}
}
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Config Files Object",
"description": "XcodeGen Config Files Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#config-files",
"type": "object",
"minProperties": 1
}

View File

@ -0,0 +1,10 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Configs Object",
"description": "XcodeGen Configs Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#configs",
"type": "object",
"additionalProperties": {
"examples": ["debug", "release"]
},
"minProperties": 1
}

View File

@ -0,0 +1,147 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Dependency Object",
"description": "https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#dependency",
"type": "object",
"oneOf": [
{
"type": "object",
"properties": {
"target": {
"description": "links to another target. If you are using project references you can specify a target within another project by using ProjectName/TargetName for the name",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" }
},
"required": ["target"]
},
{
"type": "object",
"properties": {
"framework": {
"description": "links to a framework or XCFramework",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" },
"additionalProperties": false
},
"required": ["framework"]
},
{
"type": "object",
"properties": {
"carthage": {
"description": "helper for linking to a Carthage framework (not XCFramework)",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" }
},
"required": ["carthage"]
},
{
"type": "object",
"properties": {
"sdk": {
"description": "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)",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" }
},
"required": ["sdk"]
},
{
"type": "object",
"properties": {
"package": {
"description": "links to a Swift Package. The name must match the name of a package defined in the top level packages",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" }
},
"required": ["package"]
},
{
"type": "object",
"properties": {
"bundle": {
"description": "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.",
"type": "string"
},
"embed": { "$ref": "#/$defs/embed" },
"link": { "$ref": "#/$defs/link" },
"codeSign": { "$ref": "#/$defs/codeSign" },
"removeHeaders": { "$ref": "#/$defs/removeHeaders" },
"weak": { "$ref": "#/$defs/weak" },
"platformFilter": { "$ref": "#/$defs/platformFilter" },
"platforms": { "$ref": "#/$defs/platforms" }
},
"required": ["bundle"]
}
],
"$defs": {
"embed": {
"description": "Whether to embed the dependency. Defaults to true for application target and false for non application targets.",
"type": "boolean"
},
"link": {
"description": "Whether to link the dependency. Defaults to 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).",
"type": "boolean"
},
"codeSign": {
"description": "Whether the codeSignOnCopy setting is applied when embedding framework. Defaults to true",
"type": "boolean",
"default": true
},
"removeHeaders": {
"description": "Whether the removeHeadersOnCopy setting is applied when embedding the framework. Defaults to true",
"type": "boolean",
"default": true
},
"weak": {
"description": "Whether the Weak setting is applied when linking the framework. Defaults to false",
"type": "boolean",
"default": false
},
"platformFilter": {
"description": "This field is specific to Mac Catalyst. It corresponds to the \"Platforms\" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: iOS, macOS and all. Defaults is all",
"type": "string",
"enum": ["iOS", "macOS", "all"],
"default": "all"
},
"platforms": {
"description": "List of platforms this dependency should apply to. Defaults to all applicable platforms.",
"type": "array",
"items": { "$ref": "platform.json" }
}
}
}

View File

@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Execution Action Object",
"description": "Scheme run scripts added via preActions or postActions. They run before or after a build action, respectively, and in the order defined. ",
"type": "object",
"properties": {
"script": {
"description": "an inline shell script",
"type": "string"
},
"name": {
"description": "name of a script. Defaults to Run Script",
"type": "string"
},
"settingsTarget": {
"description": "name of a build or test target whose settings will be available as environment variables.",
"type": "string"
}
}
}

View File

@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen FileType Object",
"description": "XcodeGen FileType Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#filetype",
"type": "object",
"properties": {
"file": {
"description": "Whether this extension should be treated like a file. Defaults to true.",
"type": "boolean",
"default": true
},
"buildPhase": {
"description": "The default build phase.",
"type": "string"
},
"attributes": {
"description": "Additional settings attributes that will be applied to any build files.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
},
"resourceTags": {
"description": "On Demand Resource Tags that will be applied to any resources. This also adds to the project attribute's knownAssetTags.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
},
"compilerFlags": {
"description": "A list of compiler flags to add.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
}
}
}

View File

@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen GroupOrdering Object",
"description": "XcodeGen GroupOrdering Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#groupOrdering",
"type": "object",
"properties": {
"pattern": {
"description": "A group name pattern. Can be just a single string and also can be a regex pattern. Optional option, if you don't set it, it will pattern for the main group, i.e. the project.",
"type": "string",
"examples": ["^.*Screen$"]
},
"order": {
"description": "An order of groups.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
}
}
}

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Include Object",
"description": "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.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#include",
"oneOf": [
{
"description": "The path to the included file.",
"type": "string",
"examples": ["path/to/includedFile.yml"]
},
{
"type": "object",
"properties": {
"path": {
"description": "The path to the included file.",
"type": "string",
"examples": ["path/to/includedFile.yml"]
},
"relativePaths": {
"description": "Dictates whether the included spec specifies paths relative to itself (the default) or the root spec file.",
"type": "boolean"
},
"enable": {
"description": "Dictates whether the specified spec should be included or not. You can also specify it by environment variable.",
"oneOf": [{ "type": "boolean" }, { "type": "string" }]
}
}
}
],
"required": ["path"]
}

View File

@ -0,0 +1,140 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Options Object",
"description": "XcodeGen Options Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#options",
"type": "object",
"properties": {
"minimumXcodeGenVersion": {
"description": "The minimum version of XcodeGen required.",
"type": "string"
},
"carthageBuildPath": {
"description": "The path to the carthage build directory. Defaults to Carthage/Build. This is used when specifying target carthage dependencies",
"type": "string"
},
"carthageExecutablePath": {
"description": "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.",
"type": "string"
},
"createIntermediateGroups": {
"description": "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",
"type": "boolean"
},
"bundleIdPrefix": {
"description": " 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.",
"type": "string"
},
"settingPresets": {
"description": "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",
"type": "string",
"default": "all",
"enum": ["all", "project", "targets", "none"],
"examples": ["all", "project", "targets", "none"]
},
"developmentLanguage": {
"description": " Sets the development language of the project. Defaults to en",
"type": "string",
"default": "en",
"examples": ["en"]
},
"usesTabs": {
"description": "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.",
"type": "boolean"
},
"indentWidth": {
"description": " If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.",
"type": "integer"
},
"tabWidth": {
"description": "If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.",
"type": "integer"
},
"xcodeVersion": {
"description": "The version of Xcode. This defaults to the latest version periodically. You can specify it in the format 0910 or 9.1",
"type": "string"
},
"deploymentTarget": {
"description": "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.",
"type": "object",
"properties": {
"iOS": {},
"macOS": {},
"tvOS": {},
"watchOS": {}
},
"additionalProperties": {
"oneOf": [{ "type": "string" }, { "type": "number" }]
}
},
"disabledValidations": {
"description": "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.",
"type": "array",
"examples": ["missingConfigs", "missingConfigFiles", "missingTestPlans"]
},
"defaultConfig": {
"description": "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.",
"type": "string"
},
"groupSortPosition": {
"description": "Where groups are sorted in relation to other files.",
"type": "string",
"default": "bottom",
"enum": ["none", "top", "bottom"],
"examples": ["none", "top", "bottom"]
},
"groupOrdering": {
"description": "The minimum version of XcodeGen required.",
"type": "array",
"items": {
"type": "object",
"$ref": "group_ordering.json",
"minItems": 1,
"uniqueItems": true
}
},
"transitivelyLinkDependencies": {
"description": " 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",
"default": false,
"type": "boolean"
},
"generateEmptyDirectories": {
"description": "If this is true then empty directories will be added to project too else will be missed. Defaults to false.",
"default": false,
"type": "boolean"
},
"findCarthageFrameworks": {
"description": "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.",
"default": false,
"type": "boolean"
},
"localPackagesGroup": {
"description": "The group name that local packages are put into. This defaults to Packages",
"type": "string"
},
"fileTypes": {
"description": " A list of default file options for specific file extensions across the project. Values in Sources will overwrite these settings.",
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "file_type.json"
}
},
"preGenCommand": {
"description": "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.",
"type": "string"
},
"postGenCommand": {
"description": " 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.",
"type": "string"
},
"useBaseInternationalization": {
"description": "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.",
"default": true,
"type": "boolean"
},
"schemePathPrefix": {
"description": "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 \"../\".",
"type": "string"
}
}
}

View File

@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Platform Object",
"description": "XcodeGen Platform Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#platform",
"oneOf": [
{
"type": "array"
},
{
"type": "string",
"enum": ["iOS", "macOS", "tvOS", "watchOS"],
"additionalProperties": false
}
],
"examples": ["iOS", "macOS", "tvOS", "watchOS", "[iOS, tvOS]"]
}

View File

@ -0,0 +1,116 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Project",
"description": "XcodeGen project spec.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#project-spec\ncommit:5cad639",
"type": "object",
"properties": {
"name": {
"description": "Name of the generated project",
"type": "string"
},
"include": {
"description": "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.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#include",
"oneOf": [
{
"type": "array",
"items": {
"$ref": "include.json",
"minItems": 1,
"uniqueItems": true
}
},
{
"$ref": "include.json"
}
]
},
"options": {
"description": "Various options to override default behaviour\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#options",
"type": "object",
"$ref": "options.json"
},
"attributes": {
"description": "The PBXProject attributes. This is for advanced use. If no value is set for LastUpgradeCheck, it will be defaulted to {\"LastUpgradeCheck\": \"XcodeVersion\"} with xcodeVersion being set by Options.xcodeVersion breakpoints: Breakpoints - Add shared breakpoints to the generated project",
"type": "object",
"examples": ["CLASSPREFIX: TT"]
},
"breakpoints": {
"description": "Add shared breakpoints to the generated project",
"type": "array",
"items": {
"$ref": "breakpoints.json"
}
},
"configs": {
"description": "Project build configurations. Defaults to Debug and Release configs\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#configs",
"type": "object",
"$ref": "configs.json"
},
"configFiles": {
"description": ".xcconfig files per config\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#config-files",
"type": "object",
"$ref": "config_files.json"
},
"settings": {
"description": "Project specific settings. Default base and config type settings will be applied first before any settings defined here. \nhttps://developer.apple.com/documentation/xcode/build-settings-reference\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#settings",
"type": "object",
"$ref": "xcode_settings.json"
},
"settingGroups": {
"title": "Setting groups mapped by name",
"description": "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.\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#setting-groups",
"type": "object"
},
"targets": {
"description": "The list of targets in the project mapped by name\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#target",
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "target.json"
}
},
"fileGroups": {
"description": "A list of paths to add to the root of the project. These aren't files that will be included in your targets, but that you'd like to include in the project hierarchy anyway. For example a folder of xcconfig files that aren't already added by any target sources, or a Readme file.",
"type": "array"
},
"schemes": {
"description": "A list of schemes by name. This allows more control over what is found in Target Scheme",
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "scheme.json"
}
},
"schemeTemplates": {
"description": "a list of schemes that can be used as templates for actual schems which reference them via a template property. They can be used to extract common scheme settings. Works great in combination with include.\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#scheme-template",
"type": "object",
"additionalProperties": {
"$ref": "scheme.json"
}
},
"targetTemplates": {
"description": "a list of targets that can be used as templates for actual targets which reference them via a template property. They can be used to extract common target settings. Works great in combination with include.\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#target-template",
"type": "object",
"additionalProperties": {
"type": "object",
"$ref": "target.json"
}
},
"packages": {
"description": "a map of Swift packages by name.",
"type": "object",
"additionalProperties": {
"description": "Swift packages are defined at a project level, and then linked to individual targets via a Dependency.\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#swift-package",
"type": "object"
}
},
"projectReferences": {
"description": "a map of project references by name",
"type": "object",
"additionalProperties": {
"description": "Project References are defined at a project level, and then you can use the project name to refer its target via a Scheme\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#project-reference",
"type": "object"
}
}
}
}

View File

@ -0,0 +1,326 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Scheme Object",
"description": "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}.\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#scheme",
"type": "object",
"properties": {
"templates": {
"description": "A list of Scheme Templates referenced by name that will be merged with the scheme in order. Any instances of ${scheme_name} within these templates will be replaced with the scheme name.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
},
"templateAttributes": {
"description": "A list of attributes where each instance of ${attributeName} within the templates listed in templates will be replaced with the value specified.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"build": {
"description": "Build options",
"type": "object",
"properties": {
"targets": {
"description": "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:",
"type": "object",
"examples": ["${scheme_name}", "${hostTargetName}"],
"additionalProperties": {
"oneOf": [
{
"type": "string",
"examples": ["all", "none"]
},
{
"type": "array",
"examples": [
"[run,running,test,testing,profile,profiling,analyze,analyzing,archive,archiving]"
]
}
]
}
},
"parallelizeBuild": {
"description": "Whether or not your targets should be built in parallel. By default this is true if not set.",
"type": "boolean",
"default": true
},
"buildImplicitDependencies": {
"description": "Flag to determine if Xcode should build implicit dependencies of this scheme. By default this is true if not set.",
"type": "boolean",
"default": true
},
"runPostActionsOnFailure": {
"description": "Flag to determine if Xcode should run post scripts despite failure build. By default this is false if not set.",
"type": "boolean",
"default": false
},
"config": { "$ref": "#/$defs/config" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" }
}
},
"run": {
"description": "Run action.",
"type": "object",
"properties": {
"executable": {
"description": "the name of the target to launch as an executable. Defaults to the first runnable build target in the scheme, or the first build target if a runnable build target is not found",
"type": "string"
},
"customLLDBInit": {
"description": "the absolute path to the custom .lldbinit file",
"type": "string"
},
"config": { "$ref": "#/$defs/config" },
"commandLineArguments": { "$ref": "#/$defs/commandLineArguments" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" },
"environmentVariables": { "$ref": "#/$defs/environmentVariables" },
"enableGPUFrameCaptureMode": {
"$ref": "#/$defs/enableGPUFrameCaptureMode"
},
"disableMainThreadChecker": {
"$ref": "#/$defs/disableMainThreadChecker"
},
"language": { "$ref": "#/$defs/language" },
"region": { "$ref": "#/$defs/region" },
"debugEnabled": { "$ref": "#/$defs/debugEnabled" },
"simulateLocation": { "$ref": "#/$defs/simulateLocation" },
"askForAppToLaunch": { "$ref": "#/$defs/askForAppToLaunch" },
"launchAutomaticallySubstyle": {
"$ref": "#/$defs/launchAutomaticallySubstyle"
},
"storeKitConfiguration": { "$ref": "#/$defs/storeKitConfiguration" },
"macroExpansion": { "$ref": "#/$defs/macroExpansion" }
}
},
"test": {
"description": "Test action.",
"type": "object",
"properties": {
"gatherCoverageData": {
"description": "a boolean that indicates if this scheme should gather coverage data. This defaults to false",
"type": "boolean",
"default": false
},
"coverageTargets": {
"description": "a list of targets to gather code coverage. Each entry can either be a simple string, a string using Project Reference or Testable Target Reference",
"type": "array"
},
"targets": {
"description": "a list of targets to test. Each entry can either be a simple string, or a Test Target",
"type": "array"
},
"customLLDBInit": {
"description": "the absolute path to the custom .lldbinit file",
"type": "string"
},
"captureScreenshotsAutomatically": {
"description": "indicates whether screenshots should be captured automatically while UI Testing. This defaults to true.",
"type": "boolean",
"default": true
},
"deleteScreenshotsWhenEachTestSucceeds": {
"description": "whether successful UI tests should cause automatically-captured screenshots to be deleted. If captureScreenshotsAutomatically is false, this value is ignored. This defaults to true.",
"type": "boolean",
"default": true
},
"testPlans": {
"description": "List of test plan locations that will be referenced in the scheme.",
"type": "array"
},
"config": { "$ref": "#/$defs/config" },
"commandLineArguments": { "$ref": "#/$defs/commandLineArguments" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" },
"environmentVariables": { "$ref": "#/$defs/environmentVariables" },
"disableMainThreadChecker": {
"$ref": "#/$defs/disableMainThreadChecker"
},
"language": { "$ref": "#/$defs/language" },
"region": { "$ref": "#/$defs/region" },
"debugEnabled": { "$ref": "#/$defs/debugEnabled" }
}
},
"profile": {
"description": "Profile action.",
"type": "object",
"properties": {
"config": { "$ref": "#/$defs/config" },
"commandLineArguments": { "$ref": "#/$defs/commandLineArguments" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" },
"environmentVariables": { "$ref": "#/$defs/environmentVariables" },
"askForAppToLaunch": { "$ref": "#/$defs/askForAppToLaunch" }
}
},
"analyze": {
"description": "Analyze action.",
"type": "object",
"properties": {
"config": { "$ref": "#/$defs/config" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" }
}
},
"archive": {
"description": "Archive action.",
"type": "object",
"properties": {
"customArchiveName": {
"description": "the custom name to give to the archive",
"type": "string"
},
"revealArchiveInOrganizer": {
"description": "flag to determine whether the archive will be revealed in Xcode's Organizer after it's done building",
"type": "boolean"
},
"config": { "$ref": "#/$defs/config" },
"preActions": { "$ref": "#/$defs/preActions" },
"postActions": { "$ref": "#/$defs/postActions" }
}
},
"management": {
"description": "Archive action.",
"type": "object",
"properties": {
"shared": {
"description": "indicates whether the scheme is shared",
"type": "boolean"
},
"orderHint": {
"description": "used by Xcode to sort the schemes",
"type": "integer"
},
"isShown": {
"description": "indicates whether the sheme is shown in the scheme list",
"type": "boolean"
}
}
}
},
"$defs": {
"config": {
"description": "All build actions can be set to use a certain config. If a config, or the build action itself, is not defined the first configuration found of a certain type will be used, depending on the type:\n-debug: run, test, analyze\n-release: profile, archive",
"type": "string",
"examples": ["debug", "release"]
},
"commandLineArguments": {
"description": "run, test and profile actions have a map of command line arguments to whether they are enabled",
"type": "object"
},
"preActions": {
"description": "Scripts that are run before the action",
"type": "array",
"items": {
"$ref": "execution_action.json"
}
},
"postActions": {
"description": "Scripts that are run after the action",
"type": "array",
"items": {
"$ref": "execution_action.json"
}
},
"environmentVariables": {
"description": "Scripts that are run after the action",
"oneOf": [
{
"type": "array",
"items": {
"properties": {
"variable": {
"description": "variable's name.",
"type": "string"
},
"value": { "description": "variable's value.", "type": "string" },
"isEnabled": {
"description": "indicates whether the environment variable is enabled. This defaults to true.",
"type": "boolean",
"default": true
}
}
}
},
{ "type": "object", "additionalProperties": { "type": "string" } }
]
},
"enableGPUFrameCaptureMode": {
"description": "Property value set for GPU Frame Capture. Possible values are autoEnabled, metal, openGL, disabled. Default is autoEnabled.",
"type": "string",
"default": "autoEnabled",
"enum": ["autoEnabled", "metal", "openGL", "disabled"],
"examples": ["autoEnabled", "metal", "openGL", "disabled"]
},
"disableMainThreadChecker": {
"description": "run and test actions can define a boolean that indicates that this scheme should disable the Main Thread Checker. This defaults to false",
"type": "boolean",
"default": false
},
"language": {
"description": "run and test actions can define a language that is used for Application Language",
"type": "string"
},
"region": {
"description": "run and test actions can define a language that is used for Application Region",
"type": "string"
},
"debugEnabled": {
"description": "run and test actions can define a whether debugger should be used. This defaults to true.",
"type": "boolean",
"default": true
},
"simulateLocation": {
"description": "run action can define a simulated location",
"type": "object",
"properties": {
"allow": {
"description": "enable location simulation",
"type": "boolean"
},
"defaultLocation": {
"description": "set the default location, possible values:",
"type": "string",
"examples": [
"London, England",
"Johannesburg, South Africa",
"Moscow, Russia",
"Mumbai, India",
"Tokyo, Japan",
"Sydney, Australia",
"Hong Kong, China",
"Honolulu, HI, USA",
"San Francisco, CA, USA",
"Mexico City, Mexico",
"New York, NY, USA",
"Rio de Janeiro, Brazil",
"<relative-path-to-gpx-file> (e.g. ./location.gpx) Setting the defaultLocation to a custom gpx file, you also need to add that file to fileGroups for Xcode be able to use it."
]
}
}
},
"askForAppToLaunch": {
"description": "run and profile actions can define the executable set to ask to launch. This defaults to false.",
"type": "boolean",
"default": false
},
"launchAutomaticallySubstyle": {
"description": "run action can define the launch automatically substyle ('2' for extensions).",
"type": "string"
},
"storeKitConfiguration": {
"description": "run action can specify a storekit configuration. See Options.",
"type": "string"
},
"macroExpansion": {
"description": "run action can define the macro expansion from other target. This defaults to nil.",
"type": "string"
}
},
"required": []
}

View File

@ -0,0 +1,84 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Sources Object",
"description": "Source directories of the target\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#sources",
"properties": {
"path": {
"description": "The path to the source file or directory.",
"type": "string"
},
"name": {
"description": "Can be used to override the name of the source file or directory. By default the last component of the path is used for the name",
"type": "string"
},
"group": {
"description": "Can be used to override the parent group of the source file or directory. By default a group is created at the root with the name of this source file or directory or intermediate groups are created if 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.",
"type": "string"
},
"compilerFlags": {
"description": "A list of compilerFlags to add to files under this specific path provided as a list or a space delimited string. Defaults to empty.",
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"excludes": {
"description": "A list of global patterns representing the files to exclude. These rules are relative to path and not the directory where project.yml resides. XcodeGen uses Bash 4's Glob behaviors where globstar (**) is enabled."
},
"includes": {
"description": "A list of global patterns in the same format as 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.",
"type": "array",
"items": {
"type": "string",
"minItems": 1
}
},
"createIntermediateGroups": {
"description": "This overrides the value in Options",
"type": "boolean"
},
"optional": {
"description": "Disable missing path check. Defaults to false.",
"type": "boolean",
"default": false
},
"buildPhase": {
"description": "This manually sets the build phase this file or files in this directory will be added to, otherwise XcodeGen will guess based on the file extension. Note that Info.plist files will never be added to any build phases, no matter what this setting is",
"oneOf": [
{
"type": "string",
"patternProperties": {
"copyFiles": { "type": "object" }
},
"enum": ["sources", "resources", "headers", "copyFiles", "none"],
"examples": ["sources", "resources", "headers", "copyFiles", "none"]
},
{
"type": "object",
"properties": {
"copyFiles": { "type": "object" }
}
}
]
},
"type": {
"description": "This can be one of the following values",
"type": "string",
"enum": ["file", "group", "folder"],
"examples": ["file", "group", "folder"]
},
"headerVisibility": {
"description": "The visibility of any headers. This defaults to public",
"default": "public",
"enum": ["public", "private", "project"],
"examples": ["public", "private", "project"]
},
"attributes": {
"description": "Additional settings attributes that will be applied to any build files."
},
"resourceTags": {
"description": "On Demand Resource Tags that will be applied to any resources. This also adds to the project attribute's knownAssetTags"
}
},
"required": ["path"]
}

View File

@ -0,0 +1,129 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "XcodeGen Target Object",
"description": "XcodeGen Target Object.\n https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#target",
"type": "object",
"properties": {
"type": {
"description": "Product type of the target"
},
"platform": {
"description": "Platform of the target",
"$ref": "platform.json"
},
"deploymentTarget": {
"description": "The deployment target (eg 9.2). If this is not specified the value from the project set in Options.deploymentTarget.PLATFORM will be used.",
"oneOf": [{ "type": "string" }, { "type": "number" }]
},
"sources": {
"description": "Source directories of the target\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#sources",
"oneOf": [
{
"type": "array",
"items": {
"minItems": 1,
"$ref": "sources.json"
}
},
{ "type": "string" }
]
},
"configFiles": {
"description": ".xcconfig files per config",
"type": "object",
"$ref": "config_files.json"
},
"settings": {
"description": "Target specific build settings. Default platform and product type settings will be applied first before any custom settings defined here.\nhttps://developer.apple.com/documentation/xcode/build-settings-reference\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#settings",
"type": "object",
"$ref": "xcode_settings.json"
},
"dependencies": {
"description": "Dependencies for the target\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#dependency",
"type": "array",
"items": {
"$ref": "dependency.json"
}
},
"info": {
"description": "If defined, this will generate and write an Info.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."
},
"entitlements": {
"description": "If defined this will generate and write a .entitlements file, and use it by setting CODE_SIGN_ENTITLEMENTS build setting for every configuration. All properties must be provided"
},
"templates": {
"description": "A list of Target Templates referenced by name that will be merged with the target in order. Any instances of ${target_name} within these templates will be replaced with the target name.",
"type": "array",
"items": {
"type": "string",
"minItems": 1,
"uniqueItems": true
}
},
"templateAttributes": {
"description": "A list of Target Templates referenced by name that will be merged with the target in order. Any instances of ${target_name} within these templates will be replaced with the target name.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"transitivelyLinkDependencies": {
"description": "If this is not specified the value from the project set in Options.transitivelyLinkDependencies will be used.",
"type": "boolean"
},
"directlyEmbedCarthageDependencies": {
"description": "If this is 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.",
"type": "boolean"
},
"requiresObjCLinking": {
"description": "If this is 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.",
"type": "boolean"
},
"onlyCopyFilesOnInstall": {
"description": "If this is true, the Embed Frameworks and Embed App Extensions (if available) build phases will have the \"Copy only when installing\" chekbox checked. Defaults to false.",
"type": "boolean",
"default": false
},
"preBuildScripts": {
"description": "Build scripts that run before any other build phases",
"type": "array",
"items": {
"$ref": "build_script.json",
"minItems": 1
}
},
"postCompileScripts": {
"description": "Build scripts that run after the Compile Sources phase",
"type": "array",
"items": {
"$ref": "build_script.json",
"minItems": 1
}
},
"postBuildScripts": {
"description": "Build scripts that run after any other build phases\nhttps://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#build-script",
"type": "array",
"items": {
"$ref": "build_script.json",
"minItems": 1
}
},
"buildRules": {
"description": "Custom build rules"
},
"scheme": {
"description": "Generated scheme with tests or config variants"
},
"legacy": {
"description": "When present, opt-in to make an Xcode \"External Build System\" legacy target instead."
},
"attributes": {
"description": "This sets values in the project 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:\n- DevelopmentTeam: if all configurations have the same\n- DEVELOPMENT_TEAM setting\n-ProvisioningStyle: if all configurations have the same CODE_SIGN_STYLE setting\n-TestTargetID: if all configurations have the same TEST_TARGET_NAME setting"
},
"putResourcesBeforeSourcesBuildPhase": {
"description": "If this is true the Copy Resources step will be placed before the Compile Sources build step.",
"type": "boolean"
}
},
"required": []
}

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,20 @@
## Next Version
## 2.41.0
### Added
- Added `xcodegen cache` command that writes the cache. Useful for `post-commit` git hook integration #1476 @yonaskolb
### Changed
- Include folders in file sorting #1466 @jflan-dd
### Fixed
- Fixed `supportedDestinations` validation when it contains watchOS for multiplatform apps. #1470 @tatsuky
## 2.40.1
### Fixed

View File

@ -2,7 +2,6 @@
These are a bunch of real world examples of XcodeGen project specs. Feel free to add your own via PR.
- [num42/RxUserDefaults](https://github.com/num42/RxUserDefaults/blob/master/Examples/CocoaPodsExample.yml)
- [toshi0383/Bitrise-iOS](https://github.com/toshi0383/Bitrise-iOS/blob/master/project.yml)
- [johndpope/swift-models](https://github.com/johndpope/swift-models/tree/stable/Inference)
- [atelier-socle/AppRepositoryTemplate](https://github.com/atelier-socle/AppRepositoryTemplate/blob/master/project.yml)

View File

@ -9,10 +9,14 @@ Absolutely. You will get the most out of XcodeGen by adding your project to your
>Note that you can run `xcodegen` as a step in your build process on CI.
## What happens when I switch branches
If files were added or removed in the new checkout you will most likely need to run `xcodegen` again so that your project will reference all your files. Unfortunately this is a manual step at the moment, but in the future this could be automated.
If files were added or removed in the new checkout you will most likely need to run `xcodegen` again so that your project will reference all your files.
For now you can always add xcodegen as a git `post-checkout` hook.
It's recommended to use `--use-cache` so that the project is not needlessly generated.
It's recommended to set up some [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) to automate the process:
- run `xcodegen generate --use-cache` on the following hooks. This will make sure the project is up to date when checking out, merging and rebasing
- `post-checkout`
- `post-rewrite`
- `post-merge`
- run `xcodegen cache` on `pre-commit`. This will make sure that when switching branches the cache will be updated in case you made local changes, or are ammending a commit that added a new file.
## Can I use CocoaPods
Yes, you will just need to run `pod install` after the project is generated to integrate Cocoapods changes.

View File

@ -500,7 +500,7 @@ targets:
destinationFilters: [iOS]
```
Note that the definition of supported destinations can be applied to every type of bundle making everything more easy to manage (app targets, unit tests, UI tests etc).
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](https://developer.apple.com/documentation/xcode/configuring-a-multiplatform-app-target) for details.
### Sources

View File

@ -1,6 +1,6 @@
TOOL_NAME = XcodeGen
export EXECUTABLE_NAME = xcodegen
VERSION = 2.40.1
VERSION = 2.41.0
PREFIX = /usr/local
INSTALL_PATH = $(PREFIX)/bin/$(EXECUTABLE_NAME)

View File

@ -113,7 +113,7 @@ swift run xcodegen
Add the following to your Package.swift file's dependencies:
```swift
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.40.1"),
.package(url: "https://github.com/yonaskolb/XcodeGen.git", from: "2.41.0"),
```
And then import wherever needed: `import XcodeGenKit`
@ -136,7 +136,7 @@ Options:
- **--use-cache**: Used to prevent unnecessarily generating the project. If this is set, then a cache file will be written to when a project is generated. If `xcodegen` is later run but the spec and all the files it contains are the same, the project won't be generated.
- **--cache-path**: A custom path to use for your cache file. This defaults to `~/.xcodegen/cache/{PROJECT_SPEC_PATH_HASH}`
There are other commands as well such as `xcodegen dump` which lets out output the resolved spec in many different formats, or write it to a file. Use `xcodegen help` to see more detailed usage information.
There are other commands as well such as `xcodegen dump` which lets one output the resolved spec in many different formats, or write it to a file. Use `xcodegen help` to see more detailed usage information.
## Dependency Diagrams
<details>

View File

@ -185,6 +185,12 @@ extension Project {
errors.append(.unexpectedTargetPlatformForSupportedDestinations(target: target.name, platform: target.platform))
}
if let supportedDestinations = target.supportedDestinations,
target.type.isApp,
supportedDestinations.contains(.watchOS) {
errors.append(.containsWatchOSDestinationForMultiplatformApp(target: target.name))
}
if target.supportedDestinations?.contains(.macOS) == true,
target.supportedDestinations?.contains(.macCatalyst) == true {

View File

@ -19,6 +19,7 @@ public struct SpecValidationError: Error, CustomStringConvertible {
case invalidTargetSchemeTest(target: String, testTarget: String)
case invalidTargetPlatformForSupportedDestinations(target: String)
case unexpectedTargetPlatformForSupportedDestinations(target: String, platform: Platform)
case containsWatchOSDestinationForMultiplatformApp(target: String)
case multipleMacPlatformsInSupportedDestinations(target: String)
case missingTargetPlatformInSupportedDestinations(target: String, platform: Platform)
case invalidSchemeTarget(scheme: String, target: String, action: String)
@ -66,6 +67,8 @@ public struct SpecValidationError: Error, CustomStringConvertible {
return "Target \(target.quoted) has multiple definitions of mac platforms in supported destinations"
case let .missingTargetPlatformInSupportedDestinations(target, platform):
return "Target \(target.quoted) has platform \(platform.rawValue.quoted) that is missing in supported destinations"
case let .containsWatchOSDestinationForMultiplatformApp(target):
return "Multiplatform app \(target.quoted) cannot contain watchOS in \"supportedDestinations\". Create a separate target using \"platform\" for watchOS apps"
case let .invalidConfigFile(configFile, config):
return "Invalid config file \(configFile.quoted) for config \(config.quoted)"
case let .invalidSchemeTarget(scheme, target, action):

View File

@ -3,6 +3,6 @@ import ProjectSpec
import XcodeGenCLI
import Version
let version = Version("2.40.1")
let version = Version("2.41.0")
let cli = XcodeGenCLI(version: version)
cli.execute()

View File

@ -0,0 +1,44 @@
import Foundation
import PathKit
import ProjectSpec
import SwiftCLI
import XcodeGenKit
import XcodeProj
import Version
class CacheCommand: ProjectCommand {
@Key("--cache-path", description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}")
var cacheFilePath: Path?
init(version: Version) {
super.init(version: version,
name: "cache",
shortDescription: "Write the project cache")
}
override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {
let cacheFilePath = self.cacheFilePath ?? Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
var cacheFile: CacheFile?
// generate cache
do {
cacheFile = try specLoader.generateCacheFile()
} catch {
throw GenerationError.projectSpecParsingError(error)
}
// write cache
if let cacheFile = cacheFile {
do {
try cacheFilePath.parent().mkpath()
try cacheFilePath.write(cacheFile.string)
success("Wrote cache to \(cacheFilePath)")
} catch {
info("Failed to write cache: \(error.localizedDescription)")
}
}
}
}

View File

@ -49,7 +49,7 @@ class DumpCommand: ProjectCommand {
try file.parent().mkpath()
try file.write(output)
} else {
stdout.print(output)
success(output)
}
}
}

View File

@ -8,9 +8,6 @@ import Version
class GenerateCommand: ProjectCommand {
@Flag("-q", "--quiet", description: "Suppress all informational and success output")
var quiet: Bool
@Flag("-c", "--use-cache", description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed")
var useCache: Bool
@ -46,7 +43,7 @@ class GenerateCommand: ProjectCommand {
Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute()
var cacheFile: CacheFile?
// read cache
// generate cache
if useCache || self.cacheFilePath != nil {
do {
cacheFile = try specLoader.generateCacheFile()
@ -138,22 +135,4 @@ class GenerateCommand: ProjectCommand {
try Task.run(bash: command, directory: projectDirectory.absolute().string)
}
}
func info(_ string: String) {
if !quiet {
stdout.print(string)
}
}
func warning(_ string: String) {
if !quiet {
stdout.print(string.yellow)
}
}
func success(_ string: String) {
if !quiet {
stdout.print(string.green)
}
}
}

View File

@ -12,6 +12,9 @@ class ProjectCommand: Command {
let name: String
let shortDescription: String
@Flag("-q", "--quiet", description: "Suppress all informational and success output")
var quiet: Bool
@Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml. (It is also possible to link to multiple spec files by comma separating them. Note that all other flags will be the same.)")
var spec: String?
@ -58,4 +61,22 @@ class ProjectCommand: Command {
}
func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws {}
func info(_ string: String) {
if !quiet {
stdout.print(string)
}
}
func warning(_ string: String) {
if !quiet {
stdout.print(string.yellow)
}
}
func success(_ string: String) {
if !quiet {
stdout.print(string.green)
}
}
}

View File

@ -15,6 +15,7 @@ public class XcodeGenCLI {
description: "Generates Xcode projects",
commands: [
generateCommand,
CacheCommand(version: version),
DumpCommand(version: version),
]
)

View File

@ -631,8 +631,8 @@ public class PBXProjGenerator {
}
if let order = groupOrdering?.order {
let files = group.children.filter { $0 is PBXFileReference }
var groups = group.children.filter { $0 is PBXGroup }
let files = group.children.filter { !$0.isGroupOrFolder }
var groups = group.children.filter { $0.isGroupOrFolder }
var filteredGroups = [PBXFileElement]()
@ -1626,6 +1626,10 @@ extension Platform {
}
extension PBXFileElement {
/// - returns: `true` if the element is a group or a folder reference. Likely an SPM package.
var isGroupOrFolder: Bool {
self is PBXGroup || (self as? PBXFileReference)?.lastKnownFileType == "folder"
}
public func getSortOrder(groupSortPosition: SpecOptions.GroupSortPosition) -> Int {
if type(of: self).isa == "PBXGroup" {

View File

@ -203,6 +203,32 @@ class ProjectSpecTests: XCTestCase {
try expectValidationError(project, .unexpectedTargetPlatformForSupportedDestinations(target: "target1", platform: .watchOS))
}
$0.it("watchOS in multiplatform app's supported destinations") {
var project = baseProject
project.targets = [
Target(
name: "target1",
type: .application,
platform: .auto,
supportedDestinations: [.watchOS]
)
]
try expectValidationError(project, .containsWatchOSDestinationForMultiplatformApp(target: "target1"))
}
$0.it("watchOS in non-app's supported destinations") {
var project = baseProject
project.targets = [
Target(
name: "target1",
type: .framework,
platform: .auto,
supportedDestinations: [.watchOS]
)
]
try expectNoValidationError(project, .containsWatchOSDestinationForMultiplatformApp(target: "target1"))
}
$0.it("multiple definitions of mac platform in supported destinations") {
var project = baseProject
project.targets = [

View File

@ -259,6 +259,96 @@ class PBXProjGeneratorTests: XCTestCase {
.map { $0.nameOrPath }
try expect(screenGroups) == ["mainScreen1.swift", "mainScreen2.swift", "View", "Presenter", "Interactor", "Entities", "Assembly"]
}
$0.it("sorts SPM packages") {
var options = SpecOptions()
options.groupSortPosition = .top
options.groupOrdering = [
GroupOrdering(
order: [
"Sources",
"Resources",
"Tests",
"Packages",
"Support files",
"Configurations",
]
),
GroupOrdering(
pattern: "Packages",
order: [
"FeatureA",
"FeatureB",
"Common",
]
),
]
let directories = """
Configurations:
- file.swift
Resources:
- file.swift
Sources:
- MainScreen:
- mainScreen1.swift
- mainScreen2.swift
- Assembly:
- file.swift
- Entities:
- file.swift
- Interactor:
- file.swift
- Presenter:
- file.swift
- View:
- file.swift
Support files:
- file.swift
Packages:
- Common:
- Package.swift
- FeatureA:
- Package.swift
- FeatureB:
- Package.swift
Tests:
- file.swift
UITests:
- file.swift
"""
try createDirectories(directories)
let target = Target(name: "Test", type: .application, platform: .iOS, sources: ["Configurations", "Resources", "Sources", "Support files", "Tests", "UITests"])
let project = Project(
basePath: directoryPath,
name: "Test",
targets: [target],
packages: [
"Common": .local(path: "Packages/Common", group: nil),
"FeatureA": .local(path: "Packages/FeatureA", group: nil),
"FeatureB": .local(path: "Packages/FeatureB", group: nil),
],
options: options
)
let projGenerator = PBXProjGenerator(project: project)
let pbxProj = try project.generatePbxProj()
let group = try pbxProj.getMainGroup()
projGenerator.setupGroupOrdering(group: group)
let mainGroups = group.children.map { $0.nameOrPath }
try expect(mainGroups) == ["Sources", "Resources", "Tests", "Packages", "Support files", "Configurations", "UITests", "Products"]
let packages = group.children
.first { $0.nameOrPath == "Packages" }
.flatMap { $0 as? PBXGroup }?
.children
.map(\.nameOrPath)
try expect(packages) == ["FeatureA", "FeatureB", "Common"]
}
}
}

View File

@ -485,8 +485,8 @@ class ProjectGeneratorTests: XCTestCase {
try expect(targetConfig1.buildSettings["CODE_SIGN_IDENTITY"] as? String) == "iPhone Developer"
}
$0.it("supportedDestinations merges settings - iOS, watchOS") {
let target = Target(name: "Target", type: .application, platform: .auto, supportedDestinations: [.iOS, .watchOS])
$0.it("supportedDestinations merges settings - iOS, watchOS (framework)") {
let target = Target(name: "Target", type: .framework, platform: .auto, supportedDestinations: [.iOS, .watchOS])
let project = Project(name: "", targets: [target])
let pbxProject = try project.generatePbxProj()
@ -499,8 +499,8 @@ class ProjectGeneratorTests: XCTestCase {
try expect(targetConfig1.buildSettings["SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD"] as? Bool) == true
}
$0.it("supportedDestinations merges settings - visionOS, watchOS") {
let target = Target(name: "Target", type: .application, platform: .auto, supportedDestinations: [.visionOS, .watchOS])
$0.it("supportedDestinations merges settings - visionOS, watchOS (framework)") {
let target = Target(name: "Target", type: .framework, platform: .auto, supportedDestinations: [.visionOS, .watchOS])
let project = Project(name: "", targets: [target])
let pbxProject = try project.generatePbxProj()