You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Hanman Gajarla <ha...@powerupnetworks.com> on 2002/12/18 16:28:18 UTC

Generic template for software build plan

Looking for a generic template for a software ant build plan.
Appreciate your help.

Thanks in advance.

-Hanman

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Phillip Lord <p....@russet.org.uk>.
>>>>> "Nicola" == Nicola Ken Barozzi <ni...@apache.org> writes:

  Nicola> Phillip Lord wrote: [...]

  >> I'm still not sure. Centipede looks nice, and might do some of
  >> what I want, but its looks a lot more complex. I had a look
  >> through the wiki, but I couldn't find anything concrete
  >> describing what "the embed proposal" that you refer to, actually
  >> does. With my system, you just take the defined build file, and
  >> just

  >> override the bits you don't like. All the rest comes for free. I
  >> can still use my XML aware editor to do correct tag placement, as
  >> the individual project build files are just ant files, and most,
  >> although not all of the code duplication between projects that I
  >> have had in the past with ant disappears. And it works with any
  >> build file, including third party ones over which I have no
  >> control, which is useful for me. I'm not trying to convince you
  >> here. I wrote antmerge, because I

  >> needed something like it. My solution is cheap and cheerful. The
  >> code base is fairly small. And it mostly works. If people want to
  >> use it they are welcome to it, and if they don't, then this is
  >> fine also. If there is alternative which is better, then I'd like
  >> to know, because if I can spend less time doing my build, and
  >> more time developing the "end product", well thats good for me.


  Nicola> :-)

  Nicola> I'm trying to "sell" you the embed proposal because there is
  Nicola> a >0 possibility that it will go in the Ant codebase. Part
  Nicola> of it is being moved-intergrated in these days.


  Nicola> I'm just trying to understand id AntMerge does something new
  Nicola> I might be interested in for Centipede, and possibly work
  Nicola> together.


  Nicola> Here is how you can simply "override" as you say using the
  Nicola> embed proposal or Centipede:


  Nicola> you make a file called mybuild.xml and you can override it
  Nicola> in build.xml:

  Nicola> <project name="mainbuild" default="all" basedir=".">

  Nicola>     <import file="mybuild.xml"/>

  Nicola>     <!-- all targets define here override the ones
  Nicola>          in mybuild.xml -->

  Nicola>     <!-- The ones not overridden are available -->

  Nicola>     <!-- You can all the parent target with
  Nicola>          parentbuildname.target (IIRC) -->

  Nicola> </project>

  Nicola> Is this what AntMerge does?  You can also import more than
  Nicola> one file too.


Nearly. 

You can over ride any tag, as well as targets, with antmerge, so long
as the tag is, what I call "uniquely identifiable", which means that I
can work out which one in the "super class" file, is being over-ridden
by the sub class. So, for example, from antmerge's own build file
(it builds its own build file), we have....

  <property name="jar-dependencies" value="xercesImpljar,xmlParserAPIs.jar,java-getopt-1.0.9.jar"/>
  <property name="antmerge.parent" value="default"/>
  <property name="antmerge.infile" value="antmerge-in.xml"/>

which over ride the properties set in the parent (you could clearly
also do this by loading a properties file). So these end up in the
generated build.xml, over-ridding the parent.   

Then we have....

neither procompile.test, nor precompile.run exist in the parental
file. 

  <!-- check if any files are out of date -->
  <target name="precompile.test">
    <uptodate property="antfiles.uptodate"
      targetfile="${etc}/default.xml">
      <srcfiles dir="${etc}">
        <include name="default-in.xml"/>
        <include name="antmerge.xml"/>
      </srcfiles>
    </uptodate>
  </target>

  <!-- if any files are out of date rebuild them all (ant makes it too
  much hard work to just rebuild the right ones) -->
  <target name="precompile.run" depends="precompile.test"
    unless="antfiles.uptodate">
    <exec dir="${etc}" executable="antmerge">
      <arg line="--mainfile=antmerge.xml"/>
      <arg line="--mergefile=default-in.xml"/>
      <arg line="--output=default.xml"/>
    </exec>
    <!-- the antmerge.xml file which this inherits from checks whether build.xml is
    out of date with respect to antmerge-in.xml. It doesn't check whether its out
    of date with respect to default.xml. Generally users of antmerge will not be editing
    default.xml, so this is not a problem. But this file has to do it explicitly -->
    <exec dir="." executable="antmerge">
      <arg line="--mainfile=${antmerge.parent}"/>
      <arg line="--mergefile=${antmerge.infile}"/>
    </exec>
    <echo message="antmerge internal build files have been regenerated"/>
    <echo message="as antmerge's own build file is generated by antmerge"/>
    <echo message="it's possible that the build is not complete, and you"/>
    <echo message="may want to run ant again"/>
  </target>
  
but precompile itself does, although it has no dependencies in the
parental file. So we have hooked in different sets of targets. 

  <!-- we need to regenerate some build files -->
  <target name="precompile" depends="precompile.run"/>


Finally you can uniquely identify any tag using, guess it, an id tag. 

So..

  <property id="init.properties" file="init.properties"/>

in the parental file would be replaced by 

  <sleep id="init.properties"> 

in the child file. 

I haven't done multiple imports yet, but it's trivial to do (you just
do the merge repeatedly on one file after the other). 

This all sounds fairly obtuse, but I've played with it long enough to
know that generally it just does the right thing, and seems to make
sense. 

My code is on the web, if you want to play with it. 

Cheers

Phil

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Phillip Lord wrote:
[...]

> I'm still not sure. Centipede looks nice, and might do some of what I
> want, but its looks a lot more complex. I had a look through the wiki,
> but I couldn't find anything concrete describing what "the embed
> proposal" that you refer to, actually does. 
> 
> With my system, you just take the defined build file, and just
> override the bits you don't like. All the rest comes for free. I can
> still use my XML aware editor to do correct tag placement, as the
> individual project build files are just ant files, and most, although
> not all of the code duplication between projects that I have had in
> the past with ant disappears. And it works with any build file,
> including third party ones over which I have no control, which is
> useful for me. 
> 
> I'm not trying to convince you here. I wrote antmerge, because I
> needed something like it. My solution is cheap and cheerful. The code
> base is fairly small. And it mostly works. If people want to use it
> they are welcome to it, and if they don't, then this is fine also. If
> there is alternative which is better, then I'd like to know, because
> if I can spend less time doing my build, and more time developing the
> "end product", well thats good for me. 

:-)

I'm trying to "sell" you the embed proposal because there is a >0 
possibility that it will go in the Ant codebase. Part of it is being 
moved-intergrated in these days.

I'm just trying to understand id AntMerge does something new I might be 
interested in for Centipede, and possibly work together.

Here is how you can simply "override" as you say using the embed 
proposal or Centipede:

you make a file called mybuild.xml and you can override it in build.xml:

<project name="mainbuild" default="all" basedir=".">

    <import file="mybuild.xml"/>

    <!-- all targets define here override the ones
         in mybuild.xml -->

    <!-- The ones not overridden are available -->

    <!-- You can all the parent target with
         parentbuildname.target (IIRC) -->

</project>

Is this what AntMerge does?
You can also import more than one file too.

Centipede goes further and adds an <importcent> task that can 
automatically download the buildfile to use with all its resources and 
install it locally in the cent plugin repository.
But this is an extra feature that you peobably don't need ATM, the embed 
proposal will suffice. I showed you centipede because it's a prepackaged 
version of Ant with the embed proposal and extra targets. If you install 
it you can run both Ant buildfiles via embed or centipede ones, which 
simply have a different default name to prevent clashes in case other 
users don't have Centipede.

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Phillip Lord <p....@russet.org.uk>.
>>>>> "Nicola" == Nicola Ken Barozzi <ni...@apache.org> writes:

  Nicola> Phillip Lord wrote:
  >> "Nicola" == Nicola Ken Barozzi <ni...@apache.org> writes:
  Nicola> The embed proposal, that is in Ant CVS since some time now

  Nicola> well.  What is the difference with AntMerge? They seem
  >> very Nicola> similar.  No idea. Despite looking for quite a 

  >> The "embed proposal" is something I've not heard off. I managed
  >> to

  >> find the source, from poking around in the ant CVS. Is there any
  >> documentation anywhere? If someone else is working on something
  >> similar, I would be happy. I'm only writing tools for operating
  >> over build files out of necessity.


  Nicola> Look at Centipede. http://www.krysalis.org/centipede/

  Nicola> We use the embed proposal in our enhanced Ant distro. There
  Nicola> is not much documentation of the embed proposal yet, but
  Nicola> you'll find something in the Centipede wiki.

I'm still not sure. Centipede looks nice, and might do some of what I
want, but its looks a lot more complex. I had a look through the wiki,
but I couldn't find anything concrete describing what "the embed
proposal" that you refer to, actually does. 

With my system, you just take the defined build file, and just
override the bits you don't like. All the rest comes for free. I can
still use my XML aware editor to do correct tag placement, as the
individual project build files are just ant files, and most, although
not all of the code duplication between projects that I have had in
the past with ant disappears. And it works with any build file,
including third party ones over which I have no control, which is
useful for me. 

I'm not trying to convince you here. I wrote antmerge, because I
needed something like it. My solution is cheap and cheerful. The code
base is fairly small. And it mostly works. If people want to use it
they are welcome to it, and if they don't, then this is fine also. If
there is alternative which is better, then I'd like to know, because
if I can spend less time doing my build, and more time developing the
"end product", well thats good for me. 

Cheers

Phil

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Phillip Lord wrote:
> "Nicola" == Nicola Ken Barozzi <ni...@apache.org> writes:
> 
>   Nicola> The embed proposal, that is in Ant CVS since some time now
>   Nicola> and is regularly built by Gump, permits users to import ant
>   Nicola> buildfiles and redefine targets that have been imported.
> 
> 
>   Nicola> It's been used by Centipede since some months now and works
>   Nicola> well.  What is the difference with AntMerge? They seem very
>   Nicola> similar.
> 
> 
> No idea. Despite looking for quite a while, for something that did
> what I wanted, I've never found anything. So I wrote something. Its
> small, and simple, but even as it stands is seems to be decreasing the
> amount of duplication in my ant files. 
> 
> The "embed proposal" is something I've not heard off. I managed to
> find the source, from poking around in the ant CVS. Is there any
> documentation anywhere? If someone else is working on something
> similar, I would be happy. I'm only writing tools for operating over
> build files out of necessity. 

Look at Centipede. http://www.krysalis.org/centipede/

We use the embed proposal in our enhanced Ant distro. There is not much 
documentation of the embed proposal yet, but you'll find something in 
the Centipede wiki.

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Phillip Lord <p....@russet.org.uk>.
>>>>> "Nicola" == Nicola Ken Barozzi <ni...@apache.org> writes:

  Nicola> Phillip Lord wrote:
  >> "Hanman" == Hanman Gajarla <ha...@powerupnetworks.com>
  >> writes: Hanman> Looking for a generic template for a software ant
  >> build

  Hanman> plan.  Appreciate your help.  Hanman> Thanks in advance.

  Hanman> -Hanman

  >> You can try my antmerge tool. Its in it's early days yet, but it

  >> provides a generic build environment using ant, and a system for
  >> incorporating local changes to the build
  >> environment. http://www.russet.org.uk/download/java/antmerge/


  Nicola> The embed proposal, that is in Ant CVS since some time now
  Nicola> and is regularly built by Gump, permits users to import ant
  Nicola> buildfiles and redefine targets that have been imported.


  Nicola> It's been used by Centipede since some months now and works
  Nicola> well.  What is the difference with AntMerge? They seem very
  Nicola> similar.


No idea. Despite looking for quite a while, for something that did
what I wanted, I've never found anything. So I wrote something. Its
small, and simple, but even as it stands is seems to be decreasing the
amount of duplication in my ant files. 

The "embed proposal" is something I've not heard off. I managed to
find the source, from poking around in the ant CVS. Is there any
documentation anywhere? If someone else is working on something
similar, I would be happy. I'm only writing tools for operating over
build files out of necessity. 

Cheers

Phil



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Phillip Lord wrote:
> "Hanman" == Hanman Gajarla <ha...@powerupnetworks.com> writes:
> 
> 
>   Hanman> Looking for a generic template for a software ant build
>   Hanman> plan.  Appreciate your help.
> 
>   Hanman> Thanks in advance.
> 
>   Hanman> -Hanman
> 
> You can try my antmerge tool. Its in it's early days yet, but it
> provides a generic build environment using ant, and a system for
> incorporating local changes to the build environment. 
> 
> http://www.russet.org.uk/download/java/antmerge/

The embed proposal, that is in Ant CVS since some time now and is 
regularly built by Gump, permits users to import ant buildfiles and 
redefine targets that have been imported.

It's been used by Centipede since some months now and works well.
What is the difference with AntMerge? They seem very similar.

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Generic template for software build plan

Posted by Phillip Lord <p....@russet.org.uk>.
>>>>> "Hanman" == Hanman Gajarla <ha...@powerupnetworks.com> writes:

  Hanman> Looking for a generic template for a software ant build
  Hanman> plan.  Appreciate your help.

  Hanman> Thanks in advance.

  Hanman> -Hanman

You can try my antmerge tool. Its in it's early days yet, but it
provides a generic build environment using ant, and a system for
incorporating local changes to the build environment. 

http://www.russet.org.uk/download/java/antmerge/


Cheers


Phil

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>