ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: Object oriented builds
Date Sun, 23 Jun 2002 04:08:39 GMT
At 11:45 PM 6/22/2002 -0400, you wrote:
>  I'm thinking at the API level now, not the XML representation.
>What I'd like to do is create a StandardJavaProject project which does all
>the basic stuff like init, clean, compile, jar, and javadoc.  In slightly
>more advanced projects, I might want to use a XDocletProject, where all
>stays the same except a new "gensrc" target is added and the compile target
>is modified to depend on it and add the generated source directory to the
>compile and javadoc stage.  Does that make sense?

In myrmidon this is the case. You can define "templates" for each of your 
important build processes and then reuse them. For example you could do the 
following

<template-def name="x-buildnumber">
   <attribute name="file" type="java.io.File" default="build.number"/>
   <logic>
     <buildnumber file="@{file}"/>
     <exec command="cvs commit @{file}"/>
   </logic>
</template-def>

Then later in your build you just do

<x-buildnumber/> and it increments build number and commits it back to CVS. 
Of course these templates can be as complex or simple as you want.

As the templates get larger or shared you will want them to be stored in a 
library. So you create a separate XML file and then register them template 
as a task with a special factory. Usually you register tasks via

<types>
   <task name="buildnumber" impl="o.a.a.build.BuildNumber"/>
</types>

However when you are doing template tasks you need an extra attribute 
("factory") to indicate how the tasks are created. (Note that this is not 
entirely implemented in Myrmidon just yet I don't think - Adam?). So it 
ends up looking like

<types>
   <task name="x-buildnumber" impl="o/a/a/build/BuildNumber.template" 
factory="template-factory"/>
</types>

The problem with the current implementation is that the template is loaded 
into memory when it is declared which ends up using massive amounts of 
memory when you are not using template. So in the future myrmidon will load 
and cache templates at runtime.

The idea is to support all the functionality needed for meta build projects 
like Centipede/Maven (but let them rigfht the actual templates).


Cheers,

Peter Donald
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Faced with the choice between changing one's mind,
and proving that there is no need to do so - almost
everyone gets busy on the proof."
              - John Kenneth Galbraith
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


--
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