ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject Re: Abusing the BuildListener
Date Thu, 20 Jul 2006 20:26:59 GMT
I'd just like to award Henri the "Most Unexpected (ab)Use of Ant"
award for this month ;-)  This approach of using Aspect Oriented
programming in Ant using build listeners is something I had never
heard of or thought of.  It's a bit on the scary side, but truly
innovative nonetheless!

Congrats Henri ;-)  --DD

On 7/19/06, Henri Yandell <flamefew@gmail.com> wrote:
> On 7/12/06, Henri Yandell <flamefew@gmail.com> wrote:
> > I suspect this isn't what was intended for the build listener, but
> > I've been using it to override the build.xml for <junit> tasks. In
> > startTask I ensure that haltonerror and haltonfailure are set to
> > false. Next up I want to ensure there is always a <formatter
> > type="xml"/>, but adding a new task in seems a lot more painful than
> > simply modifying the existing objects.
>
> Very happy; I've got it working. Many thanks for all the help!
>
> I kept playing with the direction Matt had me go and it suddenly
> worked (when I was really looking to see what the old error was). The
> following code forces the haltonfailure and haltonerror attributes to
> always be false; and ensures that an xml output is always done.
>
>      public void taskStarted(BuildEvent event) {
>            if(event.getTask().getTaskName().equals("junit")) {
>                UnknownElement ue = (UnknownElement) event.getTask();
>                RuntimeConfigurable rc = ue.getWrapper();
>                rc.setAttribute("haltonfailure", "false");
>                rc.setAttribute("haltonerror", "false");
>
>                UnknownElement ue2 = new UnknownElement("formatter");
>                ue.addChild(ue2);
>
>                FormatterElement fe = new FormatterElement();
>                RuntimeConfigurable rc2 = new RuntimeConfigurable(fe,
> "formatter");
>                rc2.setAttribute("type", "xml");
>                rc.addChild(rc2);
>            }
>    }
>
>
> Hopefully there won't be any surprises when I throw this into a real scenario.
>
> Hen
>
> ---------------------------------------------------------------------
> 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