ant-user mailing list archives

>>> On Tue, Apr 25, 2006 at 12:52 pm, in message
<d8be87680604251052k520f8a92yf34c04c891bcfc8c@mail.gmail.com>, "Andrew
Close"
<aclose@gmail.com> wrote:
> On 4/25/06, Andrew Goodnough <Andrew.Goodnough@wicourts.gov> wrote:
>> >>> 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,
>
> thanks for your reply.
> so do you have a single task/target that you kick off that builds
> everything for you? would i end up with 130+ individual targets
> that depend on each other in your scenario?
> i.e:
>
> <target name="ProductA">
> <ant antfile="jar.xml" dir="build.dir" target="all" >
> <property name="ProductA" ... />
> </ant>
> </target>
>
> <target name="ProductB" depends="ProductA>
> <ant antfile="jar.xml" dir="build.dir" target="all" >
> <property name="ProductB" ... />
> </ant>
> </target>
>
> <target name="ProductC" depends="ProductB>
> <ant antfile="jar.xml" dir="build.dir" target="all" >
> <property name="ProductC" ... />
> </ant>
> </target>
>
> this scenario is what i was hoping to avoid by building a list of
> projects to be build in the correct order. maybe i'm missing
> something though...
>
>
---------------------------------------------------------------------
> To unsubscribe, e- mail: user- unsubscribe@ant.apache.org
> For additional commands, e- mail: user- help@ant.apache.org
Yeah, I forgot that part of what you were looking for. The closest
I've come is this, using a separate "branch-build" file located at the
root of your local workspace (same level with the projects):
===branch-build.xml===
<fileset dir="${branch.dir}">
<patternset id="project.files">
<include name="Biz-Cal/build.xml"/>
<include name="CCAP-FOP/build.xml"/>
<include name="CCAP-Util/build.xml"/>
<include name="Jade-Common-Client/build.xml"/>
<include name="Jade-Common-Queries/build.xml"/>
<include name="Jade-Datasource/build.xml"/>
<include name="Jade-Global/build.xml"/>
<include name="Jade-Global-Queries/build.xml"/>
<include name="Jade-GUI/build.xml"/>
<include name="Jade-JMS/build.xml"/>
<include name="Jade-JMX/build.xml"/>
<include name="Jade-JMX-JavaScript/build.xml"/>
<include name="Jade-PDF-Services/build.xml"/>
<include name="Jade-Plugin-Sybase/build.xml"/>
<include name="Jade-Protocols/build.xml"/>
<include name="Jade-Scanner/build.xml"/>
<include name="Jade-Security/build.xml"/>
<include name="Jade-Server/build.xml"/>
<include name="Jade-Software-Bootstrap/build.xml"/>
....etc....
</patternset>
</fileset>
<target name="compile" depends="version" description="Compiles the
source files for the whole branch">
<echo message="Compiling ${cvs.tag} projects..."/>
<subant target="compile">
<fileset dir="${branch.dir}">
<patternset refid="project.files"/>
</fileset>
</subant>
</target>
<target name="jar" depends="version" description="Assembles the
current build into a deployable jar files for the whole branch">
<echo message="Jaring ${cvs.tag} projects..."/>
<subant target="jar">
<fileset dir="${branch.dir}">
<patternset refid="project.files"/>
</fileset>
</subant>
</target>
..etc..
==================================
now I can issue the command:
ant -f branch-build.xml compile jar
You only have to maintain one main list of projects. You might be able
to get this into an external file, too. So, if you set up the
dependencies on a per project basis (from previous email) all
dependencies will be satisfied. Because this branch-build.xml file
calls project builds in order, many popular dependent projects will get
called multiple times. This is not horrible (unless you call clean on
every project) because each project will only have to compile once.
Andy
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org