ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Le <al...@gmx.de>
Subject Re: Creating task/macro wrappers
Date Sat, 23 Feb 2019 23:16:26 GMT
You could write a script, e.g. in JavaScript. There, you would create a 
new instance of the testng task (using the global 'project' object), 
then set all the necessary attributes and nested elements of the task 
(don't forget to set the owning target), and, finally, call its 
'execute' method.



Am 23.02.2019 um 10:37 schrieb Isaac Jurado:
> Hello Ant users,
> 
> I'm trying to create a <macrodef> wrapper over <testng>.  The idea is
> to have my macro expose the same attributes that <testng> supports,
> with as close semantics as possible.
> 
> Unfortunately, I have no idea how to reproduce the presence/absence
> behavior.  For instance, <testng> accepts a "timeout" integer
> attribute.  So in my macro I would do:
> 
> <attribute name="timeout" default=""/>
> 
> And then calling TestNG would be:
> 
> <testng timeout="@{timeout}">...</testng>
> 
> But this turns out not to be the same behavior as NOT specifying the
> timeout attribute.  In this case, Ant fails because empty string does
> not parse to an integer.
> 
> Is there a way to achieve my goal?  I would like to avoid writing Java
> code.  But I don't mind resorting to Javascript in the build file
> (<script> or <scriptdef>).
> 
> Thanks in advance.
> 

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


Mime
View raw message