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:47:33 GMT
I placed some system-outs in the parsing code.
The parsing is done by ProjectHelper2. Id is stored via AntXMLContext to the "UnknownElement".

C:\projekte\apache-ant-svn\sandbox\script>ant
Buildfile: C:\projekte\apache-ant-svn\sandbox\script\build.xml
PH2.ElemeentHandler.onStartElement  tag=echo  taskname=echo
AntXMLContext.configureId  element=org.apache.tools.ant.UnknownElement@1f89ab83  id=foo
PH2.ElemeentHandler.onStartElement  tag=script  taskname=script
AntXMLContext.configureId  element=org.apache.tools.ant.UnknownElement@383534aa  id=null


main:
   [script] PH2.ElemeentHandler.onStartElement  tag=antlib  taskname=antlib
   [script] AntXMLContext.configureId  element=org.apache.tools.ant.UnknownElement@50cbc42f
 id=null
   [script] PH2.ElemeentHandler.onStartElement  tag=componentdef  taskname=componentdef
            ... more element definitions ...

BUILD FAILED
C:\projekte\apache-ant-svn\sandbox\script\build.xml:9: org.mozilla.javascript.EcmaError: ReferenceError:
"foo" is not defined.



Jan


> -----Ursprüngliche Nachricht-----
> Von: Jan Matèrne (jhm) [mailto:apache@materne.de]
> Gesendet: Dienstag, 29. Oktober 2019 08:03
> An: 'Ant Developers List'
> Betreff: AW: Script task specification
> 
> 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



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


Mime
View raw message