You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2008/11/24 13:53:18 UTC
svn commit: r720184 -
/ant/core/trunk/docs/manual/CoreTasks/resourcecount.html
Author: jhm
Date: Mon Nov 24 04:53:18 2008
New Revision: 720184
URL: http://svn.apache.org/viewvc?rev=720184&view=rev
Log:
Example: counting lines in a file
Modified:
ant/core/trunk/docs/manual/CoreTasks/resourcecount.html
Modified: ant/core/trunk/docs/manual/CoreTasks/resourcecount.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/resourcecount.html?rev=720184&r1=720183&r2=720184&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/resourcecount.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/resourcecount.html Mon Nov 24 04:53:18 2008
@@ -25,6 +25,7 @@
<body>
<h2>ResourceCount</h2>
+
<h3>Description</h3>
<p>Display or set a property containing the size of a nested
<a href="../CoreTypes/resources.html#collection">Resource Collection</a>.
@@ -63,12 +64,14 @@
<td valign="top" align="center">No; default is "equal"</td>
</tr>
</table>
+
<h3>Parameters specified as nested elements</h3>
<h4>Resource Collection</h4>
<p>A single
<a href="../CoreTypes/resources.html#collection">Resource Collection</a>
should be specified via a nested element or the <code>refid</code> attribute.
</p>
+
<h3>Examples</h3>
<pre><resourcecount property="count.foo">
<filelist dir="." files="foo,bar" />
@@ -77,6 +80,28 @@
<p>Stores the number of resources in the specified filelist (two)
in the property named <i>count.foo</i>.</p>
+<pre>
+<project>
+ <property name="file" value="${ant.file}"/>
+ <resourcecount property="file.lines">
+ <tokens>
+ <concat>
+ <filterchain>
+ <tokenfilter>
+ <linetokenizer/>
+ </tokenfilter>
+ </filterchain>
+ <fileset file="${file}"/>
+ </concat>
+ </tokens>
+ </resourcecount>
+ <echo>The file '${file}' has ${file.lines} lines.</echo>
+</project>
+</pre>
+<p>Stores the number of lines of the current buildfile in the property <tt>file.lines</tt>.
+Requires Ant 1.7.1+ as <concat> has to be resource.</p>
+
+
</body>
</html>