Friday, March 09, 2007

NAnt's Filtered Trigger

I have to say that I found the documentation on this feature somewhat baffling, but that might just be me. We use Subversion here, and I'd like the build not to run if the only files committed since the last build are the ones that the last build created, e.g. the version.txt file, the generated CommonAssemblyInfo.cs into which the incremented build number is written, the backups of CruiseControl.NET's various .config and .xsl files, etc. Feel free to write me if my example doesn't help you out. The problem that cost me close to a day is that relative paths within the block don't seem to be resolved as I expected. See my comments...

<project name="Our Project 3.0">

<workingDirectory>E:\Builds\Our Project 3.0</workingDirectory>
<artifactDirectory>E:\Builds\Our Project 3.0\artifacts</artifactDirectory>
CruiseControl.NET doesn't handle spaces in paths consistently, so let's
keep ourselves out of trouble.

<!-- Check every 10 minutes. -->
<intervalTrigger seconds="600" />

<sourcecontrol type="filtered">
<sourceControlProvider type="svn">
<workingDirectory>E:\Builds\Our Project 3.0</workingDirectory>
<!-- Note that this is the full pathname, and apparently has to be. -->
<pattern>/trunk/Our Project/**/*.*</pattern>
<!-- Changes to these files should *not* cause a new build. -->
<pattern>/trunk/Our Project/version.txt</pattern>
<!-- These are serialization assemblies generated during the build process,
using xsd.exe.
<pattern>/trunk/Our Project/Serialization/Bin/*.dll</pattern>
<!-- The build number is boosted by a NAnt task. -->
<pattern>/trunk/Omega LP/Applications/CommonAssemblyInfo.cs</pattern>
<pattern>/trunk/Our Project/Build/**/*</pattern>
<!-- And so on... -->

No comments: