December 2007 Archives

I Love Shelving


No - this is not a post about the big news in Northern Ireland this past week.  On Friday night I was in the middle of a rather large change that I wasn't ready to check-in to the mainline of code.  However, as I am now in the habit of doing, I shelved the changes to TFS before I stopped work for the evening.  Shelving is a neat feature in Team Foundation Server.  It lets you save your files onto the server without committing the change into the mainline of code.

Over the weekend, my main development machine decided to die on me pretty badly.  It wouldn't even get as far as the BIOS screen - despite plenty of power getting to the motherboard.  An hour long conversation with the friendly technician resulting if nothing more than my knees getting a little dusty and so the machine is now in a box on the way back to the manufacturer.  However, I was able to un-shelve the changes from Friday night onto my laptop and carry on working were I left off with no code loss.

Needless to say - this morning I became a very big fan of shelving:-)

Six Months of TFS 2008

As a follow up to my post back in August when we put TFS Beta 2 onto our production box, I just thought I'd mention that here at Teamprise we have now been running Visual Studio Team Foundation Server 2008 for over 6 months now.  We recently upgraded our production TFS instance to the RTM release of TFS 2008 and everything is going very well.

The Microsoft team have done a fantastic job with compatibility which meant that we didn't even need to re-compile Teamprise to get it to work with TFS 2008 and still get all the performance benefits from the server.  The current public versions of Teamprise work great with TFS2008, as does Visual Studio 2005.

While TFS performance has improved since the RTM of TFS 2005, for me the single biggest reason to upgrade to TFS 2008 are the new and much improved build capabilities.  As you might have guessed by the number of Team Build related posts on my blog lately - in the next version of Teamprise we will be including integration with Team Build.  This has been my area of focus for most of this year so I am really excited to see what people think once we make it available.

In the meantime, if folks are considering upgrading to TFS2008 from TFS2005 then I would certainly recommend it.  The upgrade from TFS2005 to TFS2008 has been very smooth in my experience.

Update: With Teamprise 3.0 we included this work into the freely downloadable Teamprise Extensions for Team Build. The source is also provided under the MS-PL if you are interested. You should definately look at the new version as it contains some fixes and additional features based on feedback during beta testing.

Original Post:

With the recent release of Microsoft Visual Studio 2008 Team Foundation Server we are seeing more and more people looking to use the build capabilities of TFS (often referred to as "Team Build") to manage their Java based builds as well as their .NET ones.  We have an MSBuild task available internally that we use to trigger Ant based builds and report the progress back into TFS, and I wanted to share this with a wider audience to get some feeedback.  This task is heavily influenced by Aaron Hallberg's Team Build DevEnv task which I encourage you to go look at if you are interested in getting other build systems integration with Team Build.

You can download an early version of the Ant task from here - (TeampriseBuildExtensions 1.1MB).  There are two versions of the task included in the zip file - one for TFS2005 and one for TFS2008.  Additionally there is a draft set of instructions included on how to get this working today.  We hope to make the process much easier with future releases of Teamprise.

The Ant task works by calling Java to run Ant. The task first parses the Ant file to locate the name of the project and the description. It then calls Ant and the resulting output from Ant is then parsed by the task to look for key information (such as javac and junit tasks) as well as to pass the results into the MSBuild log. Options which are normally available via ant launching script are available as additional attributes to the Ant task.

Example Usage

<Ant TeamFoundationServerUrl="$(TeamFoundationServerUrl)" 
  Properties="BinariesRoot=$(BinariesRoot);BuildNumber=$(BuildNumber);SourceGetVersion=$(SourceGetVersion)" />

Task Reference

The following is a complete list of all the attributes supported by the task, note that many of them are best left to the default values unless a different behavior is explicitly required. Items that are in bold are the ones that are frequently used.






Location of Ant on Build Server.  If not specified then the value of the ANT_HOME environment variable will be used.



In Java 1.5+, use the OS proxies



Name of the build file to use, by default this is "build.xml" in the current directory.



The team system URI which uniquely represents the instance of the build being run.  With-in a Team Build MSBuild script, this is normally available in the MSBuild property $(BuildUri)



Set to "true" to instruct Ant to print debugging information.  By default this is set to "false".



The flavor of the build i.e. Release, Debug etc.  This will default to "Release".  In the Team Build MSBuild scripts, this is normally available as the global property %(ConfigurationToBuild.FlavorToBuild)



Specifies the Ant class which will handle input requests



Location of Java home directory on build server.  If not specified then the value of the JAVA_HOME environment variable will be used.



Instruct Ant to execute all targets that do not depend on failed target(s)



Specifies a path for Ant to search for jars and classes.



Add an instance of an Ant class as a project listener



Specify an Ant class to perform logging.



Override Ant's normal entry point with specified Ant class.



Run ant without using CLASSPATH



Do not allow interactive input in Ant script



Set to "true" to suppress the reporting of javac steps to TFS.  By default javac steps are added as build steps.



Run ant without using the jar files from ${user.home}/.ant/lib



The build platform i.e. Any CPU, x86, x64.   This will default to "Any CPU".  In the Team Build MSBuild script, this is normally available as the global property %(ConfigurationToBuild.PlatformToBuild)



Properties to pass to Ant in "name=value;name2=value2" syntax.  When calling Ant, it is often useful to pass through properties from the originating MSBuild script - for example Properties="BinariesRoot=$(BinariesRoot);BuildDefinitionName=$(BuildDefinitionName);"



Instruct Ant to load all properties from file with -D properties taking precedence



Single Ant Target to execute.  If not specified then the default target specified in the script will be used.  It is often useful to specify a target that is executed by Team Build and leave the default target to be what would get executed by a developer in a local workstation build.



Comma separated list of ant targets to execute.



The URL of the Team Foundation Server to talk to.  In the Team Build MSBuild script, this is often available in the property $(TeamFoundationServerUrl)



Set to "true" to instruct Ant to be extra verbose.

As part of the next version of Teamprise we will be providing integration with Team Build in the UI (i.e. inside Eclipse based IDE's or in the stand-alone Teamprise Explorer client).  More on those build capabilities soon - but hopefully you can see that with the ability to run Ant based builds from Team Build and the ability to control/monitor from Eclipse you will have a nice build system that is fully integrated with TFS.

If you find this task useful, then be sure to drop me a line with any feedback you might have.  We have not yet decided how to make the source of this task available, either as an open source project of it's own or as part of a larger community of MSBuild tasks.  There are pro's and con's to both.  In the meantime, if anybody would like the source code then drop me a line.


Creative Commons License
This blog is licensed under a Creative Commons License.