1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<!-- Documenting T:NAnt.Core.Types.PatternSet-->
5
<meta http-equiv="Content-Language" content="en-ca" />
6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
<link rel="stylesheet" type="text/css" href="../style.css" />
8
<title><patternset> Type</title>
11
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
13
<td class="NavBar-Cell">
14
<a href="http://nant.sourceforge.net">
17
<img alt="->" src="../images/arrow.gif" />
18
<a href="../index.html">Help</a>
19
<img alt="->" src="../images/arrow.gif" />
20
<a href="../types/index.html">Type Reference</a>
21
<img alt="->" src="../images/arrow.gif" /> <patternset></td>
22
<td class="NavBar-Cell" align="right">
26
<h1><patternset></h1>
27
<p> A set of patterns, mostly used to include or exclude certain files. </p>
28
<p> The individual patterns support <code>if</code> and <code>unless</code> attributes to specify that the element should only be used if or unless a given condition is met. </p>
29
<p> The <code>includesfile</code> and <code>excludesfile</code> elements load patterns from a file. When the file is a relative path, it will be resolved relative to the project base directory in which the patternset is defined. Each line of this file is taken to be a pattern. </p>
30
<p> The number sign (#) as the first non-blank character in a line denotes that all text following it is a comment: </p>
35
# uses the win32 eventlog API
38
<p> Patterns can be grouped to sets, and later be referenced by their <code>id</code>. </p>
39
<p> When used as a standalone element (global type), any properties that are referenced will be resolved when the definition is processed, not when it actually used. Passing a reference to a nested build file will not cause the properties to be re-evaluated. </p>
40
<p> To improve reuse of globally defined patternsets, avoid referencing any properties altogether. </p>
46
<th style="text-align: center;">Type</th>
48
<th style="text-align: center;">Required</th>
51
<td valign="top">id</td>
52
<td style="text-align: center;">string</td>
53
<td> The ID used to be referenced later. </td>
54
<td style="text-align: center;">False</td>
57
<td valign="top">refid</td>
58
<td style="text-align: center;">string</td>
59
<td> The ID to use as the reference. </td>
60
<td style="text-align: center;">False</td>
64
<h3>Nested Elements:</h3>
66
<!--NestedElementArray=T:NAnt.Core.Types.Pattern-->
72
<div class="nested-element"> Defines a single pattern for files to include. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The name pattern to include/exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be used; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> If <b>false</b> then the pattern will be used; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
79
<!--NestedElementArray=T:NAnt.Core.Types.Pattern-->
85
<div class="nested-element"> Loads multiple patterns of files to include from a given file, set using the <code>name</code> parameter. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The name pattern to include/exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be used; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> If <b>false</b> then the pattern will be used; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
92
<!--NestedElementArray=T:NAnt.Core.Types.Pattern-->
98
<div class="nested-element"> Defines a single pattern for files to exclude. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The name pattern to include/exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be used; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> If <b>false</b> then the pattern will be used; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
105
<!--NestedElementArray=T:NAnt.Core.Types.Pattern-->
107
<a id="excludesfile">
111
<div class="nested-element"> Loads multiple patterns of files to exclude from a given file, set using the <code>name</code> parameter. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The name pattern to include/exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be used; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> If <b>false</b> then the pattern will be used; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
113
<a id="excludesfile">
115
</excludesfile>
121
<<a href="../types/patternset.html">patternset</a>>
123
<div class="nested-element"> Adds a nested set of patterns, or references other standalone patternset. <p /></div>
127
</<a href="../types/patternset.html">patternset</a>>
130
<ul class="examples">
132
<p> Define a set of patterns that matches all .cs files that do not contain the text <code>Test</code> in their name. </p>
134
<patternset id="non.test.sources">
135
<include name="**/*.cs" />
136
<exclude name="**/*Test*" />
141
<p> Define two sets. One holding C# sources, and one holding VB sources. Both sets only include test sources when the <code>test</code> property is set. A third set combines both C# and VB sources. </p>
143
<patternset id="cs.sources">
144
<include name="src/**/*.cs" />
145
<include name="test/**/*.cs" if=${property::exist('test')}" />
148
<patternset id="vb.sources">
149
<include name="src/**/*.vb" />
150
<include name="test/**/*.vb" if=${property::exist('test')}" />
153
<patternset id="all.sources">
154
<patternset refid="cs.sources" />
155
<patternset refid="vb.sources" />
160
<p> Define a set from patterns in a file. </p>
162
<patternset id="sources">
163
<includesfile name="test.sources" />
164
<includesfile name="non.test.sources" />
169
<p> Defines a patternset with patterns that are loaded from an external file, and shows the behavior when that patternset is passed as a reference to a nested build script. </p>
170
<p> External file "c:\foo\build\service.lst" holding patterns of source files to include for the Foo.Service assembly: </p>
174
ServiceFactory.cs</pre>
175
<p> Main build script located in "c:\foo\default.build": </p>
177
<project name="main" default="build">
178
<property name="build.debug" value="true" />
180
<patternset id="service.sources">
181
<include name="TraceListener.cs" if="${build.debug}" />
182
<includesfile name="build/service.lst" />
185
<property name="build.debug" value="false" />
187
<target name="build">
188
<nant buildfile="service/default.build" inheritrefs="true" />
190
</project></pre>
191
<p> Nested build script located in "c:\foo\services\default.build" which uses the patternset to feed sources files to the C# compiler: </p>
193
<project name="service" default="build">
194
<target name="build">
195
<csc output="../bin/Foo.Service.dll" target="library">
196
<fileset basedir="src">
197
<patternset refid="service.sources" />
201
</project></pre>
202
<p> At the time when the patternset is used in the "service" build script, the following source files in "c:\foo\services\src" match the defined patterns: </p>
208
TraceListener.cs</pre>
209
<p> You should have observed that: </p>
210
<ul style="list-style-type: disc;">
211
<li> although the patternset is used from the "service" build script, the path to the external file is resolved relative to the base directory of the "main" build script in which the patternset is defined. </li>
212
<li> the "TraceListener.cs" file is included, even though the "build.debug" property was changed to <b xmlns="">false</b> after the patternset was defined (but before it was passed to the nested build, and used). </li>
216
<h3>Requirements</h3>
217
<div style="margin-left: 20px;">
218
<b>Assembly:</b> NAnt.Core (0.90.3780.0)
221
<a href="../types/fileset.html"><fileset></a>
b'\\ No newline at end of file'