rename deploymentTargets to deploymentTarget

This commit is contained in:
Yonas Kolb 2017-12-26 17:48:01 +08:00
parent cd6d179325
commit e3a6739b2a
7 changed files with 16 additions and 16 deletions

View File

@ -76,11 +76,11 @@ Note that target names can also be changed by adding a `name` property to a targ
- [ ] **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`
- [ ] **deploymentTargets**: **[[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.
- [ ] **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.
```yaml
options:
deploymentTargets:
deploymentTarget:
watchOS: 2.0
tvOS: 10.0
```
@ -145,7 +145,7 @@ Settings are merged in the following order: groups, base, configs.
- [x] **type**: **[Product Type](#product-type)** - Product type of the target
- [x] **platform**: **[Platform](#platform)** - Platform of the target
- [ ] **deploymentTarget**: **String or Double** - The deployment target eg (11.0). If this is not specified the value from the project set in [Options](#options)`.deploymentTargets.PLATFORM` will be used.
- [ ] **deploymentTarget**: **String or Double** - The deployment target eg (11.0). If this is not specified the value from the project set in [Options](#options)`.deploymentTarget.PLATFORM` will be used.
- [ ] **sources**: **[Sources](#sources)** - Source directories of the target
- [ ] **configFiles**: **[Config Files](#config-files)** - `.xcconfig` files per config
- [ ] **settings**: **[Settings](#settings)** - Target specific build settings. Default platform and product type settings will be applied first before any custom settings defined here. Other context dependant settings will be set automatically as well:

View File

@ -9,7 +9,7 @@ import Foundation
import xcproj
import JSONUtilities
public struct DeploymentTargets: Equatable {
public struct DeploymentTarget: Equatable {
public var iOS: Version?
public var tvOS: Version?
@ -32,7 +32,7 @@ public struct DeploymentTargets: Equatable {
}
}
public static func == (lhs: DeploymentTargets, rhs: DeploymentTargets) -> Bool {
public static func == (lhs: DeploymentTarget, rhs: DeploymentTarget) -> Bool {
return lhs.iOS == rhs.iOS &&
lhs.tvOS == rhs.tvOS &&
lhs.watchOS == rhs.watchOS &&
@ -60,7 +60,7 @@ extension Version {
}
}
extension DeploymentTargets: JSONObjectConvertible {
extension DeploymentTarget: JSONObjectConvertible {
public init(jsonDictionary: JSONDictionary) throws {

View File

@ -29,7 +29,7 @@ public struct ProjectSpec {
public var tabWidth: Int?
public var indentWidth: Int?
public var xcodeVersion: String?
public var deploymentTargets: DeploymentTargets
public var deploymentTarget: DeploymentTarget
public enum SettingPresets: String {
case all
@ -52,7 +52,7 @@ public struct ProjectSpec {
}
}
public init(carthageBuildPath: String? = nil, createIntermediateGroups: Bool = false, bundleIdPrefix: String? = nil, settingPresets: SettingPresets = .all, developmentLanguage: String? = nil, indentWidth: Int? = nil, tabWidth: Int? = nil, usesTabs: Bool? = nil, xcodeVersion: String? = nil, deploymentTargets: DeploymentTargets = .init()) {
public init(carthageBuildPath: String? = nil, createIntermediateGroups: Bool = false, bundleIdPrefix: String? = nil, settingPresets: SettingPresets = .all, developmentLanguage: String? = nil, indentWidth: Int? = nil, tabWidth: Int? = nil, usesTabs: Bool? = nil, xcodeVersion: String? = nil, deploymentTarget: DeploymentTarget = .init()) {
self.carthageBuildPath = carthageBuildPath
self.createIntermediateGroups = createIntermediateGroups
self.bundleIdPrefix = bundleIdPrefix
@ -62,7 +62,7 @@ public struct ProjectSpec {
self.indentWidth = indentWidth
self.usesTabs = usesTabs
self.xcodeVersion = xcodeVersion
self.deploymentTargets = deploymentTargets
self.deploymentTarget = deploymentTarget
}
public static func == (lhs: ProjectSpec.Options, rhs: ProjectSpec.Options) -> Bool {
@ -75,7 +75,7 @@ public struct ProjectSpec {
lhs.indentWidth == rhs.indentWidth &&
lhs.usesTabs == rhs.usesTabs &&
lhs.xcodeVersion == rhs.xcodeVersion &&
lhs.deploymentTargets == rhs.deploymentTargets
lhs.deploymentTarget == rhs.deploymentTarget
}
}
@ -178,6 +178,6 @@ extension ProjectSpec.Options: JSONObjectConvertible {
usesTabs = jsonDictionary.json(atKeyPath: "usesTabs")
indentWidth = jsonDictionary.json(atKeyPath: "indentWidth")
tabWidth = jsonDictionary.json(atKeyPath: "tabWidth")
deploymentTargets = jsonDictionary.json(atKeyPath: "deploymentTargets") ?? DeploymentTargets()
deploymentTarget = jsonDictionary.json(atKeyPath: "deploymentTarget") ?? DeploymentTarget()
}
}

View File

@ -17,7 +17,7 @@ extension ProjectSpec {
// apply custom platform version
for platform in Platform.all {
if let version = options.deploymentTargets.version(for: platform) {
if let version = options.deploymentTarget.version(for: platform) {
buildSettings[platform.deploymentTargetSetting] = version.deploymentTarget
}
}

View File

@ -5,7 +5,7 @@ options:
usesTabs: false
indentWidth: 2
tabWidth: 2
deploymentTargets:
deploymentTarget:
watchOS: 2.0
fileGroups:
- Configs

View File

@ -166,7 +166,7 @@ func projectGeneratorTests() {
$0.it("generates platform version") {
let target = Target(name: "Target", type: .application, platform: .watchOS, deploymentTarget: "2.0")
let spec = ProjectSpec(basePath: "", name: "", targets: [target], options: .init(deploymentTargets: DeploymentTargets(iOS: "10.0", watchOS: "3.0")))
let spec = ProjectSpec(basePath: "", name: "", targets: [target], options: .init(deploymentTarget: DeploymentTarget(iOS: "10.0", watchOS: "3.0")))
let pbxProject = try getPbxProj(spec)

View File

@ -230,7 +230,7 @@ func specLoadingTests() {
createIntermediateGroups: true,
bundleIdPrefix: "com.test",
developmentLanguage: "ja",
deploymentTargets: DeploymentTargets(
deploymentTarget: DeploymentTarget(
iOS: "11.1",
tvOS: "10.0",
watchOS: "3.0",
@ -241,7 +241,7 @@ func specLoadingTests() {
"bundleIdPrefix": "com.test",
"createIntermediateGroups": true,
"developmentLanguage": "ja",
"deploymentTargets": ["iOS": 11.1, "tvOS": 10.0, "watchOS": "3", "macOS": "10.12.1" ]
"deploymentTarget": ["iOS": 11.1, "tvOS": 10.0, "watchOS": "3", "macOS": "10.12.1" ]
]]
let parsedSpec = try getProjectSpec(dictionary)
try expect(parsedSpec) == expected