You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@bost.de> on 2000/07/21 11:14:14 UTC

Can scripting help us with immutable properties, template targets ...

Hi,

I've taken a quick look at the possibilities the <script> task would
offer, see this:

<project name="testscript" default="main">
  <target name="sub">
    <echo id="theEcho" />
  </target>

  <target name="sub1">
    <script language="javascript"><![CDATA[
      theEcho.setMessage("In sub1");
      sub.execute();
    ]]></script>
  </target>

  <target name="sub2">
    <script language="javascript"><![CDATA[
      theEcho.setMessage("In sub2");
      sub.execute();
    ]]></script>
  </target>

  <target name="main" depends="sub1,sub2" />
</project>

and this:

bodewig@sbodewig ~/jakarta >ant -buildfile testscript.xml 
Buildfile: testscript.xml

sub1:
In sub1

sub2:
In sub2

main:

BUILD SUCCESSFUL

My feeling at the moment is that we could go the direction of saying:

Don't add more logic, procedural aspects, scoped properties or
whatever is missing to Ant, do it with scripting. 

The same I've just done with JavaScript could easily be done with a
task written in Java - but actually this one took me ten minutes
(spending five of them reading the code of Script.java and some doc of
BSF and another four on getting the capitalization of "javascript"
right).

I'm willing to start writing a scripting tutorial (would you please
help me Sam) if this is all that's needed.

What do you think?

Stefan

Re: Can scripting help us with immutable properties, template targets ...

Posted by James Duncan Davidson <du...@x180.com>.
on 7/21/00 2:14 AM, Stefan Bodewig at bodewig@bost.de wrote:

> My feeling at the moment is that we could go the direction of saying:
> 
> Don't add more logic, procedural aspects, scoped properties or
> whatever is missing to Ant, do it with scripting.

++1.

And if you open up the Ant "data" structure to scripting, then nothing
should be immutable. :)

.duncan