TL;DR: CocoaPods 0.34 which includes the work sponsored by SoundCloud has been released. The highlights? Support for scoping Pods per build configuration, declaration of source repositories, and faster downloads.
This release will require making changes to your Podfiles
I would like to thank SoundCloud and the Travis Foundation for their support. Without their contribution, this release wouldn't have been nearly as extensive. Initiatives like this constitute an important engine to foster the development of the CocoaPods community.
Dependencies per build configuration
pod 'Lookback', :configurations => ['Debug']
Are you getting it?
Finally you can specify dependencies per build configuration. This is one of the most requested CocoaPods features… ever.
The work on this functionality was kick-started by Joachim Bengtsson with what I could describe only as a great open source attitude. Joachim was interested in curating the complete experience of Lookback, including installation with CocoaPods. Instead of just opening an issue he went above and beyond and proposed one of the most ambitious pull requests which we ever received. Unfortunately given its implications with the integration strategy, the patch entered a limbo where it remained stuck for more than a year. However, thanks to the support of SoundCloud (and the patience of Eloy) this feature has been released.
There are some caveats to keep in mind though:
- Currently, dependencies can be scoped by configuration only by Pod rather than by individual subspecs.
- All the resources are copied regardless of the build configurations.
- The Acknowledgements files generated by CocoaPods include all the Pods regardless of whether they are scoped by build configuration.
Private spec repositories
Another feature which our users frequently ask for is the support for declaring spec repositories in the Podfile. With this change the Podfile becomes fully deterministic. This feature was kickstarted by François Benaiteau. Here is how it works:
source 'https://github.com/CocoaPods/Specs' source 'https://github.com/Organization/Specs'
You might be wondering what happens when a repository is not already cloned on the user’s system. Well, wonder no more, because Samuel Giddins has taken this feature to the next level. If a repository is missing, CocoaPods will automatically clone it and it will even finely craft a suitable name.
To ease the transition, the pre 0.34 behaviour of implicitly including all the repos is still being supported, if no repo has been specified in the Podfile. However this logic as been deprecated, so this is a good time to adopt the new syntax in the Podfile.
Another thing to keep in mind is that the order of the repositories matter. CocoaPods will only consider the versions of a Pod available in the first repo where that Pod is available. Higher versions of a Pod specified in repositories declared after one including the Pod are not considered. This feature prevents a Pod switching to another repository by accident during an update because a new higher version has been introduced. This can be case with a private repo where the last version of a Pod available in the master repo is customised.
97% of the Pods available in the master repo use a git source (6193 out of 6403 to be precise). We noticed this trend early on during the development of CocoaPods and we have adopted a cache for this download strategy. This solution worked reasonably well for users cycling a common pool of Pods and upgrading them. However, it had the disadvantage of incurring in a performance hit during the first clone of a Pod. This hit was dramatically stronger for repositories with a complex history.
Fortunately Marin Usalj come to the rescue and
proposed to move away from the caching system in favour of shallow cloning git
repos. The result? A faster experience and an even faster
Reorganisation of the Pods directory
The Pods directory has not been the pinnacle of human organisation. With the development of CocoaPods different artefacts have been added and the layout of the CocoaPods home has became a bit cluttered. We decided that the time to tidy up our room has come. However we couldn’t leave existing installations in the cold. So we have implemented a migration mechanism that completely automates the transition. This is the tree that we are aiming at:
Unfortunately during the release candidates we discovered that a non negligible
number of Pods rely on the unsupported
PODS_ROOT configuration setting
instead of using the
attributes. To prevent issues we reverted the change which moved the sources
of the Pods in the directory aptly named
Sources – I know this name is pure
art. However, this is a temporary band aid and Podspecs maintainers should
update their specifications as soon as possible.
The support from SoundCloud and the Travis Foundation extended to a less visible but certainly not less important level.
Many of the CocoaPods dependencies have been cleaned up. Most of their issues have been solved. Code-base style and the coverage was taken care of. Solid dependencies means that the CocoaPods-Core team now can focus only in the last mile, especially in the integration strategies.
Another tiny, tiny, tiny, but very significant change is that now
requires_arc defaults to true on Podspecs. This might look like the easiest
patch ever (just one line of code) however it provides an insight on the real
complexity of CocoaPods development: preserving existing installations… a.k.a
backwards compatibility. So this innocent looking
issue required to switch
the entire specs repo to JSON (in order to safely edit all the specs
programmatically) which in turn required to implement the trunk (in order to
prevent the mater repo from becoming a Babel of different formats). Of course
stating that those features stemmed from this issue is a stretch, but at least
for me, their seed was planted there. I’m personally super happy to see it
finally closed after more than two years. By the way, if you have a custom
and private Podspecs I would recommend to check them to avoid any issue.
To install the last release of CocoaPods you can run:
$ [sudo] gem install cocoapods
Until version 1.0 we strongly encourage you to keep CocoaPods up-to-date.
For all the details, don’t miss the Changelog.