diff --git a/docs/manual/OptionalTasks/script.html b/docs/manual/OptionalTasks/script.html index 84060be34..257d0d268 100644 --- a/docs/manual/OptionalTasks/script.html +++ b/docs/manual/OptionalTasks/script.html @@ -26,7 +26,7 @@ used instead of the project name. The name "self" is a pre-defined reference to
If you are using JavaScript a good resource is http://www.mozilla.org/rhino/doc.html as we are using their JavaScript interpreter.
Scripts can do almost anything a task written in Java could do.
-Rhino provides a special construct - the JavaAdapter. Whith that you can +
Rhino provides a special construct - the JavaAdapter. With that you can create an object which implements several interfaces, extends classes and for which you can overwrite methods. Because this is an undocumented feature (yet), here is the link to an explanation: @@ -55,31 +55,52 @@ Groups@Google: "Rhino, enum.js, JavaAdapter?" by Norris Boyd in the newsgrou
++ <property name="message" value="Hello world"/> + + <script language="groovy"> + println("message is " + message) + </script> + + <script language="beanshell"> + System.out.println("message is " + message); + </script> + + <script language="jython"> +print "message is %s" % message + </script> ++
+ Note that for the jython example, the script contents must + start on the first column. +
++ The following script uses javascript to create a number of + echo tasks and execute them. +
<project name="squares" default="main" basedir="."> - <target name="setup"> + <target name="main"> <script language="javascript"> <![CDATA[ for (i=1; i<=10; i++) { echo = squares.createTask("echo"); - main.addTask(echo); echo.setMessage(i*i); + echo.perform(); } ]]> </script> </target> - <target name="main" depends="setup"/> - </project>
generates
-setup: - main: 1 4 @@ -211,4 +232,4 @@ apropriate logging before and after invoking execute(). Reserved.