ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: Antlib... when?
Date Sun, 05 Jan 2003 16:00:18 GMT

Costin Manolache wrote:
> Nicola Ken Barozzi wrote:
> 
> 
>>>>Any idea on when some sort of Antlib system will be setup?
>>>
>>>
>>>How is ant lib different from what krysalis does with cents
>>>http://krysalis.org/cents/
>>
>>Basically it makes Ant load *Tasks* without having to specify the name
>>and class in the buildfile. This for example can be used to
>>automatically load the <centipede/> task that automatically does
>>centipede init. Currently, we have to load it by a taskdef, with
>>explicit taskname.
> 
> 
> Nicola - you can just use taskdef with a resource parameter and define
> all the cents at once.

Yup, but you still have to do it.

I want to simply make the user add a <centipede/> tag in the buildfile, 
but since it's not loaded, it cannot load others the way you say... catch22.

I need something to load automatically, or I'll have something like this:

     <import file="${ant.home}/src/core/xbuild.xml"/>
     <taskdef file="${ant.home}/src/core/tasks.properties"/>

I have now made a Centipede task, but the best I can do is:

     <taskdef file="${ant.home}/src/core/tasks.properties"/>
     <centipede/> <!-- does the import -->

After that I can import the "cents", but only after that.

http://cvs.apache.org/viewcvs/jakarta-poi/centibuild.xml?rev=HEAD&content-type=text/vnd.viewcvs-markup


> Conor has a very good point - if you look at a buildfile you should
> be able to tell what antlibs it is using. 

If they are non-core I agree. But let me define what is core.
As Java can import anything and not use "namespace" on every class name 
with explicit import.

> Either 
>   <antlib name="org.krysalis.cents" />
> or
>   <project xmlns:cent="antlib:org.krysalis.cents" >
>   <cent:foo ...>
> 
> 
>>Cents are still more than a taglib, because they also carry resources
>>and buildfiles to be imported. They are versioned and automatically
>>downloaded. And access all the info about the project that Centipede
>>loads from the Gump descriptor.
> 
> 
> That's even better. You could implement ComponentHelper and intercept
> the component creation and download missing antlibs, etc. 

We did it without ComponentHelper and a <importcent/> task, that 
downloads the file with vfs-using ruper, installs it, unpacks it, 
imports the buildfile and loads the tasks. ComponentHelper could help in 
making the download "lazy", but it already works well now.

> If the build file doesn't specify what libs it needs - how could
> you guess ? ( i.e. if a build is written under the assumption that
> the antlibs exist already in ant/lib and no reference to the
> name of the antlibs is made ).

You are right, but I need to init the system. These "taglibs", that for 
us are cents, are downloaded by a task that we need to define. It would 
be nicer if it were already there. Not really necessary, but much nicer.


I have worked with XML a lot, in Cocoon and now Forrest.
Namespaces are ugly, hard to declare and make the xml files unreadable.

Ant buildfiles are nice also because they don't use namespaces. Please, 
let's resort to them only if *really* necessary.

You don't normally use full packagename of the classes in your java 
files, don't you?

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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


Mime
View raw message