git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@486341 13f79535-47bb-0310-9956-ffa450edef68master
@@ -469,7 +469,10 @@ tasks, datatypes, scriptdefs, macrodefs and presetdefs.</p> | |||
<p>Evaluate a condition based on a script in any | |||
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> | |||
supported language.</p> | |||
or | |||
<a href="https://scripting.dev.java.net">JSR 223</a> | |||
supported language. | |||
</p> | |||
<p> | |||
See the <a href="../OptionalTasks/script.html">Script</a> task for | |||
an explanation of scripts and dependencies. | |||
@@ -1356,6 +1356,8 @@ Delete tabs from lines, trim the lines and removes empty lines. | |||
<p><b><em><a name="scriptfilter">ScriptFilter</a></em></b></p> | |||
This is an optional filter that executes a script in a | |||
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> | |||
or | |||
<a href="https://scripting.dev.java.net">JSR 223</a> | |||
supported language.</p> | |||
See the <a href="../OptionalTasks/script.html">Script</a> task for | |||
an explanation of scripts and dependencies. | |||
@@ -1377,9 +1379,18 @@ This filter may be used directly within a filterchain.<p> | |||
<tr> | |||
<td vAlign=top>language</td> | |||
<td vAlign=top> The programming language the script is written in. | |||
Must be a supported Apache BSF language</td> | |||
Must be a supported Apache BSF or JSR 223 language</td> | |||
<td vAlign=top align="center">Yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">manager</td> | |||
<td valign="top"> | |||
The script engine manager to use. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
for using this attribute. | |||
</td> | |||
<td valign="top" align="center">No - default is "auto"</td> | |||
</tr> | |||
<tr> | |||
<td vAlign=top>src</td> | |||
<td vAlign=top>The location of the script as a file, if not inline | |||
@@ -1387,8 +1398,30 @@ Must be a supported Apache BSF language</td> | |||
<td vAlign=top align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">setbeans</td> | |||
<td valign="top">whether to have all properties, references and targets as | |||
global variables in the script.</td> | |||
<td valign="top" align="center">No, default is "true".</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpath</td> | |||
<td valign="top"> | |||
The classpath to pass into the script. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpathref</td> | |||
<td valign="top">The classpath to use, given as a | |||
<a href="../using.html#references">reference</a> to a path defined elsewhere. | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
</table> | |||
<p> | |||
This filter can take a nested <classpath> element. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
on how to use this element. | |||
</p> | |||
<h4>Examples:</h4> | |||
Convert to uppercase: | |||
@@ -707,6 +707,8 @@ with <code><uptodate></code> and <code><junit></code> output.</p> | |||
<h4><a name="script-mapper">scriptmapper (since Ant 1.7)</a></h4> | |||
<p> | |||
This mapper executes a script written in <a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> | |||
or | |||
<a href="https://scripting.dev.java.net">JSR 223</a> | |||
supported language, once per file to map.</p> | |||
The script can be declared inline or in a specified file. | |||
</p> | |||
@@ -728,6 +730,15 @@ an explanation of scripts and dependencies. | |||
</td> | |||
<td align="center" valign="top">Yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">manager</td> | |||
<td valign="top"> | |||
The script engine manager to use. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
for using this attribute. | |||
</td> | |||
<td valign="top" align="center">No - default is "auto"</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">src</td> | |||
<td valign="top"> | |||
@@ -735,10 +746,34 @@ an explanation of scripts and dependencies. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">setbeans</td> | |||
<td valign="top">whether to have all properties, references and targets as | |||
global variables in the script.</td> | |||
<td valign="top" align="center">No, default is "true".</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpath</td> | |||
<td valign="top"> | |||
The classpath to pass into the script. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpathref</td> | |||
<td valign="top">The classpath to use, given as a | |||
<a href="../using.html#references">reference</a> to a path defined elsewhere. | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
</table> | |||
<p> | |||
This filename mapper can take a nested <classpath> element. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
on how to use this element. | |||
</p> | |||
<p> | |||
Example | |||
<b>Example:</b> | |||
</p> | |||
<blockquote><pre> | |||
<scriptmapper language="javascript"> | |||
@@ -87,7 +87,8 @@ | |||
they are signed, and optionally if they have a signature of a certain name. | |||
</li> | |||
<li><a href="#scriptselector"><code><scriptselector></code></a> - | |||
Use a BSF scripting language to create your own selector | |||
Use a BSF or JSR 223 scripting language to create | |||
your own selector | |||
</li> | |||
</ul> | |||
@@ -976,6 +977,8 @@ | |||
The <code><scriptselector></code> element enables you | |||
to write a complex selection algorithm in any | |||
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> | |||
or | |||
<a href="https://scripting.dev.java.net">JSR 223</a> | |||
supported language.</p> | |||
See the <a href="../OptionalTasks/script.html">Script</a> task for | |||
an explanation of scripts and dependencies. | |||
@@ -994,12 +997,45 @@ | |||
<td valign="top">language of the script.</td> | |||
<td valign="top" align="center">yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">manager</td> | |||
<td valign="top"> | |||
The script engine manager to use. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
for using this attribute. | |||
</td> | |||
<td valign="top" align="center">No - default is "auto"</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">src</td> | |||
<td valign="top">filename of the script</td> | |||
<td valign="top" align="center">no</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">setbeans</td> | |||
<td valign="top">whether to have all properties, references and targets as | |||
global variables in the script.</td> | |||
<td valign="top" align="center">No, default is "true".</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpath</td> | |||
<td valign="top"> | |||
The classpath to pass into the script. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpathref</td> | |||
<td valign="top">The classpath to use, given as a | |||
<a href="../using.html#references">reference</a> to a path defined elsewhere. | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
</table> | |||
<p> | |||
This selector can take a nested <classpath> element. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
on how to use this element. | |||
</p> | |||
<p> | |||
If no <code>src</code> attribute is supplied, the script must be nested | |||
inside the selector declaration. | |||
@@ -28,7 +28,10 @@ | |||
<h3>Description</h3> | |||
<p>Scriptdef can be used to define an Ant task using a scripting language. Ant | |||
scripting languages supported by | |||
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> may be | |||
<a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a> | |||
or | |||
<a href="https://scripting.dev.java.net">JSR 223</a> | |||
may be | |||
used to define the script. Scriptdef provides a mechanism to encapsulate | |||
control logic from a build within an Ant task minimizing the need for | |||
providing control style tasks in Ant itself. Complex logic can be made | |||
@@ -95,9 +98,18 @@ more information on writing scripts, please refer to the | |||
<tr> | |||
<td valign="top">language</td> | |||
<td valign="top">The programming language the script is written in. | |||
Must be a supported Apache BSF language</td> | |||
Must be a supported Apache BSF or JSR 223 language</td> | |||
<td valign="top" align="center">Yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">manager</td> | |||
<td valign="top"> | |||
The script engine manager to use. | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
for using this attribute. | |||
</td> | |||
<td valign="top" align="center">No - default is "auto"</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">src</td> | |||
<td valign="top">The location of the script as a file, if not inline</td> | |||
@@ -110,7 +122,29 @@ more information on writing scripts, please refer to the | |||
</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
</table> | |||
<tr> | |||
<td valign="top">classpath</td> | |||
<td valign="top"> | |||
The classpath to pass into the script. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpathref</td> | |||
<td valign="top">The classpath to use, given as a | |||
<a href="../using.html#references">reference</a> to a path defined elsewhere. | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">loaderRef</td> | |||
<td valign="top">the name of the loader that is | |||
used to load the script, constructed from the specified | |||
classpath. This allows multiple script defintions | |||
to reuse the same class loader. | |||
</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
</table> | |||
<h3>Nested elements</h3> | |||
<h4>attribute</h4> | |||
@@ -158,7 +192,11 @@ more information on writing scripts, please refer to the | |||
</tr> | |||
</table> | |||
<h4>classpath</h4> | |||
<p> | |||
See the <a href="../OptionalTasks/script.html">script</a> task | |||
for using this nested element. | |||
</p> | |||
<h3>Examples</h3> | |||
@@ -236,7 +274,7 @@ Script errors are only detected when a script task is actually executed. | |||
</p> | |||
<pre> | |||
<target name="echo-task-jython"> | |||
<target name="echo-task-jython"> | |||
<scriptdef language="jython" | |||
name="echo" | |||
uri="http://example.org/script"> | |||
@@ -252,6 +290,26 @@ self.log("text: " +self.text) | |||
</target> | |||
</pre> | |||
The next example shows the use of <classpath> and | |||
"loaderref" to get access to the beanshell jar. | |||
<pre> | |||
<scriptdef name="b1" language="beanshell" | |||
loaderref="beanshell-ref"> | |||
<attribute name="a"/> | |||
<classpath | |||
path="${user.home}/scripting/beanshell/bsh-1.3b1.jar"/> | |||
self.log("attribute a is " + attributes.get("a")); | |||
</scriptdef> | |||
<scriptdef name="b2" language="beanshell" | |||
loaderref="beanshell-ref"> | |||
<attribute name="a2"/> | |||
self.log("attribute a2 is " + attributes.get("a2")); | |||
</scriptdef> | |||
<b1 a="this is an 'a'"/> | |||
<b2 a2="this is an 'a2' for b2"/> | |||
</pre> | |||
<h3>Testing Scripts</h3> | |||
<p> | |||