On Sun, 24 Sep 2006, Paul King <[EMAIL PROTECTED]> wrote:

[...]

> I was trying to create an AntUnit example with Groovy - mainly just
> to check out some namespace support which has just been added to
> Groovy's AntBuilder and currently have the following example
> working:
> 
>   import org.apache.tools.ant.taskdefs.Antlib
>   def ant = new AntBuilder()
>   def url = this.class.getResource('org/apache/ant/antunit/antlib.xml')
>   Antlib.createAntlib(ant.project, url, 
> 'antlib:org.apache.ant.antunit').execute()
>   ant.assertFileDoesntExist(file:'copytest1.tmp')
>   ant.copy(file:'antunit.groovy', tofile:'copytest1.tmp')
>   ant.assertFileExists(file:'copytest1.tmp')
>   ant.delete(file:'copytest1.tmp')

[...]

> Does the "Antlib.createAntlib" part look like a violation of what I
> should be doing from an Ant perspective?

You rely on an internal API - granted, technically it is public - so
you are in danger.  We try not to break our API, but we are more
willing to do so than to break the XML level API.

>From the Groovy user side of view, I'd expect this to be hidden by
AntBuilder.  Something like

ant.registerAntlib('antlib:org.apache.ant.antunit')

> Also, I was expecting to have to muck around with namespaces but
> they just dissappeared from the example at the moment. (Not sure
> this is a good thing or not.)

I don't think it is, since Antlibs are also a way to solve naming
conflicts and you loose that abiblity IIUC.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to