From f143b907f89576eac6b190cd1bde280b6da8e4eb Mon Sep 17 00:00:00 2001 From: Cameron Mc Gorian Date: Tue, 21 Nov 2017 13:51:04 +0100 Subject: [PATCH] Review feedback --- Docs/ProjectSpec.md | 4 ++-- Sources/ProjectSpec/Dependency.swift | 10 ++++++---- Sources/XcodeGenKit/PBXProjGenerator.swift | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index e70d7c88..505a89b3 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -249,9 +249,9 @@ These only applied to `target` and `framework` dependencies. **Implicit Framework options**: -This only applies to `framework` dependencies. +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`. -- ⚪️ **implicit**: `Bool` - Whether the framework is an implicit dependency. This can be useful in a Workspace where projects are not nested within each other. +- ⚪️ **implicit**: `Bool` - Whether the framework is an implicit dependency. Defaults to `false` . **Carthage Dependency** diff --git a/Sources/ProjectSpec/Dependency.swift b/Sources/ProjectSpec/Dependency.swift index 8bc70616..08f82dc1 100644 --- a/Sources/ProjectSpec/Dependency.swift +++ b/Sources/ProjectSpec/Dependency.swift @@ -17,9 +17,9 @@ public struct Dependency: Equatable { public var codeSign: Bool = true public var removeHeaders: Bool = true public var link: Bool = true - public var implicit: Bool? + public var implicit: Bool = false - public init(type: DependencyType, reference: String, embed: Bool? = nil, link: Bool = true, implicit: Bool? = nil) { + public init(type: DependencyType, reference: String, embed: Bool? = nil, link: Bool = true, implicit: Bool = false) { self.type = type self.reference = reference self.embed = embed @@ -71,8 +71,7 @@ extension Dependency: JSONObjectConvertible { } embed = jsonDictionary.json(atKeyPath: "embed") - implicit = jsonDictionary.json(atKeyPath: "implicit") - + if let bool: Bool = jsonDictionary.json(atKeyPath: "link") { link = bool } @@ -82,5 +81,8 @@ extension Dependency: JSONObjectConvertible { if let bool: Bool = jsonDictionary.json(atKeyPath: "removeHeaders") { removeHeaders = bool } + if let bool: Bool = jsonDictionary.json(atKeyPath: "implicit") { + implicit = bool + } } } diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index f11de371..69b24b98 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -277,7 +277,7 @@ public class PBXProjGenerator { case .framework: let fileReference: String - if let implicit = dependency.implicit, implicit == true { + if dependency.implicit { fileReference = sourceGenerator.getFileReference(path: Path(dependency.reference), inPath: spec.basePath, sourceTree: .buildProductsDir) } else { fileReference = sourceGenerator.getFileReference(path: Path(dependency.reference), inPath: spec.basePath)