You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Mirko Raner <mi...@raner.ws> on 2003/07/08 03:56:45 UTC

Using Ant API to create build scripts

Hi all,

I am currently working on an IDE plug-in that also requires automatic 
generation of Ant build scripts.
I had a look at the Ant API and noticed that there are classes for 
Projects, Targets, Tasks, etc. which are essentially created and 
populated by the ProjectHelper/ProjectHelper2 classes with the help of 
the underlying XML parser. The API allows easy creation of a Project 
object from a build script, but there is no way to create a build script 
from a Project object that is held in memory - or is there?
As Ant is mainly a build tool, the current API design makes sense, but 
for my purpose, I need to go the other way round. Unfortunately, I 
noticed that the existing Project/Target/Task classes are not very 
helpful for me as they do not offer methods to produce XML output and 
don't expose the underlying DOM objects (and they sometimes do not even 
offer getter methods for all the information that would be required to 
create the corresponding XML element).
My questions are now:

(a) Is there something I am missing in the Ant API that would allow me 
to create a build.xml file from an initialized Project object?
(b) If not, does anybody think that such functionality would be useful 
and should be added to the Ant API?
(c) And if so, does anybody have suggestions how that should be 
integrated with the existing API? (for example, expose DOM objects in 
Project/Target/Task, or create a separate build script creator API)

Thanks a lot,

Mirko

Mirko Raner
Software Engineer
PTSC
San Diego, CA



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


Re: Using Ant API to create build scripts

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Tue, 8 Jul 2003 11:56 am, Mirko Raner wrote:
> (a) Is there something I am missing in the Ant API that would allow me
> to create a build.xml file from an initialized Project object?

Sort of. You need to checkout the RuntimeConfigurable. It is a DOM of sorts 
that is maintained by Ant. You should be able to navigate the task structure 
from there. See the Task.getRuntimeConfigurableWrapper() method.

Conor


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