美文网首页征服iOS程序员iOS Developer
制作cocoapods私有仓库(二)cococapods私有仓库

制作cocoapods私有仓库(二)cococapods私有仓库

作者: _海角_ | 来源:发表于2017-08-10 16:07 被阅读251次

上一篇
制作cocoapods私有仓库(一)依赖库制作
我们已经做好了依赖库
这一篇将如何将TestDemo2作为依赖库来制作cocoapods私有仓库
依赖库和cocoapods私有仓库是两个概念。所以我们需要再建立一个Spec Repo ,用来管理依赖库

Spec Repo 只需要一个,可以同时管理多个依赖库
类似与cocoapods的 公有仓库master

1.建立管理依赖库的 Spec Repo

这个仓库是用来存放我们自己所有的私有库的 podspec 文件

建立git仓库参考
制作cocoapods私有仓库(一)依赖库制作中git仓库建立过程

图例1.png

注意观察一下目录

将Spec Repo 添加到cocoapods

pod repo add REPO_NAME SOURCE_URL

其中的 REPO_NAME 是我们要添加的私有 repo 的名称,后面是仓库的 git 地址。
这里做的其实是创建的工作,也就是在 ~/.cocoapods/repo 目录下添加了一个以你的私有 repo 为名的文件夹,但是并没有添加 spec 文件。

 pod repo add TestDemo2Spec https://git.oschina.net/ZOKAI/TestDemo2Spec.git
图例2.png

2.添加podspec到Spec Repo

podspec 是cocoapods 安装使用第三方的依据,Spec Repo管理podspec

pod repo push REPO_NAME PODSPEC

这里必须注意,在push 之前最好检测一下远程podspec是否可用
检测命令

pod spec lint TestDemo2.podspec --allow-warnings --verbose --use-libraries

这个命令和

pod lib lint TestDemo2.podspec --allow-warnings --verbose --use-libraries

很相似,唯一区别就是,前者是检测远程podspec,后者是检测本地podspec

在push到cocoapods是时候,如果检测的时候使用 --allow-warnings --verbose --use-libraries 这些参数,push的时候也必须同时使用

添加--use-libraries参数,在使用该私有仓库的时候,还是会报如下错误

[!] The 'Pods-NewTestUi' target has transitive dependencies that include static binaries: 
(/Users/sqq/Desktop/NewTestUi/Pods/RongCloudIM/RongCloudIM/RongIMKit.framework, 
/Users/sqq/Desktop/NewTestUi/Pods/RongCloudIM/RongCloudIM/libopencore-amrnb.a, and 
/Users/sqq/Desktop/NewTestUi/Pods/RongCloudIM/RongCloudIM/RongIMLib.framework)

解决方法:
添加如下设置

pre_install do |installer|
def installer.verify_no_static_framework_transitive_dependencies; end
end

当push到cocoapods 出现如下提示,即表示私有仓库制作成功

pod repo push TestDemoSpec TestDemo2.podspec --allow-warnings --verbose --use-libraries

Validating spec
 -> TestDemo2 (1.0.0)

Updating the `TestDemoSpec' repo

Already up-to-date.

Adding the spec to the `TestDemoSpec' repo

 - [Add] TestDemo2 (1.0.0)

Pushing the `TestDemoSpec' repo

To https://git.oschina.net/ZOKAI/TestDemo2Spec.git
   9485679..d7688af  master -> master

此时spec repo会多一个目录 这个目录中就是TestDemo2.podspec文件

图例3.png

同时github仓库上也会多出一行


图例4.png

相关文章

网友评论

    本文标题:制作cocoapods私有仓库(二)cococapods私有仓库

    本文链接:https://www.haomeiwen.com/subject/vqshrxtx.html