简体   繁体   English

Cocoapods 与 Gradle - iOS

[英]Cocoapods vs Gradle - iOS

Currently I am trying to figure out how to use Cocoapods .目前我正试图弄清楚如何使用Cocoapods Many blogs quoted that Cocoapods is the best dependency management tool at present.很多博客引用Cocoapods是目前最好的依赖管理工具。

However, I am also using Gradle plugin for building my application.但是,我也在使用Gradle plugin来构建我的应用程序。

Now the question is, can Gradle do the same dependency management for my private files & libraries ( .a files) as Cocoapods .现在的问题是, Gradle能否对我的私有文件和库( .a文件)进行与Cocoapods相同的依赖管理。

Long story short (Jan. 2015):长话短说(2015 年 1 月):

  • Gradle: build system + dependency management. Gradle:构建系统 + 依赖管理。
  • Cocoapods: dependency management for Xcode internal builds. Cocoapods:Xcode 内部构建的依赖管理。

There is probably more to this (for others that want to start commenting "but Cocoapods can also.."), but for a start that summarises it.可能还有更多内容(对于想要开始评论“但 Cocoapods 也可以……”的其他人),但首先总结一下。

If you are new to iOS and/or Xcode you should probably not use a mixture of Gradle and Xcode as it adds extra complexity to an already complex build environment.如果您不熟悉 iOS 和/或 Xcode,您可能不应该混合使用 Gradle 和 Xcode,因为它会给已经很复杂的构建环境增加额外的复杂性。 If you are familiar with Gradle and you also (!) have some knowledge of Xcode, then I would recommend to use Gradle.如果您熟悉 Gradle 并且您(!)对 Xcode 有一些了解,那么我建议您使用 Gradle。 Advantage?优势? You have full control over your builds and it saves you from messing around in endless Xcode build-config-dialogs.你可以完全控制你的构建,它使你免于在无休止的 Xcode build-config-dialogs 中乱搞。 On top you gain access to other repositories (maybe not that interesting for you) AND you can script your builds in a cross-platform environment.最重要的是,您可以访问其他存储库(可能对您来说不是那么有趣)并且您可以在跨平台环境中编写您的构建脚本。 I also use a non-MacOS build server (Linux+Jenkins) which is able to interpret Gradle-build scripts, which is another plus.我还使用了一个非 MacOS 构建服务器(Linux+Jenkins),它能够解释 Gradle 构建脚本,这是另一个优点。

If you want access to a versioning system other than git, you also gain access to that... when I type the lines right here, I wonder why I ever built an app without Gradle :-).如果您想访问 git 以外的版本控制系统,您也可以访问它……当我在此处输入行时,我想知道为什么我在没有 Gradle 的情况下构建了一个应用程序 :-)。 I have even more things that come to my mind, now that I think about it: mixed programming-language builds (Java/C#/objC...), unit-test integration that does not require Xcode, easy reuse of build configurations from project to project ... .现在我想到了更多的事情:混合编程语言构建(Java/C#/objC...)、不需要 Xcode 的单元测试集成、轻松重用来自项目到项目......

Cocoapods is pretty much tied to Xcode, since it generates Xcode project files. Cocoapods 非常依赖于 Xcode,因为它生成 Xcode 项目文件。 The problem with Xcode is that it works best when it's building the app, not some external build system. Xcode 的问题在于它在构建应用程序时效果最好,而不是一些外部构建系统。 I suppose it's possible to make a Gradle plugin that uses Cocoapods repositories with Gradle's Objective-C support, but I haven't seen anything like that.我想可以制作一个使用 Cocoapods 存储库并支持 Gradle 的 Objective-C 的 Gradle 插件,但我还没有看到过这样的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM