Stefan Bodewig b6a3e9df36 License police on documentation files:
(1) Make sure there is a Copyright notice on all visible files.

(2) Make sure all years in which the file has been modified are
listed.

(3) Make sure the format is consistent, i.e. separate consecutive
years with a dash, not a comma.

When Stephane changed starteam.html it has been 2001 in France but
2002 in Australia - does that mean we add 2002 to the Copyright line
or not?  ;-)


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270652 13f79535-47bb-0310-9956-ffa450edef68
2002-01-10 08:48:33 +00:00

124 lines
3.1 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Apache Ant User Manual</title>
</head>
<body>
<h2><a name="script">Script</a></h2>
<h3>Description</h3>
<p>Execute a script in a
<a href="http://oss.software.ibm.com/developerworks/opensource/bsf/" target="_top">BSF</a> supported language.</p>
<p><b>Note:</b> This task depends on external libraries not included in the Ant distribution.
See <a href="../install.html#librarydependencies">Library Dependencies</a> for more information.</p>
<p>All items (tasks, targets, etc) of the running project are
accessible from the script, using either their <code>name</code> or
<code>id</code> attributes. The name "project" is a pre-defined reference to the Project, which can be used instead of the project name.</p>
<p>Scripts can do almost anything a task written in Java could do.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">language</td>
<td valign="top">The programming language the script is written in.
Must be a supported BSF language</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">src</td>
<td valign="top">The location of the script as a file, if not inline</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Examples</h3>
<blockquote><pre>
&lt;project name=&quot;squares&quot; default=&quot;main&quot; basedir=&quot;.&quot;&gt;
&lt;target name=&quot;setup&quot;&gt;
&lt;script language=&quot;javascript&quot;&gt; &lt;![CDATA[
for (i=1; i&lt;=10; i++) {
echo = squares.createTask(&quot;echo&quot;);
main.addTask(echo);
echo.setMessage(i*i);
}
]]&gt; &lt;/script&gt;
&lt;/target&gt;
&lt;target name=&quot;main&quot; depends=&quot;setup&quot;/&gt;
&lt;/project&gt;
</pre></blockquote>
<p>generates</p>
<blockquote><pre>
setup:
main:
1
4
9
16
25
36
49
64
81
100
BUILD SUCCESSFUL
</pre></blockquote>
<p>Another example, using <a href="../using.html#references">references by id</a>
and two different scripting languages:</p>
<blockquote><pre>
&lt;project name=&quot;testscript&quot; default=&quot;main&quot;&gt;
&lt;target name=&quot;sub&quot;&gt;
&lt;echo id=&quot;theEcho&quot;/&gt;
&lt;/target&gt;
&lt;target name=&quot;sub1&quot;&gt;
&lt;script language=&quot;netrexx&quot;&gt;&lt;![CDATA[
theEcho.setMessage(&quot;In sub1&quot;)
sub.execute
]]&gt;&lt;/script&gt;
&lt;/target&gt;
&lt;target name=&quot;sub2&quot;&gt;
&lt;script language=&quot;javascript&quot;&gt;&lt;![CDATA[
theEcho.setMessage(&quot;In sub2&quot;);
sub.execute();
]]&gt;&lt;/script&gt;
&lt;/target&gt;
&lt;target name=&quot;main&quot; depends=&quot;sub1,sub2&quot;/&gt;
&lt;/project&gt;
</pre></blockquote>
<p>generates</p>
<blockquote><pre>
sub1:
In sub1
sub2:
In sub2
main:
BUILD SUCCESSFUL
</pre></blockquote>
<hr>
<p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
Reserved.</p>
</body>
</html>