diff --git a/Sources/ProjectSpec/Target.swift b/Sources/ProjectSpec/Target.swift index 93504214..0037741e 100644 --- a/Sources/ProjectSpec/Target.swift +++ b/Sources/ProjectSpec/Target.swift @@ -201,6 +201,7 @@ public struct Dependency: Equatable { public var embed: Bool? public var codeSign: Bool = true public var removeHeaders: Bool = true + public var link: Bool = true public init(type: DependencyType, reference: String, embed: Bool? = nil) { self.type = type @@ -219,7 +220,8 @@ public struct Dependency: Equatable { lhs.type == rhs.type && lhs.codeSign == rhs.codeSign && lhs.removeHeaders == rhs.removeHeaders && - lhs.embed == rhs.embed + lhs.embed == rhs.embed && + lhs.link == rhs.link } public var buildSettings: [String: Any] { @@ -252,6 +254,9 @@ extension Dependency: JSONObjectConvertible { embed = jsonDictionary.json(atKeyPath: "embed") + if let bool: Bool = jsonDictionary.json(atKeyPath: "link") { + link = bool + } if let bool: Bool = jsonDictionary.json(atKeyPath: "codeSign") { codeSign = bool } diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index bfe12c90..6c50eb1a 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -248,7 +248,7 @@ public class PBXProjGenerator { addObject(targetDependency) dependencies.append(targetDependency.reference) - if dependencyTarget.type.isLibrary || dependencyTarget.type.isFramework { + if (dependencyTarget.type.isLibrary || dependencyTarget.type.isFramework) && dependency.link { let dependencyBuildFile = targetBuildFiles[dependencyTargetName]! let buildFile = PBXBuildFile(reference: generateUUID(PBXBuildFile.self, dependencyBuildFile.reference + target.name), fileRef: dependencyBuildFile.fileRef) addObject(buildFile) diff --git a/docs/ProjectSpec.md b/docs/ProjectSpec.md index e8bed454..2b0b892c 100644 --- a/docs/ProjectSpec.md +++ b/docs/ProjectSpec.md @@ -219,6 +219,7 @@ A dependency can be one of a 3 types: These only applied to `target` and `framework` dependencies. - ⚪️ **embed**: `Bool` - Whether to embed the dependency. Defaults to true for application target and false for non application targets. +- ⚪️ **link**: `Bool` - Whether to link the dependency. Defaults to true but only static library and dynamic frameworks are linked. This only applies for target dependencies. - ⚪️ **codeSign**: `Bool` - Whether the `codeSignOnCopy` setting is applied when embedding framework. Defaults to true - ⚪️ **removeHeaders**: `Bool` - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true