PageRenderTime 52ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Trunk/NSsh/Dependencies/nant/doc/help/fundamentals/tasks.html

#
HTML | 274 lines | 273 code | 1 blank | 0 comment | 0 complexity | 1612fcb11ab709e4cf85de53cde5749d MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0, GPL-2.0, GPL-3.0, LGPL-3.0
  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. <head>
  4. <meta http-equiv="Content-Language" content="en-ca" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="description" content="Tasks" />
  7. <link rel="stylesheet" type="text/css" href="../style.css" />
  8. <title>Tasks</title>
  9. </head>
  10. <body>
  11. <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
  12. <tr>
  13. <td class="NavBar-Cell">
  14. <a title="NAnt home page" href="http://nant.sourceforge.net"><b>NAnt</b></a>
  15. <img src="../images/arrow.gif" alt="-&gt;" width="13" height="9" />
  16. <a href="../index.html">Help</a>
  17. <img alt="-&gt;" src="../images/arrow.gif" />
  18. <a href="index.html">Fundamentals</a>
  19. <img height="9" alt="-&gt;" src="../images/arrow.gif" width="13" />
  20. Tasks
  21. </td>
  22. <td class="NavBar-Cell" align="right">
  23. v0.85
  24. </td>
  25. </tr>
  26. </table>
  27. <h1>Tasks</h1>
  28. <h2><a id="contents" />Contents</h2>
  29. <div>
  30. 1 <a href="#introduction">Introduction</a><br />
  31. 2 <a href="#taskloader">Loading custom extensions</a><br />
  32. <div style="margin-left: 20px;">
  33. 2.1 <a href="#taskloader-automatic">Automatic discovery</a><br/>
  34. <div style="margin-left: 20px;">
  35. 2.1.1 <a href="#automatic-os">Operating system</a><br/>
  36. 2.1.2 <a href="#automatic-runtime">Runtime framework</a><br/>
  37. 2.1.3 <a href="#automatic-project">Project</a><br/>
  38. </div>
  39. 2.2 <a href="#taskloader-forced">Forced scan</a><br/>
  40. </div>
  41. </div>
  42. <h2><a id="introduction" />1 Introduction</h2>
  43. <p>A task is a piece of code that can be executed.</p>
  44. <p>A task can have multiple attributes (or arguments, if you prefer).&nbsp; The
  45. value of an attribute may contain references to a <a href="properties.html">property</a>.&nbsp;
  46. These references will be resolved before the task is executed.</p>
  47. <p>Tasks have a common structure:</p>
  48. <blockquote><pre>&lt;<i>name</i> <i>attribute1</i>="<i>value1</i>" <i>attribute2</i>="<i>value2</i>" ... /&gt;</pre>
  49. </blockquote>
  50. <p>where <i>name</i> is the name of the task, <i>attribute#</i> is the attribute
  51. name, and <i>value#</i> is the value for this attribute.</p>
  52. <p><img height="9" alt=">" src="../images/bullet.gif" width="5" />&nbsp;For
  53. more information see the <a href="../tasks/index.html">Task Reference</a>.</p>
  54. <h2><a id="taskloader" />2 Loading custom extensions</h2>
  55. <p>
  56. Extensions can be devided in the following categories:
  57. </p>
  58. <ul>
  59. <li>Tasks</li>
  60. <li>Filters</li>
  61. <li>Functions</li>
  62. <li>Global Types</li>
  63. </ul>
  64. <p>
  65. NAnt currently provides two mechanisms to make third-party extensions available for use in build scripts:
  66. </p>
  67. <ul>
  68. <li>
  69. Automatic discovery
  70. </li>
  71. <li>
  72. Forced scan
  73. </li>
  74. </ul>
  75. <p>
  76. Both mechanisms use .NET reflection to scan one or more assemblies for the presence of extensions. When found,
  77. these extensions are registered in the NAnt type system, and from then on these are available for all build
  78. scripts (in the current NAnt instance).
  79. </p>
  80. <h3><a id="taskloader-automatic" />2.1 Automatic discovery</h3>
  81. <p>
  82. To facilitate registration of extensions that are used in multiple (or even all) build
  83. scripts, NAnt supports automatic discovery of extensions.
  84. </p>
  85. <p>
  86. In this context, automatic discovery means scanning a predefined set of directories and files for extensions.
  87. </p>
  88. <p>
  89. The actual set of directories and files that is scanned is determined by:
  90. </p>
  91. <ul>
  92. <li>Operating system</li>
  93. <li>Runtime framework</li>
  94. <li>Project</li>
  95. </ul>
  96. <h4><a id="automatic-os" />2.1.1 Operating system</h4>
  97. <p>
  98. When starting NAnt, all assemblies matching the following patterns will be scanned for extensions:
  99. </p>
  100. <div style="margin-left: 20px;">
  101. <p>
  102. <b>Windows</b>
  103. </p>
  104. <div style="margin-left: 20px;">
  105. <table style="width: 800px;" cellspacing="1" cellpadding="4">
  106. <colgroup>
  107. <col style="text-align: center;" />
  108. <col style="text-align: center;" />
  109. <col style="text-align: left;" />
  110. </colgroup>
  111. <tr>
  112. <th>Pattern</th>
  113. <th>Action</th>
  114. <th>Description</th>
  115. </tr>
  116. <tr>
  117. <td colspan="3"><hr /></td>
  118. </tr>
  119. <tr>
  120. <td>*Tasks.dll</td>
  121. <td>include</td>
  122. <td>NAnt Core assemblies</td>
  123. </tr>
  124. <tr>
  125. <td>*Tests.dll</td>
  126. <td>include</td>
  127. <td>NAnt test assemblies</td>
  128. </tr>
  129. <tr>
  130. <td>tasks/*.dll</td>
  131. <td>include</td>
  132. <td>Framework-neutral assemblies</td>
  133. </tr>
  134. <tr>
  135. <td>NAnt.MSNetTasks.dll</td>
  136. <td>exclude</td>
  137. <td>Microsoft.NET specific assembly</td>
  138. </tr>
  139. <tr>
  140. <td>NAnt.MSNet.Tests.dll</td>
  141. <td>exclude</td>
  142. <td>Microsoft.NET specific test assembly</td>
  143. </tr>
  144. </table>
  145. </div>
  146. </div>
  147. <div style="margin-left: 20px;">
  148. <p>
  149. <b>Unix</b>
  150. </p>
  151. <div style="margin-left: 20px;">
  152. <table style="width: 800px;" cellspacing="1" cellpadding="4">
  153. <colgroup>
  154. <col style="text-align: center;" />
  155. <col style="text-align: center;" />
  156. <col style="text-align: left;" />
  157. </colgroup>
  158. <tr>
  159. <th>Pattern</th>
  160. <th>Action</th>
  161. <th style="text-align: left;">Description</th>
  162. </tr>
  163. <tr>
  164. <td colspan="3"><hr /></td>
  165. </tr>
  166. <tr>
  167. <td>*Tasks.dll</td>
  168. <td>include</td>
  169. <td>NAnt Core assemblies</td>
  170. </tr>
  171. <tr>
  172. <td>*Tests.dll</td>
  173. <td>include</td>
  174. <td>NAnt test assemblies</td>
  175. </tr>
  176. <tr>
  177. <td>tasks/*.dll</td>
  178. <td>include</td>
  179. <td>Framework-neutral assemblies</td>
  180. </tr>
  181. <tr>
  182. <td>NAnt.MSNetTasks.dll</td>
  183. <td>exclude</td>
  184. <td>Microsoft.NET specific assembly</td>
  185. </tr>
  186. <tr>
  187. <td>NAnt.MSNet.Tests.dll</td>
  188. <td>exclude</td>
  189. <td>Microsoft.NET specific test assembly</td>
  190. </tr>
  191. <tr>
  192. <td>NAnt.VSNetTasks.dll</td>
  193. <td>exclude</td>
  194. <td>Assembly containing <a href="../tasks/solution.html"><code>&lt;solution&gt;</code></a> task</td>
  195. </tr>
  196. <tr>
  197. <td>NAnt.Win32Tasks.dll</td>
  198. <td>exclude</td>
  199. <td>Win32 specific assembly</td>
  200. </tr>
  201. <tr>
  202. <td>NAnt.Win32.Tests.dll</td>
  203. <td>exclude</td>
  204. <td>Win32 specific test assembly</td>
  205. </tr>
  206. </table>
  207. </div>
  208. </div>
  209. <p>
  210. <b>NOTE</b>: all patterns are matched relative to the NAnt base directory, which is the directory in which NAnt.exe is located.
  211. </p>
  212. <h4><a id="automatic-runtime" />2.1.2 Runtime framework</h4>
  213. <p>
  214. Depending on the runtime framework on which NAnt is running, some additional directories are scanned.
  215. </p>
  216. <p>
  217. In general, the following include patterns are applied:
  218. </p>
  219. <div style="margin-left: 20px;">
  220. tasks/&lt;framework family&gt;/*.dll<br/>
  221. tasks/&lt;framework family&gt;/&lt;framework version&gt;/**/*.dll<br/>
  222. </div>
  223. <p>
  224. <b>Example:</b>
  225. </p>
  226. <p>
  227. When running NAnt on Microsoft .NET Framework 1.0, assemblies matching the following pattern would be scanned:
  228. </p>
  229. <div style="margin-left: 20px;">
  230. tasks/net/*.dll<br />
  231. tasks/net/1.0/**/*.dll
  232. </div>
  233. <p>
  234. <b>NOTE:</b> the exact set of patterns that are used for a given runtime framework is defined in the NAnt configuration file (NAnt.exe.config).
  235. </p>
  236. <h4><a id="automatic-project">2.1.3 Project</a></h4>
  237. <p>
  238. Whenever a build project is started, NAnt will scan the following directories for assemblies that match the *.dll pattern:
  239. </p>
  240. <ul>
  241. <li>
  242. &lt;Project Base Directory&gt;\tasks\
  243. </li>
  244. <li>
  245. &lt;Project Base Directory&gt;\tasks\&lt;framework family&gt;\
  246. </li>
  247. <li>
  248. &lt;Project Base Directory&gt;\tasks\&lt;framework family&gt;\&lt;framework version&gt;\
  249. </li>
  250. </ul>
  251. <p>
  252. <b>Example:</b>
  253. </p>
  254. <p>
  255. For a project file located in &quot;c:\projects\log4net&quot; with NAnt running on the Microsoft .NET 2.0 runtime, NAnt would end-up scanning the following project-level directories:
  256. </p>
  257. <ul>
  258. <li>
  259. c:\projects\log4net\tasks\
  260. </li>
  261. <li>
  262. c:\projects\log4net\tasks\net\
  263. </li>
  264. <li>
  265. c:\projects\log4net\tasks\net\2.0\
  266. </li>
  267. </ul>
  268. <h3><a id="taskloader-forced" />2.2 Forced scan</h3>
  269. <p>
  270. To explicitly instruct NAnt to scan a certain assembly (or set of assemblies) for extensions, build authors can use the <a href="../tasks/loadtasks.html"><code>&lt;loadtasks&gt;</code></a> tasks.
  271. </p>
  272. </body>
  273. </html>