I have multiple projects checked into my Subversion repository, but CC.NET out of the box will build all of them when any source file get checked into any part of the repository under trunk. The desired behavior is to have only a build get kicked off when a source file gets checked in under its project folder. I was able to do this when using Perforce with CC.NET by creating multiple views, but in SVN I haven't found a way to do this yet.
Unfortunately there doesn't seem to be a built in way to specify a URL filter in CruiseControl.NET for when a build gets kicked off in Subversion (I'm using CC.NET 1.3). The current SVN source control provider in CC.NET only takes a trunk URL, and doesn't like it when you specify a subdirectory. For now I've just hacked the Svn class in CC.NET to apply a filter using a new TrunkWatchUrl element. In the following example, a build will only be kicked off when a change happens under http://svnserver/svn/gp/trunk/MyProject.
<sourcecontrol type='svn'>
<trunkUrl>http://svnserver/svn/gp/trunk</trunkUrl>
<trunkWatchUrl>http://svnserver/svn/gp/trunk/MyProject</trunkWatchUrl>
<tagBaseUrl>http://svnserver/svn/gp/tags</tagBaseUrl>
<workingDirectory>c:\autobuild\src\server</workingDirectory>
<executable>C:\Program Files\Subversion\bin\svn.exe</executable>
<username>domain\svcautobuild</username>
<password>pass</password>
<autoGetSource>true</autoGetSource>
<tagOnSuccess>true</tagOnSuccess>
</sourcecontrol>
The associated code changes to Svn.cs:
[ReflectorProperty("trunkWatchUrl", Required = false)]
public string TrunkWatchUrl;
public override Modification[] GetModifications(IIntegrationResult from, IIntegrationResult to)
{
ProcessResult result = Execute(NewHistoryProcessInfo(from, to));
Modification[] modifications = ParseModifications(result, from.StartTime, to.StartTime);
if (!string.IsNullOrEmpty(TrunkWatchUrl))
string trunkPath = TrunkWatchUrl.ToLower();
modifications = Array.FindAll(modifications, delegate(Modification mod)
string[] folderParts = mod.FolderName.Split('/');
if (folderParts.Length < 2)
return false;
string modFirstPathPart = folderParts[1];
int trunkStartIdx = trunkPath.IndexOf(modFirstPathPart);
if (trunkStartIdx < 0)
string localTrunkPathPart = trunkPath.Substring(trunkStartIdx).ToLower();
return mod.FolderName.ToLower().Contains(localTrunkPathPart);
});
}
if (UrlBuilder != null)
UrlBuilder.SetupModification(modifications);
return modifications;
Powered by: newtelligence dasBlog 2.1.8102.813
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Shawn Neal
E-mail