ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Matèrne (jhm) <apa...@materne.de>
Subject AW: Script task specification
Date Tue, 29 Oct 2019 07:02:57 GMT
It seems that the task must be executed before.
If you add a >depends="sub"< on the main target, that works.

So the question is: when are id's stored?
The parsing is done via ProjectHelper's and their SAX-Parser-Handlers.
On the first view I would say, that the id is stored while parsing - so before exucution.


Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Gintautas Grigelionis [mailto:g.grigelionis@gmail.com]
> Gesendet: Montag, 28. Oktober 2019 14:25
> An: Ant Developers List
> Betreff: Script task specification
> 
> 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>
> 
> Surely there are more limitations? Besides, failure modes are different
> in Rhino (unable to create engine) and Nashorn (reference not defined).
> 
> Regards,
> Gintas


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


Mime
View raw message