Skip to content

Commit 1ff9732

Browse files
committed
Added ability to specify project format version via projectFormat option
1 parent 7b0e4e8 commit 1ff9732

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

Docs/ProjectSpec.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ Note that target names can also be changed by adding a `name` property to a targ
133133
- [ ] **indentWidth**: **Int** - If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.
134134
- [ ] **tabWidth**: **Int** - If this is specified, the Xcode project will override the user's setting for indent width in number of spaces.
135135
- [ ] **xcodeVersion**: **String** - The version of Xcode. This defaults to the latest version periodically. You can specify it in the format `0910` or `9.1`
136+
- [ ] **projectFormat**: **String** - The version of Xcode project. By default this is set to `xcode16_0`
137+
- `xcode16_3`: Xcode 16.3
138+
- `xcode16_0`: Xcode 16.0
139+
- `xcode15_3`: Xcode 15.3
140+
- `xcode15_0`: Xcode 15.0
141+
- `xcode14_0`: Xcode 14.0
142+
136143
- [ ] **deploymentTarget**: **[[Platform](#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](#target).deploymentTarget.
137144
- [ ] **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:
138145
- `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 projects
@@ -156,7 +163,7 @@ Note that target names can also be changed by adding a `name` property to a targ
156163
- [ ] **defaultSourceDirectoryType**: **String** - When a [Target source](#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.
157164
- `group` (default)
158165
- `folder`
159-
- `syncedFolder`
166+
- `syncedFolder`: Can be used starting from **projectFormat** `xcode16_0`
160167

161168
```yaml
162169
options:

Sources/ProjectSpec/SpecOptions.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public struct SpecOptions: Equatable {
2424
public var tabWidth: UInt?
2525
public var indentWidth: UInt?
2626
public var xcodeVersion: String?
27+
public var projectFormat: String?
2728
public var deploymentTarget: DeploymentTarget
2829
public var defaultConfig: String?
2930
public var transitivelyLinkDependencies: Bool
@@ -88,6 +89,7 @@ public struct SpecOptions: Equatable {
8889
tabWidth: UInt? = nil,
8990
usesTabs: Bool? = nil,
9091
xcodeVersion: String? = nil,
92+
projectFormat: String? = nil,
9193
deploymentTarget: DeploymentTarget = .init(),
9294
disabledValidations: [ValidationType] = [],
9395
defaultConfig: String? = nil,
@@ -115,6 +117,7 @@ public struct SpecOptions: Equatable {
115117
self.indentWidth = indentWidth
116118
self.usesTabs = usesTabs
117119
self.xcodeVersion = xcodeVersion
120+
self.projectFormat = projectFormat
118121
self.deploymentTarget = deploymentTarget
119122
self.disabledValidations = disabledValidations
120123
self.defaultConfig = defaultConfig
@@ -148,6 +151,7 @@ extension SpecOptions: JSONObjectConvertible {
148151
developmentLanguage = jsonDictionary.json(atKeyPath: "developmentLanguage")
149152
usesTabs = jsonDictionary.json(atKeyPath: "usesTabs")
150153
xcodeVersion = jsonDictionary.json(atKeyPath: "xcodeVersion")
154+
projectFormat = jsonDictionary.json(atKeyPath: "projectFormat")
151155
indentWidth = (jsonDictionary.json(atKeyPath: "indentWidth") as Int?).flatMap(UInt.init)
152156
tabWidth = (jsonDictionary.json(atKeyPath: "tabWidth") as Int?).flatMap(UInt.init)
153157
deploymentTarget = jsonDictionary.json(atKeyPath: "deploymentTarget") ?? DeploymentTarget()
@@ -186,6 +190,7 @@ extension SpecOptions: JSONEncodable {
186190
"developmentLanguage": developmentLanguage,
187191
"usesTabs": usesTabs,
188192
"xcodeVersion": xcodeVersion,
193+
"projectFormat": projectFormat,
189194
"indentWidth": indentWidth.flatMap { Int($0) },
190195
"tabWidth": tabWidth.flatMap { Int($0) },
191196
"defaultConfig": defaultConfig,

Sources/XcodeGenKit/ProjectFormat.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ public extension ProjectFormat {
22
static let `default`: ProjectFormat = .xcode16_0
33
}
44

5-
public enum ProjectFormat {
5+
public enum ProjectFormat: String {
66
case xcode16_3
77
case xcode16_0
88
case xcode15_3

Sources/XcodeGenKit/Version.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ extension Project {
77
XCodeVersion.parse(options.xcodeVersion ?? "14.3")
88
}
99

10+
public var projectFormat: ProjectFormat {
11+
options.projectFormat.flatMap(ProjectFormat.init) ?? .default
12+
}
13+
1014
var schemeVersion: String {
1115
"1.7"
1216
}
1317

1418
var compatibilityVersion: String? {
15-
ProjectFormat.default.compatibilityVersion
19+
projectFormat.compatibilityVersion
1620
}
1721

1822
var objectVersion: UInt {
19-
ProjectFormat.default.objectVersion
23+
projectFormat.objectVersion
2024
}
2125

2226
var preferredProjectObjectVersion: UInt? {
23-
ProjectFormat.default.preferredProjectObjectVersion
27+
projectFormat.preferredProjectObjectVersion
2428
}
2529

2630
var minimizedProjectReferenceProxies: Int {

0 commit comments

Comments
 (0)