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...


<cruisecontrol>
<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.
-->
<webURL>http://localhost/ccnet/OurProject3.0</webURL>

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

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

No comments: