发布SDK到cocoapods
发布前准备工作
- 安装cocoapods:
sudo gem install cocoapods
,如果安装失败,可以打开翻墙或者修改ruby软件源 - 安装brew
- 安装git-lfs:
brew install git-lfs
, git-lfs是针对github不能上传超过100M大文件的解决方案,git-lfs其实是将大文件另存到其他地方;
发布步骤
- 在github创建仓库,clone到本地;
- 在项目目录中执行以下命令,设置Git lfs,如果没有大文件可以省略该设置
git lfs install
- 设置git lfs希望追踪的大文件,该步骤成功后会生成一个.gitattributes文件
**/xxxx.a filter=lfs diff=lfs merge=lfs -text
其中.a就是要追踪的大文件
- 将.gitattributes文件推送到github,如何提交文件此处不细讲
- 此时可以提交大文件到github,该步骤比较费时;
- 将其他必须的资源文件提交到github,打tag并推送;
- 在项目目录下创建spec文件;
pod spec create xxxx.spec
pod spec create xxxx.spec
Pod::Spec.new do |s|
# 仓库名称
s.name = "xxxx"
# 本次上传版本号
s.version = "2.2.2"
# 仓库简介
s.summary = "xxxxxxxxxxxxxxxxxxxxxx"
# 主页地址
s.homepage = "xxxxx"
# 许可证
s.license = 'MIT'
# 作者信息
s.author = { "github名称" => "邮箱地址" }
# 适用平台
s.platform = :ios, "8.0"
# 源代码地址
s.source = { :git => "git地址", :tag => "#{s.version}" }
# 资源包地址
s.resource = "xxxx.bundle"
# 依赖的系统库
s.frameworks = "OpenGLES", "CoreGraphics", "GLKit"
# 依赖的系统库
s.library = "z", "c++"
# 工程文件配置
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC", "ENABLE_BITCODE" => "YES"}
# 本地静态库
s.vendored_libraries = 'xxxx/xxxx.a'
# 头文件
s.public_header_files = 'xxxx/include/xxxx/*.h'
# 资源文件
s.source_files = 'xxxx/include/xxxx/*.h'
end
- 验证spec文件是否正确
pod spec lint xxxx.spec
若有错误信息,可以参考报错信息修改
- 发布
pod trunk push
- 发布成功后可能需要手动刷新一下才能在pod上搜索到
pod setup
或者
rm ~/Library/Caches/CocoaPods/search_index.json
然后重新执行搜索命令
网友评论