Currently I am trying to figure out how to use Cocoapods. Many blogs quoted that Cocoapods is the best dependency management tool at present.

However, I am also using Gradle plugin for building my application.

Now the question is, can Gradle do the same dependency management for my private files & libraries (.a files) as Cocoapods.

有帮助吗?

解决方案

Long story short (Jan. 2015):

  • Gradle: build system + dependency management.
  • Cocoapods: dependency management for Xcode internal builds.

There is probably more to this (for others that want to start commenting "but Cocoapods can also.."), but for a start that summarises it.

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. If you are familiar with Gradle and you also (!) have some knowledge of Xcode, then I would recommend to use Gradle. Advantage? You have full control over your builds and it saves you from messing around in endless 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.

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 :-). 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 ... .

其他提示

Cocoapods is pretty much tied to Xcode, since it generates Xcode project files. The problem with Xcode is that it works best when it's building the app, not some external build system. 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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top