ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <dona...@mad.scientist.com>
Subject Re: Extending ant from within ant
Date Tue, 01 Aug 2000 05:50:13 GMT
At 10:43  31/7/00 -0700, you wrote:
>I'm interested in a couple of ideas that are somewhat along the lines 
>of what XSLT (XSL Transformations) is supposed to support. I'd like 
>to be able to define tasks in XML that correspond to combinations of 
>other tasks. For example, to build a tool for JShell, I have the 
>following generic pattern:

there has been a demand for similar things in ant recently.

>What I'd really like to do is to define a task, say "buildtool" that 
>would be composed of sub-tasks, mkdir, javac, and jlink. Of course, 
>I'd want to define a jlink subtask in terms of exec, as I've done 
>above. Is this possible with ant currently?

yes as you have done it above but as a more complex approach is noyt possible.

>Another idea I'd like to explore is using Rhino JavaScript (big 
>surprise) to provide scripting within a build.xml file. We could then 
>define additional tasks dynamically in terms of scripts. Much of the 
>currently built-in tasks could be recast in terms of scripts, where 
>appropriate.

actually that is already possible. The BSF is used in script task to offer
said functionality.  From one of Sam Rubies posts :

   <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>

Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*

Mime
View raw message