Skip to content

Commit 2d8a7c0

Browse files
Change name of field from 'conditionalPlatforms' to 'platforms'
1 parent e46b15b commit 2d8a7c0

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

Docs/ProjectSpec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ A dependency can be one of a 6 types:
429429
- [ ] **removeHeaders**: **Bool** - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true
430430
- [ ] **weak**: **Bool** - Whether the `Weak` setting is applied when linking the framework. Defaults to false
431431
- [ ] **platformFilter**: **String** - 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**
432-
- [ ] **conditionalPlatforms**: **[[Platform](#platform)]** - List of platforms this dependency should apply to. Defaults to all applicable platforms.
432+
- [ ] **platforms**: **[[Platform](#platform)]** - List of platforms this dependency should apply to. Defaults to all applicable platforms.
433433

434434
**Implicit Framework options**:
435435

Sources/ProjectSpec/Dependency.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct Dependency: Equatable {
1616
public var implicit: Bool = implicitDefault
1717
public var weakLink: Bool = weakLinkDefault
1818
public var platformFilter: PlatformFilter = platformFilterDefault
19-
public var conditionalPlatforms: Set<Platform>?
19+
public var platforms: Set<Platform>?
2020

2121
public init(
2222
type: DependencyType,
@@ -27,7 +27,7 @@ public struct Dependency: Equatable {
2727
implicit: Bool = implicitDefault,
2828
weakLink: Bool = weakLinkDefault,
2929
platformFilter: PlatformFilter = platformFilterDefault,
30-
conditionalPlatforms: Set<Platform>? = nil
30+
platforms: Set<Platform>? = nil
3131
) {
3232
self.type = type
3333
self.reference = reference
@@ -37,7 +37,7 @@ public struct Dependency: Equatable {
3737
self.implicit = implicit
3838
self.weakLink = weakLink
3939
self.platformFilter = platformFilter
40-
self.conditionalPlatforms = conditionalPlatforms
40+
self.platforms = platforms
4141
}
4242

4343
public enum PlatformFilter: String, Equatable {
@@ -132,8 +132,8 @@ extension Dependency: JSONObjectConvertible {
132132
self.platformFilter = .all
133133
}
134134

135-
if let conditionalPlatforms: [ProjectSpec.Platform] = jsonDictionary.json(atKeyPath: "conditionalPlatforms") {
136-
self.conditionalPlatforms = Set(conditionalPlatforms)
135+
if let platforms: [ProjectSpec.Platform] = jsonDictionary.json(atKeyPath: "platforms") {
136+
self.platforms = Set(platforms)
137137
}
138138
}
139139
}
@@ -144,7 +144,7 @@ extension Dependency: JSONEncodable {
144144
"embed": embed,
145145
"codeSign": codeSign,
146146
"link": link,
147-
"conditionalPlatforms": conditionalPlatforms?.map(\.rawValue).sorted()
147+
"platforms": platforms?.map(\.rawValue).sorted()
148148
]
149149

150150
if removeHeaders != Dependency.removeHeadersDefault {

Sources/ProjectSpec/Target.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ extension Target: NamedJSONDictionaryConvertible {
304304
let dependencies: [Dependency] = try jsonDictionary.json(atKeyPath: "dependencies", invalidItemBehaviour: .fail)
305305
self.dependencies = dependencies.filter { [platform] dependency -> Bool in
306306
// If unspecified, all platforms are supported
307-
guard let platforms = dependency.conditionalPlatforms else { return true }
307+
guard let platforms = dependency.platforms else { return true }
308308
return platforms.contains(platform)
309309
}
310310
}

Tests/Fixtures/TestProject/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ targets:
244244
- carthage: Result
245245
- target: StaticLibrary_ObjC_${platform}
246246
- target: Framework2_${platform}
247-
conditionalPlatforms: [tvOS, watchOS]
247+
platforms: [tvOS, watchOS]
248248

249249
Framework2:
250250
type: framework

Tests/ProjectSpecTests/SpecLoadingTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ class SpecLoadingTests: XCTestCase {
386386
"sdk": "Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework",
387387
"root": "DEVELOPER_DIR",
388388
],
389-
["target": "conditionalMatch", "conditionalPlatforms": ["iOS"]],
390-
["target": "conditionalMiss", "conditionalPlatforms": ["watchOS"]],
389+
["target": "conditionalMatch", "platforms": ["iOS"]],
390+
["target": "conditionalMiss", "platforms": ["watchOS"]],
391391
]
392392
let target = try Target(name: "test", jsonDictionary: targetDictionary)
393393
try expect(target.dependencies.count) == 8
@@ -398,7 +398,7 @@ class SpecLoadingTests: XCTestCase {
398398
try expect(target.dependencies[4]) == Dependency(type: .framework, reference: "path", weakLink: true)
399399
try expect(target.dependencies[5]) == Dependency(type: .sdk(root: nil), reference: "Contacts.framework")
400400
try expect(target.dependencies[6]) == Dependency(type: .sdk(root: "DEVELOPER_DIR"), reference: "Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework")
401-
try expect(target.dependencies[7]) == Dependency(type: .target, reference: "conditionalMatch", conditionalPlatforms: [.iOS])
401+
try expect(target.dependencies[7]) == Dependency(type: .target, reference: "conditionalMatch", platforms: [.iOS])
402402
}
403403

404404
$0.it("parses info plist") {

0 commit comments

Comments
 (0)