views:

1176

answers:

3

I was struggling with how to use TFS as a source code repository for iPhone development.

My boss will never let me use Subversion (or God forbid Perforce), so I was stuck with TFS source control.

The solution is to go and buy tools to bridge Mac to TFS, and I am not trying to advertise here, but the Teamprise Client Suite for Mac OS X is the bridge between Mac OS X and TFS.

For standard check-ins and developer workflow, there is no integration between Xcode and TFS. You have to do it all manually through the Teamprise Explorer client.

For builds, it turns out that Automator and the Teamprise Command Line client do the trick.

Is there some Xcode to TFS bridge out there? What source code control system are you using for iPhone development?

The key for me is the following bash script embedded in an Automator workflow.

%1 = Local folder to do a code pull to. %2 = Project Name to do the pull from.

This script assumes the Teamprise Command Line Client is installed to ~/Teamprise

PATH="$PATH:~/Teamprise:~/Teamprise/lib"

cd "$1"
mkdir "$1/logs"

tf workspace -delete BuildScript -server:http://TFSServer -login:uname@domain,password >> $1/logs/wsdelete1.log

tf workspace -new BuildScript -server:http://TFSServer -login:uname@domain,password >> $1/logs/wscreate.log

tf workfold -map "$/TFSRoot" . -workspace:BuildScript -server:http://TFSServer -login:uname@domain,password >> $1/logs/workfold.log

tf get "$/TFSRoot/$2" -all -recursive -server:http://TFSServer -login:uname@domain,password >> $1/logs/get.log

tf workspace -delete BuildScript -server:http://TFSServer -login:uname@domain,password >> $1/logs/wsdelete2.log

#pump the tfs landing folder to the next step in the Automator script.
echo $1/Projects/$2
+2  A: 

While internally Xcode is using a plugin system to support different version control systems, it is not public or documented. Aside from minimal support like running some commandline scripts there is no supported way to use any version control systems except for those Xcode ships with.

You should file a bug with Apple asking for native support for TFS, or a supported VCS plugin system for Xcode.

Anyway, in the short run I don't think you will find an satisfactory solution to your problem.

Louis Gerbarg
+4  A: 

As Louis states, XCode doesn't currently provide a publicly accessible plug-in model for us (Teamprise) to provide a TFS integration with - it is something that we would love to do.

We've experimented with a couple of hacks - such as pretending to be the Perforce command line and talking to TFS instead, however these internal proof of concepts have so far not worked out very well - especially as we would want to ideally have Work Item Tracking linked in somehow as well so that you can associate check-ins with bugs etc.

Today, the majority of our customers that are using Teamprise to talk to TFS from XCode are doing so either using the standalone UI tool (Teamprise Explorer) or are doing Automator actions like you suggest to hook into the tf command line.

Apologies that this isn't a great experience. All I can suggest is that you file a bug with Apple to provide a plug-in model for SCM systems to hook into XCode. Hopefully if there is significant developer demand then we might have more luck than just us requesting it.

Martin Woodward
Thanks for the explanation from the Teamprise side. I am going to mark this as the answer for now, and also file a bug with Apple.I am very happy with the Teamprise suite (once again, not trying to advertise) it has met my needs and is incredibly stable given the amount of functionality.Based on my WWDC 2009 experience, I have a feeling that this request to the Xcode team will fall on deaf ears. Xcode source code control plugin models aren't nearly as important as their other IDE priorities to create tools that allow developers to create superstable iPhone / Mac OS X applications.
Batgar
I agree with you about the likely XCode priorities - however if we don't ask we don't get :-) Adding XCode support is something that we would love to do so I'll keep encouraging people to complain until it is possible for us to add it:-)
Martin Woodward
+3  A: 

If you must integrate with a TFS server, your best route at this time is to use SVNBridge and then connect to the bridge via Xcode's built-in subversion functionality.

Also, installing a VisualSVN server for the first time took me less than 15 minutes for a base install and another ten or so configuring users and getting the SSL cert signed by our company's root certificate. Give it a try, it was really easy.

rpetrich
I have an internal team of TFS wizards who are overburdened and understaffed as it is. If I mention deploying, maintaining, backing up, and tracking a separate SVN server... well it will get ugly. The Teamprise based solution puts the onus of work on the developer, but it has the fewest moving parts.
Batgar
That makes sense; adding an addional SVN service is just going to make more maintenance for them.
rpetrich