Allow to link dylib into static library only when 'link' is true (#635)

* Allow to link dylib into static library only when 'link' is true

* Add test case to proof that links only when true

* Update CHANGELOG.md
This commit is contained in:
Yuta Saito
2019-08-28 13:52:27 -05:00
committed by Brentley Jones
parent 62d39306ae
commit 458ba9de89
3 changed files with 34 additions and 14 deletions
+2 -10
View File
@@ -504,9 +504,6 @@ public class PBXProjGenerator {
let buildPath = Path(dependency.reference).parent().string.quoted
frameworkBuildPaths.insert(buildPath)
// Static libraries can't link or embed dynamic frameworks
guard target.type != .staticLibrary else { break }
let fileReference: PBXFileElement
if dependency.implicit {
fileReference = sourceGenerator.getFileReference(
@@ -521,7 +518,7 @@ public class PBXProjGenerator {
)
}
if dependency.link ?? true {
if dependency.link ?? (target.type != .staticLibrary) {
let buildFile = addObject(
PBXBuildFile(file: fileReference, settings: getDependencyFrameworkSettings(dependency: dependency))
)
@@ -540,8 +537,6 @@ public class PBXProjGenerator {
copyFrameworksReferences.append(embedFile)
}
case .sdk(let root):
// Static libraries can't link or embed dynamic frameworks
guard target.type != .staticLibrary else { break }
var dependencyPath = Path(dependency.reference)
if !dependency.reference.contains("/") {
@@ -589,8 +584,6 @@ public class PBXProjGenerator {
let allDependencies = findFrameworks
? carthageResolver.relatedDependencies(for: dependency, in: target.platform) : [dependency]
allDependencies.forEach { dependency in
// Static libraries can't link or embed dynamic frameworks
guard target.type != .staticLibrary else { return }
var platformPath = Path(carthageResolver.buildPath(for: target.platform))
var frameworkPath = platformPath + dependency.reference
@@ -601,7 +594,7 @@ public class PBXProjGenerator {
self.carthageFrameworksByPlatform[target.platform.carthageName, default: []].insert(fileReference)
if dependency.link ?? true {
if dependency.link ?? (target.type != .staticLibrary) {
let buildFile = self.addObject(
PBXBuildFile(file: fileReference, settings: getDependencyFrameworkSettings(dependency: dependency))
)
@@ -613,7 +606,6 @@ public class PBXProjGenerator {
}
for dependency in carthageDependencies {
guard target.type != .staticLibrary else { break }
let embed = dependency.embed ?? target.shouldEmbedCarthageDependencies