On 2018-03-17, Jaikiran Pai wrote:
> Thanks for the input, Stefan. I took your suggestion and exposed a API
> to get the Project on that custom interface. It doesn't/can't directly
> use the IntrospectionHelper support available to project components,
> since unlike nested elements of a task, this custom class can be
> plugged in something like:
> <listener
> classname="some.custom.class.implementing.an.task.specific.interface"/>
> plus the fact that this custom class can reside in a classloader
> defined by nested <classpath> elements of this task.
Just a few remarks, do with them however you see fit :-)
* you can use part of IntrospectionHelper's infrastructure, of
course. At least Project#setProjectReference so you don't have to
reinvent the reflrection logic.
* Your approach for listeners is that of the original JUnit task and
predates support for typedef together with
public void add(SomeInterface child);
for nested elements. Later we would have used the newer approach (see
for example the <condition> task accepting arbitrary Condition
implementations.
You may consider using
public void addConfigured(ListenerInterface l) { ... }
in your task and
<typedef name="customListener"
classname="some.custom.class.implementing.an.task.specific.interface"/>
<junitlauncher ...>
<cusomListener/>
</junitlauncher>
in the build file. You'd even get classloader support for free.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]