Getting the associated changesets for a Team Build in an Ant script that builds Java code
-
Friday, December 09, 2011 4:50 PM
Greetings,
I am supporting a team that is beginning to use TEE to version control their IBM Message Broker Java code through Eclipse. We are doing a POC for automated builds. Currently, I am able to execute (by continuous integration with Team Build) an Ant script to basically "Hello World" when a message flow is checked in to TFS. They want to require a specific build of a Broker project based on what was just checked in as opposed to building all of the Broker projects in the Team Project branch.
First thought was to go grab the list of changesets that kicked off the currently running build since Team Build knows that. However, can't do that with Ant since it isn't "TFS API savvy", so I am trying a little C# console app that I can "exec" from an Ant target prior to the compiling target. The "GetChangeSets" method in the C# app looks like this:
var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(collectionUri);
IBuildServer buildServer = (IBuildServer)projectCollection.GetService(typeof(IBuildServer));
IBuildDetail build = buildServer.GetAllBuildDetails(BuildUri);
build.RefreshAllDetails();
List<IChangesetSummary> assocChangesets = InformationNodeConverters.GetAssociatedChangesets(build);
Console.WriteLine("This is the count of changesets from the store: " + assocChangesets.Count);
In the build log for the Ant execution, that writeline is printing this:
This is the count of changesets from the store: 0
I know there is a change so I don't believe that answer. My fear is that the Ant script is running before the Team Build is figuring out the list of associated changesets, and so when my C# app is running there is currently no list. Evidence to that seems to be in the Team Build log, which indicates that the "RunCallAnt:" task is running before the "CoreGetChangesetsAndUpdateWorkItems:" task in the Team Build Log.
Can someone please confirm/ assist on this? Am I missing something in above code to get the changesets? Do I need to somehow modify the standard build process template? Do I need to go calculate my own changesets based on date/time stamps, etc?
Thank you very much in advance for your assistance,
AceManWHO- Moved by Vicky Song Wednesday, December 14, 2011 4:05 AM (From:Team Foundation Server - Build Automation)
All Replies
-
Tuesday, December 13, 2011 11:15 AM
Hello AceManWHO,
I am moving your case to the Team Foundation Server - Eclipse and Cross Platform forum as your issue is more related to using Team Foundation Server from Eclipse. You can get better support on that forum.
Thanks.
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, December 13, 2011 2:54 PMThank you for your help, Vicki
AceManWHO -
Thursday, December 15, 2011 12:23 AMOwner
If you got hold of the changeset data what do you plan on doing with it then? There are a few ways of getting this data and trying to figure out the best way...
Alternatively, would it solve your problem easier if you were to do an incremental build in Ant? By only updating the workspace with the source files that had changed between builds Ant would then only build the targets (i.e. the projects) which were dependent on the files that had changed.
http://www.woodwardweb.com

