ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Script task specification
Date Tue, 29 Oct 2019 06:44:54 GMT
On 2019-10-28, Gintautas Grigelionis wrote:

> The documentation of the script task states:

> "All items (tasks, targets, etc) of the running project are accessible from
> the script, using either their name or id attributes (as long as their
> names are considered valid Java identifiers, that is). "

> However, the following fails:

> <?xml version="1.0"?>
> <project name="test" default="main" basedir=".">
>   <target name="sub">
>     <echo id="foo">Executing a task</echo>
>   </target>

>   <!-- tests the script stuff -->
>   <target name="main">
>     <script language="javascript"><![CDATA[
>         foo.setMessage("I'm a foo!")
>         sub.execute()
>     ]]></script>
>   </target>
> </project>

Does it work if you make main depend on sub?

> Surely there are more limitations?

Probably :-)

<script> is most likely one of the lesser used parts of Ant.

> Besides, failure modes are different in Rhino (unable to create
> engine) and Nashorn (reference not defined).

Are you sure "unable to create engine" is due to "foo" not being defined
and not an independent problem with rhino? In any case, I don't believe
Ant should try to understand the error messages provided by the
scripting engine but rather present them to the user as they are.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message