Back

Cocoapods, GoogleMaps and Github 100 Mb restrictions

On some mobile app projects we’re developing, we’re using CocoaPods. More than that, in some projects, where we’re using CocoaPods, we’re adding the Pods directory to the source control. There are reasons for that. There are a few drawbacks to that approach, but our goal is to be sure that anyone can build a mobile app project right after cloning it.

We’re using Github for the repository and after the latest Google Maps version upgrade, Github started to decline our pushing attempts. This was because some of our files appeared to be more than 100Megabytes in size.

The problem file was Google Maps framework which was about ~114MB.

Cocoapods, GoogleMaps and Github 100 Mb restrictions

What to do?

There were a few ways we were thinking about handling this “feature”:

  • Stop pushing CocoaPods to the repo.
  • Stop using Google Maps in the project.
  • Divide Google Maps into smaller files, and recombine them on the build machine.

Decisions

When this problem occurred there wasn’t enough time to start experimenting with alternative options. Installing CocoaPods could take a while. On our integration server we were using a clean setup each time, so if we’d decided to set up CocoaPods each time on the server, we would’ve increased build time dramatically.

Also, we weren’t able to just remove Google Maps from the project at that point in time because the deadline was near.

Therefore we decided to leave CocoaPods in the repository, but deal with the big files somehow.

Below you can see our solution to use in iOS app development:

Solution

The idea was as simple as it could be – divide the big file into the smaller ones, and combine small parts in the original file on the build server.

Splitting up the file

In order to split the file, we’ve added few lines to our Podfile:

The solution, as you can see, is pretty straightforward – each time the pods are being installed, we’re splitting up the framework to smaller 30MB chunks.

Adding the framework file to .gitignore

Since we cannot push this file to the repo, we need to remove it from the index and add it to .gitignore.

Combining chunks in the original file

Since we’re not using pod install on the build server (that is what this is all about, actually), we need a place where we can combine the file again – we only have small chunks in the repository. So in our case we’ve added an additional build phase in the xcode project, which looked like this:

Profit

This is how we solved this mobile app development issue. By doing this we bought some time to make a long-term decision about how to handle this issue. Of course it’s just a temporary solution.

Give it a try. It only takes a click to unsubscribe.

Read more:

February 12, 2016
  • Vasyl Liutikov

    Why don’t you use git large file support? like https://git-lfs.github.com/
    test project https://github.com/pingwinator/LargeFilesTest

    • Kilew

      It’s not like we’re working with a lot of “large files”, like designs or something like that. it was just one file which is not get updated too often. It’s more like one-time solution, when you don’t need to support multiple large files.

ios