You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jonathan gold <jg...@samizdatdigital.org> on 2005/08/07 00:03:56 UTC

programmatically creating and marshalling antfiles

are there libraries i've somehow missed in the ant api that allow me to 
take a Project object i've built programmatically and write it as an 
antfile to some OutputStream?

to give some context: as part of our buildsystem, i'm pulling packages 
and setting up directories and workspaces (using ivy and the like), and 
want to generate antfiles to do the builds. these antfiles need to 
contain (or import) the <path> objects inferred from the ivy pull. at 
the moment, i'm just building the antfile as a org.w3c.dom.Document, but 
would prefer to just do something like:

     Project proj = new Project();
     Path classPath = createClassPath( ... );
     ProjectWriter pw = new ProjectWriter();
     pw.writeProject( proj, someOutputStream );

but i don't see an easy way in the ant api to do this right now. if it's 
not there, and i'm missing it, is there interest in having me start some 
work on it?

incidentally, i tried searching for an answer to this question on some 
search engines, but the search terms make it a bit difficult, since 
searches for things like 'antfile writer', 'ant file writer', 'ant 
project marshaller' and 'ant project serializer' give results more about 
writing ant tasks (ie, 'joe the "ant" task "writer" ... ) and xml 
processing in general. anyway, i apologize if this has already been 
discussed, and would be happy to have a pointer to that previous 
discussion if such exists...


jon

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


Re: programmatically creating and marshalling antfiles

Posted by Steve Loughran <st...@apache.org>.
Jack Woehr wrote:
> Conor MacNeill wrote:
> 
>> jonathan gold wrote:
>>  
>>
>>> are there libraries i've somehow missed in the ant api that allow me to
>>> take a Project object i've built programmatically and write it as an
>>> antfile to some OutputStream?
>>>   
>>
>>
>> You have not missed anything as there are no libraries in Ant to do
>> this. There may be external projects/code that can do this. Ant itself
>> really only cares about the xml -> Project model direction.
>>  
>>
> Sounds like a bugzillable feature request, and a reasonable one.
> If it popped up, would any of the committers look at it, or is this
> an "entrepreneurial opportunity" :-)?
> 

could be a reasonable add-on, somewhere, though i dont know if it would 
work. There is no requirement for ant tasks to have getters to match 
their setters, so their state cannot be trivially introspected.

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


Re: programmatically creating and marshalling antfiles

Posted by Jack Woehr <ja...@well.com>.
Conor MacNeill wrote:

>jonathan gold wrote:
>  
>
>>are there libraries i've somehow missed in the ant api that allow me to
>>take a Project object i've built programmatically and write it as an
>>antfile to some OutputStream?
>>    
>>
>
>You have not missed anything as there are no libraries in Ant to do
>this. There may be external projects/code that can do this. Ant itself
>really only cares about the xml -> Project model direction.
>  
>
Sounds like a bugzillable feature request, and a reasonable one.
If it popped up, would any of the committers look at it, or is this
an "entrepreneurial opportunity" :-)?

-- 
Jack J. Woehr                 # Please change your address book listing
PO Box 51, Golden, CO 80402   # for me to "jax@well.com" for all email.
http://www.well.com/~jax      # DELETE LISTING: "jwoehr@attglobal.net"


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


Re: programmatically creating and marshalling antfiles

Posted by Conor MacNeill <co...@apache.org>.
jonathan gold wrote:
> are there libraries i've somehow missed in the ant api that allow me to
> take a Project object i've built programmatically and write it as an
> antfile to some OutputStream?

You have not missed anything as there are no libraries in Ant to do
this. There may be external projects/code that can do this. Ant itself
really only cares about the xml -> Project model direction.

Conor

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


Re: programmatically creating and marshalling antfiles

Posted by Alexey Solofnenko <tr...@gmail.com>.
Maybe it is better not to write the project at all, but construct it
on a fly and execute it right a way. Of cause, if project creation is
slow, you might want to cache the result. In that case, maybe you can
log all actions in your own format and do not create ANT XML.

- Alexey.


On 8/6/05, jonathan gold <jg...@samizdatdigital.org> wrote:
> are there libraries i've somehow missed in the ant api that allow me to
> take a Project object i've built programmatically and write it as an
> antfile to some OutputStream?
> 
> to give some context: as part of our buildsystem, i'm pulling packages
> and setting up directories and workspaces (using ivy and the like), and
> want to generate antfiles to do the builds. these antfiles need to
> contain (or import) the <path> objects inferred from the ivy pull. at
> the moment, i'm just building the antfile as a org.w3c.dom.Document, but
> would prefer to just do something like:
> 
>      Project proj = new Project();
>      Path classPath = createClassPath( ... );
>      ProjectWriter pw = new ProjectWriter();
>      pw.writeProject( proj, someOutputStream );
> 
> but i don't see an easy way in the ant api to do this right now. if it's
> not there, and i'm missing it, is there interest in having me start some
> work on it?
> 
> incidentally, i tried searching for an answer to this question on some
> search engines, but the search terms make it a bit difficult, since
> searches for things like 'antfile writer', 'ant file writer', 'ant
> project marshaller' and 'ant project serializer' give results more about
> writing ant tasks (ie, 'joe the "ant" task "writer" ... ) and xml
> processing in general. anyway, i apologize if this has already been
> discussed, and would be happy to have a pointer to that previous
> discussion if such exists...
> 
> 
> jon
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 


-- 
Alexey N. Solofnenko trelony at gmail.com
home: http://trelony.cjb.net/
Pleasant Hill, CA (GMT-8 hours usually)

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