@@ -156,7 +156,7 @@ public class PBXProjGenerator {
156
156
157
157
func generateTarget( _ target: Target ) throws -> PBXNativeTarget {
158
158
159
- let carthageFrameworks = Set ( getCarthageFrameworks ( target: target) )
159
+ let carthageDependencies = getAllCarthageDependencies ( target: target)
160
160
161
161
let sourcePaths = target. sources. map { basePath + $0 }
162
162
var sourceFilePaths : [ Path ] = [ ]
@@ -202,7 +202,7 @@ public class PBXProjGenerator {
202
202
}
203
203
204
204
// set Carthage search paths
205
- if !carthageFrameworks . isEmpty {
205
+ if !carthageDependencies . isEmpty {
206
206
let frameworkSearchPaths = " FRAMEWORK_SEARCH_PATHS "
207
207
let carthagePlatformBuildPath = " $(PROJECT_DIR)/ " + getCarthageBuildPath( platform: target. platform)
208
208
var newSettings : [ String ] = [ ]
@@ -381,10 +381,13 @@ public class PBXProjGenerator {
381
381
buildPhases. append ( copyFilesPhase. reference)
382
382
}
383
383
384
- if !carthageFrameworks. isEmpty {
384
+ let carthageFrameworksToEmbed = carthageDependencies
385
+ . filter { ( $0. embed ?? true ) }
386
+ . map { $0. reference }
387
+ if !carthageFrameworksToEmbed. isEmpty {
385
388
386
389
if target. type. isApp && target. platform != . macOS {
387
- let inputPaths = carthageFrameworks . map { " $(SRCROOT)/ \( carthageBuildPath) / \( target. platform) / \( $0) \( $0. contains ( " . " ) ? " " : " .framework " ) " }
390
+ let inputPaths = Set ( carthageFrameworksToEmbed ) . map { " $(SRCROOT)/ \( carthageBuildPath) / \( target. platform) / \( $0) \( $0. contains ( " . " ) ? " " : " .framework " ) " }
388
391
let carthageScript = PBXShellScriptBuildPhase ( reference: generateUUID ( PBXShellScriptBuildPhase . self, " Carthage " + target. name) , files: [ ] , name: " Carthage " , inputPaths: inputPaths, outputPaths: [ ] , shellPath: " /bin/sh " , shellScript: " /usr/local/bin/carthage copy-frameworks \n " )
389
392
addObject ( carthageScript)
390
393
buildPhases. append ( carthageScript. reference)
@@ -413,14 +416,15 @@ public class PBXProjGenerator {
413
416
return " \( carthagePath) / \( platformName) "
414
417
}
415
418
416
- func getCarthageFrameworks ( target: Target ) -> [ String ] {
417
- var frameworks : [ String ] = [ ]
419
+ func getAllCarthageDependencies ( target: Target ) -> [ Dependency ] {
420
+ var frameworks : [ Dependency ] = [ ]
418
421
for dependency in target. dependencies {
419
422
switch dependency. type {
420
- case . carthage: frameworks. append ( dependency. reference)
423
+ case . carthage:
424
+ frameworks. append ( dependency)
421
425
case . target:
422
426
if let target = spec. getTarget ( dependency. reference) {
423
- frameworks += getCarthageFrameworks ( target: target)
427
+ frameworks += getAllCarthageDependencies ( target: target)
424
428
}
425
429
default : break
426
430
}
0 commit comments