I have several Xcode workspaces, each containing several projects. The projects in these workspaces are related and need to reference several of the same CocoaPods.
I want to create a single common directory into which I can download one copy of each pod I use, but I can't figure out how to set up the podfile so that it does treats each workspace independently. What happens is that when two workspaces are named, the second one gets both non-pod projects.
To simplify things, I created two simple projects, FooProject and BarProject, each contained in its own workspace (FooWorkspace and BarWorkspace). For clarity, my directory structure looks like this:
+ Common
- Podfile
- Podfile.lock
+ Pods
+ Workspace1
- FooProject.xcodeproj
- FooWorkspace.xcworkspace
+ Workspace2
- BarProject.xcodeproj
- BarWorkspace.xcworkspace
Here's my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
def common_pods
pod "ConsoleBanner"
end
target 'FooProject' do
project '../Workspace1/FooProject.xcodeproj'
workspace '../Workspace1/FooWorkspace.xcworkspace'
common_pods
end
target 'BarProject' do
project '../Workspace2/BarProject.xcodeproj'
workspace '../Workspace2/BarWorkspace.xcworkspace'
common_pods
end
This almost does the trick. It downloads the pod only one time and puts it in the shared directory below this file. The only problem is that it updates BarWorkspace to include not only BarProject and the Pods project, but also FooProject. The first project/workspace referenced in the podfile works properly.
I tried adding inherit! :none within the target blocks, but it didn't have any effect. I also considered creating separate podfiles as peers in the same directory, but it seems that podfile has to be named, exactly, podfile.
How can I have the projects from separate workspaces reference the same podfiles?