Add option for not linking dependencies

This adds a new attribute to Dependency that allows consumers to choose
to not link a dependency. This is useful for if you have this dependency
tree with static libraries:

App -> A -> Shared
App -> B -> Shared

Where A and B both share a static library dependency, that is finally
linked into App. If Shared is added to the link phase of A and B, you
end up with duplicate symbols during the link phase. With this change
consumers could set link: False on A and B's dependency on Shared, this
way Shared will get build before A and B, but not linked.
This commit is contained in:
Keith Smiley
2017-10-25 15:55:49 -07:00
parent 014b99cb29
commit 08de6077d9
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -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)