Summary: How do I make a podspec that includes a project itself using a Podfile?
I've build a Mac framework and as part of the workspace I use a cocoapod library, OpenSSL-Universal
. The linked library is all written in C, whereas my project is in Swift, so I created a directory called SwiftSSL
and in that I put a module.modulemap file like so:
module SwiftSSL {
header "../Pods/Headers/Public/OpenSSL-Universal/openssl/ssl.h"
header "../Pods/Headers/Public/OpenSSL-Universal/openssl/crypto.h"
export *
}
That let's me import SwiftSSL
in my project and not use a bridging header file.
It seems to work fine via my unit tests. Now I want to turn this whole thing into a pod of its own, but I can't for the life of me figure out how to write the podfile so that the calling projects don't need to also include OpenSSL-Universal in their installations.
I tried adding these lines to my podspec:
s.source_files = "**/*.{h,swift}"
s.exclude_files = "Classes/Exclude"
s.preserve_paths = "SwiftSSL/module.modulemap"
s.xcconfig = {
"SWIFT_INCLUDE_PATHS" => "$(SRCROOT)/SwiftSSL/**",
'HEADER_SEARCH_PATHS' => "$(SRCROOT)/Pods/Headers/Public/OpenSSL-Universal",
'LIBRARY_SEARCH_PATHS' => "$(SRCROOT)/Pods/OpenSSL-Universal/lib-macros"
}
But when I pod spec lint
my file I get tons of build errors:
-> SwiftHttp2 (0.0.1)
- ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code. You can use--verbose
for more information.
- NOTE | [OSX] xcodebuild: :1:9: note: in file included from :1:
- NOTE | [OSX] xcodebuild: Target Support Files/SwiftHttp2/SwiftHttp2-umbrella.h:13:9: note: in file included from Target Support Files/SwiftHttp2/SwiftHttp2-umbrella.h:13:
- ERROR | [OSX] xcodebuild: SwiftHttp2/Pods/OpenSSL-Universal/include-macos/openssl/aes.h:55:11: error: 'openssl/opensslconf.h' file not found
- NOTE | [OSX] xcodebuild: :0: error: could not build Objective-C module 'SwiftHttp2'
- NOTE | [OSX] xcodebuild: ld: warning: directory not found for option '-LPods/OpenSSL-Universal/lib-macros'
- NOTE | xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
- NOTE | [OSX] xcodebuild: error: cannot parse the debug map for "/Users/scott/Library/Developer/Xcode/DerivedData/App-cwmkyklahssytecgweyweofvxvis/Build/Products/Release/SwiftHttp2/SwiftHttp2.framework/Versions/A/SwiftHttp2": No such file or directory
- ERROR | [OSX] xcodebuild: /Users/scott/Library/Developer/Xcode/DerivedData/App-cwmkyklahssytecgweyweofvxvis/Build/Products/Release/SwiftHttp2/SwiftHttp2.framework/Modules/module.modulemap:9:12: error: header 'SwiftHttp2-Swift.h' not found
- ERROR | [OSX] xcodebuild: /var/folders/vn/nlxdstyj57q667x6_c5kl72m0000gp/T/CocoaPods-Lint-20180105-63782-3kwgth-SwiftHttp2/App/main.swift:1:8: error: could not build Objective-C module 'SwiftHttp2'
- NOTE | [OSX] xcodebuild: ld: warning: directory not found for option '-LOpenSSL-Universal/lib-macros'
- NOTE | [OSX] xcodebuild: error: cannot parse the debug map for "/Users/scott/Library/Developer/Xcode/DerivedData/App-cwmkyklahssytecgweyweofvxvis/Build/Products/Release/App.app/Contents/MacOS/App": No such file or directory