ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chane...@netscape.com (Patrick Chanezon)
Subject Re: Gentle introduction to scripting
Date Fri, 30 Jun 2000 18:03:56 GMT
All this sounds great Sam,
I had not followed the discussion on scripting and using Rhino seems an
excellent idea: it lets you take a complete control on ant in javascript.
When will all this be available ?

P@

rubys@us.ibm.com wrote:

> I put a lot of power into the scripting task, a lot more than I think
> people realize.  I wasn't going to discuss it until the time was right, but
> now it does appear that there is enough genuine interest (trust me, it was
> *very* controversial at the time).  I present it here to seed discussion -
> if there are things that there is consensus on needing to be changed, then
> I'm OK with change as I doubt that anybody is seriously using it.
>
> The first thing worth mentioning is that scripts have access to everything
> a Java task would have access to.  Below is an example of a simple loop
> which actually modifies the build script.  Note the use of the name
> "squares" and "main".
>
>    <project name="squares" default="main" basedir=".">
>
>      <target name="setup">
>
>        <script language="javascript"> <![CDATA[
>
>          for (i=1; i<=10; i++) {
>            echo = squares.createTask("echo");
>            main.addTask(echo);
>            echo.setMessage(i*i);
>          }
>
>        ]]> </script>
>
>      </target>
>
>      <target name="main" depends="setup" />
>
>    </project>
>
> And here is the output I get when I run this script on my machine:
>
>    Buildfile: build.xml
>    Project base dir set to: C:\tmp
>    Executing Target: setup
>    Executing Target: main
>    1
>    4
>    9
>    16
>    25
>    36
>    49
>    64
>    81
>    100
>    Completed in 4 seconds
>
> - Sam Ruby

--
Patrick Chanezon, iPlanet Market Maker- Portal/EServices Technical Lead
Netscape Communications Corp. - http://people.netscape.com/chanezon/
Opinions are my own.

"Two monks were arguing about a flag. One said: `The flag is moving.'
The other said: `The wind is moving.'
The sixth patriach happened to be passing by. He told them: `Not the wind, not
the flag; mind is moving.'"
Zen Koan


Mime
View raw message