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 <de...@samizdatdigital.org> on 2005/09/02 05:14:43 UTC

Re: programmatically creating and marshalling antfiles

Jose Alberto Fernandez wrote:
>>From: Jack Woehr [mailto:jax@well.com] 
>>
>>Steve Loughran wrote:
>>
>>
>>>Even if you could retro-fit every task out there with getters,
>>>  -what about overloaded set operatons? which one should 
>>
>>the get return?
>>
>>>  -what about property assignments. Tasks get their setters with
>>>properties expanded.
>>
>>Hmm. Ah, well. Writing out the project seems to be a fairly obvious 
>>functionality in comparison
>>to some of the exotic functionality of Ant. I guess it's just one of 
>>those things which in hindsight
>>the design should have accomodated, but which are difficult 
>>to retrofit 
>>given that the design
>>did not so accomodate.
>>
> 
> 
> Maybe we are looking at the problem the wrong way.
> What is what people want to do?
> Do they want to programatically create some project and then 
> as an after thought they decide to serialize it to XML? (which will not
> work);
> Or do they want to create a project programmatically with the intention
> of serializing it to XML.
> 
> If the later, then the obvious thing to do us to not create tasks
> directly
> but to create our wrapping objects. Actually, you could just as well
> use Jdom to compose the XML and then either serialize it into XML
> or produce the Project object out of it (we just need to generate SAX
> events
> out of it).
> 
> So, maybe there is a way to do it that is actually more natural for
> someone
> that just knows the ANT-XML syntax.
> 
> Jose Alberto
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 


hi. i'm getting back to this now, and saw that there were a few more 
responses. to answer your question -- it's the latter. i've gone the xml 
route. the problem is that i have many modules interacting to build a 
project, and it's difficult, though not impossible, to do this with DOM, 
as i am now. it's not the DOM that makes it hard -- but the lack of 
typing, thus the desire to use the java objects, with their convenient 
accessors and access to the current project structure and type safety.

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>.
jonathan gold wrote:

> 
> 
> hi. i'm getting back to this now, and saw that there were a few more 
> responses. to answer your question -- it's the latter. i've gone the xml 
> route. the problem is that i have many modules interacting to build a 
> project, and it's difficult, though not impossible, to do this with DOM, 
> as i am now. it's not the DOM that makes it hard -- but the lack of 
> typing, thus the desire to use the java objects, with their convenient 
> accessors and access to the current project structure and type safety.
> 


ahh, you are in the "O/X mapping is soluble camp", I see.

You could use Xom and provide classes (and a builder) for the core Ant 
things (project, target, core tasks) that map typed get/set to 
attribute/element manipulation of the nodes. This is what I do in my 
projects, and while it takes effort, it works well with XPath/Jaxen

-steve

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