:submodules =>是什么?在CocoaPod Podspec中是真的意思吗? [英] What does :submodules => true mean in a CocoaPod Podspec?

查看:115
本文介绍了:submodules =>是什么?在CocoaPod Podspec中是真的意思吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL;DR:

如果将:submodules (属于 spec.source 的一部分)设置为 true CocoaPods 会做什么?

What does CocoaPods do if you set :submodules (part of spec.source) as true?

完整版本:

我以前的项目结构看起来像

My previous project structure looked like

Project
Linked To --> Core static library (submodule added as a subproject)
            --> Linked To --> several dependent submodules (files added within subproject)

我现在正在过渡到用于依赖管理的 CocoaPods .

I'm now in the process of transitioning to CocoaPods for dependency management.

我的新(过渡)结构看起来像

My new (transitional) structure looks like

Project
--> Depends on Core CocoaPod and few other CocoaPods
     --> Core depends on several open-source libraries
     --> Core also depends on a few submodules (in process of converting these)

我看过其他项目(例如 AFNetworking ),如下所示指定其 source :

I've seen other projects (e.g. AFNetworking) specify their source like this:

s.source = {:git =>'https://github.com/AFNetworking/AFNetworking.git',:tag =>"2.1.0",:submodules =>true}

在此示例中,如果将:submodules 作为 true 传递给 CocoaPods 会做什么?这是该用例的正确设置吗?

What does CocoaPods do if you pass :submodules as true as in this example? Is this the right setting for this use case?

我似乎找不到在 CocoaPods.org 上任何地方记录的文件.

I can't seem to find this documented anywhere on CocoaPods.org.

推荐答案

这与具有子模块(

This is to do with git repositories that have submodules (See Git Submodules for more information on them). Normally when you clone a git repository you need to do something like:

git submodule init 
git submodule update

下拉git存储库所依赖的子模块(例如,如果git库引用了另一个git库,则可以将其添加为子模块,而不是将文件添加到其自己的版本控制中-这意味着该子模块可以更新并git库将自动访问最新版本)

to pull down the submodules which the git repository depends on (e.g. if the git library has a reference to another git library it could add it as a submodule instead of adding the files to its own versioning - meaning the submodule could update and the git library would have access to the latest version automatically)

我不知道cocoapods在git clone过程中到底做了什么,但我想它会在克隆存储库后运行这两个命令,以确保所有子模块相关性都是有效的.

I don't know exactly what cocoapods does as part of the git clone process but I imagine it would run these 2 commands after cloning the repository to ensure all the submodule dependancies are valid.

仅供参考,此命令会初始化并更新所有子模块以及它们依赖的任何子模块-因此,这可能就是cocoapods所使用的

FYI this command does inits and updates all submodules and any submodules they depend on - so it's is probably what cocoapods uses

git submodule update --init --recursive

此更改在0.12.0中引入:(请参见更改日志)

This change was introduced in 0.12.0: (see changelog)

希望有帮助!

这篇关于:submodules =>是什么?在CocoaPod Podspec中是真的意思吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆