ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject scriptdef
Date Mon, 09 Jun 2003 13:58:01 GMT
Hi all,

I've just added a <scriptdef> task to allow tasks to be created using scripts. 
It's loosely based on something I wrote a while back for Mutant. 

Attached below is an example usage. I had to make a few small mods to the core 
to give me enough control over the configuration of the task and its nested 
elements. The example should make usage pretty straight forward. Attributes 
and nested elements are passed in two script variables, oddly named 
"attributes" and "elements". The first of these is a simple map of Strings 
whilst the second is a map of lists.

One question I have is whether people feel this is something appropriate in 
Ant? Let me know your thoughts.

Formal documentation to follow ...


<project name="scripttest" default="test">

  <scriptdef name="scripttest" language="javascript">
    <attribute name="attr1"/>
    <element name="fileset" type="fileset"/>
    <element name="path" type="path"/>
      project.log("Hello from script");
      project.log("Attribute attr1 = " + attributes.get("attr1"));
      project.log("First fileset basedir = "
        + elements.get("fileset").get(0).getDir(project));
  <target name="test">
    <scripttest attr1="test">
        <pathelement location="src"/>
      <fileset dir="src"/>
      <fileset dir="main"/>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message