Search code examples
xcodeunit-testingbuildcocoapodsgit-submodules

Running unit tests on git submodules (which are also CocoaPods) in Xcode 6.2


My project is using an internal library.

It is set up both as a CocoaPod for dependency management and as git submodule so that I only need to package a new version when it's actually ready for release.

See CocoaPods: Working With Internal Pods Without Hassle for a detailed description of this setup.

So I've just modified my internal library, and those changes are now reflected in the pod, which I'm excited about.

The catch, however, is that the internal library has its own Podfile, and thus require a workspace. Since I generally would not build that library except as a dependency, it's mostly fine... up until I want to run unit tests on it.

Since CocoaPods normally includes the pods in a workspace, it can't find the object files for the pod dependencies. However, they're there - since those dependencies are also included in the project that uses the pod.

I don't think it's possible to nest workspaces in Xcode. But shouldn't it be possible make some change in the internal library's Build Phases-Link Binary With Libraries to point libPods.a to the one generated by the main project?


Solution

  • Solution: Add the Pods.xcodeproj for that internal library to the workspace.

    So the workspace ends up containing 4 projects:

    • Main Project
    • Main Project's Pods project
    • Internal Library
    • Internal Library's Pods project