Hi all,
--On Saturday, March 18, 2000 10:42 PM -0500 [EMAIL PROTECTED] wrote:
OK, I've taken the plunge. I've committed a scripting task to Ant.
This looks very interesting :). Just one quick question... Why did you add extra 'id' attributes instead of using targets? Targets are already named.
My reason for asking is that it is unclear what your example script actually does:
<?xml version="1.0"?>
<project name="test" default="main">
<target name="main"> <property name="welcome" value="from BSF!" /> <echo message="hi there" id="echoTask"/>
<script language="javascript"> echoTask.setMessage(welcome) echoTask.execute() </script> </target>
</project>
Does the echo task get run the first time time through the script? My guess is yes. This means the output would be:
hi there from BSF!
In order to get a task referenced in a script that should not be executed normally you'd have to do something like:
<?xml version="1.0"?>
<project name="test" default="main">
<target name="neverrun"> <echo id="echoTask"/> </target>
<target name="main"> <property name="welcome" value="hi there from BSF!" />
<script language="javascript"> echoTask.setMessage(welcome) echoTask.execute() </script> </target>
</project>
which might output (haven't tested it):
hi there from BSF!
Which brings up another point: it looks like ids are gloablly scoped. This is fine. Just needs to be documented.
More interestingly, does this script work? And what does it output?
<?xml version="1.0"?>
<project name="test" default="main">
<target name="main"> <property name="welcome" value="from BSF!" />
<script language="javascript"> echoTask.setMessage(welcome) echoTask.execute() </script>
<echo message="hi there" id="echoTask"/> </target>
</project>
When I get back to CMU I'll have to play with this more...
later,
\x/ill :-}
