ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Goodnough" <Andrew.Goodno...@wicourts.gov>
Subject Re: Building from a list...
Date Tue, 25 Apr 2006 16:43:06 GMT
>>> On Tue, Apr 25, 2006 at 11:13 am, in message
<d8be87680604250913s762dceffoc5d83c8cd7b5eec1@mail.gmail.com>, "Andrew
Close"
<aclose@gmail.com> wrote: 
> hello,
> 
> i'm having a bit of a brain- fart coming up with a solution to this
> situation.  we have about 130 JAR files that we are building for a
> particular project.  most of these JARs are dependent on each other
so
> they require a specific build order.  i was hoping to create a list
of
> the projects that compose each JAR and feed this list to ANT to
build
> one at a time.  i know the Ant- Contrib project has a <foreach> tag
> that allows for iteration, but i'm a bit stumped on how to build
> everything from a properties file.  is this possible?  or is there a
> better way to approach this?
> 
> we're using VSS as source control and have several projects that are
> composed of several (130+) products/JARs in VSS.  so i'd like to
make
> a list of Project.Product that i can iterate through and
> build/JAR/deploy in order.
> so in VSS we may have Project1 that contains ProductA, ProductB &
> ProductC and Project2 that contains ProductD & ProductE and Project3
> that contains ProductF, ProductG & ProductH.  the build order may
end
> up being:
> ProductB, ProductG, ProductA, ProductC, ProductD, ProductF,
ProductE...
> so my initial idea was to create a master list that contains these
> products in their proper build order:
> Project1.ProductB
> Project3.ProductG
> Project1.ProductA
> Project1.ProductC
> Project2.ProductD
> Project3.ProductF
> Project2.ProductE
> 
> our ANT build file is currently set up to build products
individually.
>  so typically we'd pass in the ProjectName, ProductName, Branch,
> DeliverableType and DeploymentDest to build one product/JAR/etc.  to
> build all applications (build world) we have to either type this in
> manually 130+ times or we use a .bat file that makes 130+ calls. 
the
> problem with the .bat file is that if product 15 fails a bunch of
> builds that follow will fail due to dependency.  there is no good
way
> to stop the build process on error.  so i was hoping ANT would be
able
> to come to the rescue. :)
> hopefully this is enough background to either come up with a
solution
> or generate some discussion that will lead to a solution.
> thanks for any help you can offer.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e- mail: user- unsubscribe@ant.apache.org
> For additional commands, e- mail: user- help@ant.apache.org

We have a large amount of projects with interdependencies, too.  Our
process sets up a set of files (with pre-defined names) which allow the
project owner to configure dependencies, including triggering
sub-builds, in any.  First, here's how the classpath is setup for the
compile.  The "includesfile" property includes from the files.  

  <path id="project.class.path">
    <dirset dir=".." includesfile="${classes.depend.file}"/>
    <fileset dir="${lib.dir}" includesfile="${jars.depend.file}"/>
    <fileset dir="${sharedlib.dir}"
includesfile="${sharedjars.depend.file}"/>
  </path>

A typical jars.depend file looks like this:

===jars.depend===
xml-apis.jar
xerces-2_0_1.jar
xalan-j_2_3_1.jar
=============

and

===classes.depend===
Global-Utils/build/classes
Parent-Proj/build/classes
===============


Second, if in addition to including the classes from Global-Utils and
Parent-Proj, you want this project to build both projects before
building itself, then have your compile target depend on sub-compile
target like:

  <target name="compile-subprojects">
    <subant target="compile">
      <dirset dir=".." includesfile="${projects.depend.file}"/>
    </subant>
  </target>

  <target name="compile" depends="init,compile-subprojects"
description="Compiles the source files">
    <javac srcdir="${src.dir}"
           destdir="${build.classes}">
        <classpath refid="project.class.path"/>
    </javac>
  </target>


where you put the 2 projects in the projects.depend:

===projects.depend===
Global-Utils
Parent-Proj
===============


Each project must have standard target names to use this scheme, but it
scales well.  We use Entity references to gain a type of inheritance in
Ant to reuse common targets but that's another topic.  Good luck!


Andy

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


Mime
View raw message