参考:Podspec Syntax Reference v1.8.4
Root specification
s.name #库名
s.version #版本号
s.summary #摘要
s.author
s.authors #库的作者 单人或多人 s.author = { 'xiewengui' => '[email protected]' }
s.license #版权许可 # s.license = { :type => 'MIT', :file => 'LICENSE' }
s.license = {
:type => 'Copyright',
:text => <<-LICENCE
Copyright 2013 Bestpay. All rights reserved.
LICENCE
}
s.homepage #pod主页
s.source #库源码地址
:git => :tag, :branch, :commit, :submodules
s.source = { :git => 'https://gitlab.bestpay.com.cn/mbp/sdk-ios-messagepush.git', :branch => "release/#{s.version}"}
'以上是必须设置的'
swift_versions #支持的swift版本
cocoappods_version #支持的 CocoaPods 版本号 s.cocoapods_version = '>= 0.36'
social_media_url #门户网站
s.description #描述
s.screenshots #快照
s.documentation_url #文档地址
prepare_command #预处理脚本 此命令在清理pod和创建pods项目之前执行。工作目录是pod的根目录。如果pod安装了:path选项,则不会执行此命令。
static_framework #导出为静态库 'spec.static_framework = true'
deprecated #是否弃用 'spec.deprecated = true'
deprecated_in_favor_of #被弃用的库 spec.deprecated_in_favor_of = 'NewMoreAwesomePod'
Platform
s.platform #支持的平台及版本号
spec.platform = :osx, '10.8'
spec.platform = :ios
spec.platform = :osx
s.deployment_target #最低要求系统版本
spec.ios.deployment_target = '6.0'
spec.osx.deployment_target = '10.8'
Build settings
dependency #依赖属性
spec.dependency 'AFNetworking', '~> 1.0'
spec.dependency 'RestKit/CoreData', '~> 0.20.0'
spec.ios.dependency 'MBProgressHUD', '~> 0.5'
info_plist #写入info.plist文件
spec.info_plist = {
'CFBundleIdentifier' => 'com.myorg.MyLib',
'MY_VAR' => 'SOME_VALUE'
}
requires_arc #是否使用arc
Defaults:
spec.requires_arc = true
Examples:
spec.requires_arc = false
spec.requires_arc = 'Classes/Arc'
spec.requires_arc = ['Classes/*ARC.m', 'Classes/ARC.mm']
frameworks #依赖系统库
spec.ios.framework = 'CFNetwork'
spec.frameworks = 'QuartzCore', 'CoreData'
weak_frameworks #弱依赖库
spec.weak_framework = 'Twitter'
spec.weak_frameworks = 'Twitter', 'SafariServices'
libraries #依赖的系统静态库
spec.ios.library = 'xml2'
spec.libraries = 'xml2', 'z'
compiler_flags #传递给编译器的参数
spec.compiler_flags = '-DOS_OBJECT_USE_OBJC=0', '-Wno-format'
pod_target_xcconfig #私有库添加的flag
spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
user_target_xcconfig #不推荐使用
spec.user_target_xcconfig = { 'MY_SUBSPEC' => 'YES' }
prefix_header_contents #不推荐 Any content to inject in the prefix header of the pod project.
spec.prefix_header_contents = '#import '
spec.prefix_header_contents = '#import ', '#import '
module_name #模块
header_dir
header_mappings_dir
script_phases
File patterns
source_files #源代码路径
spec.source_files = 'Classes/**/*.{h,m}', 'More_Classes/**/*.{h,m}'
public_header_files #公开的头文件 spec.public_header_files = 'Headers/Public/*.h' 如果不设置,默认将sources中的头文件公开
private_header_files #不公开的头文件
vendored_frameworks #引入的第三方framework
spec.ios.vendored_frameworks = 'Frameworks/MyFramework.framework'
spec.vendored_frameworks = 'MyFramework.framework', 'TheirFramework.framework'
vendored_libraries #引入的第三方.a
resource_bundles #动态库所使用的资源文件存放位置,放在Resources文件夹中
spec.ios.resource_bundle = { 'MapBox' => 'MapView/Map/Resources/*.png' }
spec.resource_bundles = {
'MapBox' => ['MapView/Map/Resources/*.png'],
'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png']
}
resources #资源文件
spec.resource = 'Resources/HockeySDK.bundle'
spec.resources = ['Images/*.png', 'Sounds/*']
exclude_files #目标路径下的文件不进行下载
spec.ios.exclude_files = 'Classes/osx'
spec.exclude_files = 'Classes/**/unused.{h,m}'
preserve_paths #下载后不应删除的任何文件
spec.preserve_path = 'IMPORTANT.txt'
spec.preserve_paths = 'Frameworks/*.framework'
module_map #映射
spec.module_map = 'source/module.modulemap'
Subspecs
subspec #子模块
Pod::Spec.new do |s|
s.name = 'Root'
s.subspec 'Level_1' do |sp|
sp.subspec 'Level_2' do |ssp|
end
end
end
requires_app_host #是否允许运行测试
test_spec.requires_app_host = true
app_host_name #app 主机
scheme
test_spec
app_spec
default_subspecs
Multi-Platform support
ios
spec.ios.source_files ='Classes/ios/**/*.{h,m}'
osx
macos
tvos
watchos