@@ -1249,12 +1249,14 @@ public func buildInDirectory(directoryURL: NSURL, withConfiguration configuratio
12491249public func stripFramework( frameworkURL: NSURL , keepingArchitectures: [ String ] , codesigningIdentity: String ? = nil ) -> SignalProducer < ( ) , CarthageError > {
12501250 let stripArchitectures = stripBinary ( frameworkURL, keepingArchitectures: keepingArchitectures)
12511251
1252- // Xcode doesn't copy `Modules` directory at all.
1252+ // Xcode doesn't copy `Headers` and `Modules` directory at all.
1253+ let stripHeaders = stripHeadersDirectory ( frameworkURL)
12531254 let stripModules = stripModulesDirectory ( frameworkURL)
12541255
12551256 let sign = codesigningIdentity. map { codesign ( frameworkURL, $0) } ?? . empty
12561257
12571258 return stripArchitectures
1259+ . concat ( stripHeaders)
12581260 . concat ( stripModules)
12591261 . concat ( sign)
12601262}
@@ -1418,20 +1420,29 @@ public func architecturesInPackage(packageURL: NSURL) -> SignalProducer<String,
14181420 }
14191421}
14201422
1423+ /// Strips `Headers` directory from the given framework.
1424+ public func stripHeadersDirectory( frameworkURL: NSURL ) -> SignalProducer < ( ) , CarthageError > {
1425+ return stripDirectory ( named: " Headers " , of: frameworkURL)
1426+ }
1427+
14211428/// Strips `Modules` directory from the given framework.
14221429public func stripModulesDirectory( frameworkURL: NSURL ) -> SignalProducer < ( ) , CarthageError > {
1430+ return stripDirectory ( named: " Modules " , of: frameworkURL)
1431+ }
1432+
1433+ private func stripDirectory( named directory: String , of frameworkURL: NSURL ) -> SignalProducer < ( ) , CarthageError > {
14231434 return SignalProducer . attempt {
1424- let modulesDirectoryURL = frameworkURL. URLByAppendingPathComponent ( " Modules " , isDirectory: true )
1435+ let directoryURLToStrip = frameworkURL. URLByAppendingPathComponent ( directory , isDirectory: true )
14251436
14261437 var isDirectory : ObjCBool = false
1427- if !NSFileManager. defaultManager ( ) . fileExistsAtPath ( modulesDirectoryURL . path!, isDirectory: & isDirectory) || !isDirectory {
1438+ if !NSFileManager. defaultManager ( ) . fileExistsAtPath ( directoryURLToStrip . path!, isDirectory: & isDirectory) || !isDirectory {
14281439 return . Success( ( ) )
14291440 }
14301441
14311442 do {
1432- try NSFileManager . defaultManager ( ) . removeItemAtURL ( modulesDirectoryURL )
1443+ try NSFileManager . defaultManager ( ) . removeItemAtURL ( directoryURLToStrip )
14331444 } catch let error as NSError {
1434- return . Failure( . WriteFailed( modulesDirectoryURL , error) )
1445+ return . Failure( . WriteFailed( directoryURLToStrip , error) )
14351446 }
14361447
14371448 return . Success( ( ) )
0 commit comments