A lot of the build problems that we have been having lately have been due to
people forgetting to set the correct dependencies in the right places.
And from
having the projects listed in the wrong order in the root build.xml.
I've gone through way too many times trying to work out the correct order to
build the projects so that they will work.
I would like to commit the attached build file. It takes advantage of
Ant's built
in dependency tree to build the subprojects. Each project has a task
that depends
on other tasks.
For example:
<!-- Datasource -->
<target name="prj-datasource" depends="prj-instrument, prj-pool">
<ant dir="datasource" target="${subproject-target}"/>
</target>
When you want to execute a target on all of the subprojects, you do so
as follows:
<target name="clean" description="Cleans each of the subprojects">
<delete dir="${build.dir}" />
<ant target="build-all-subprojects">
<property name="subproject-target" value="real-clean"/>
</ant>
</target>
This is much simpler than the long lists of projects, which by the way
were never all
the same.
Anyway, have a look, give it a try. If there are no objections, I'll
go ahead and commit
it tomorrow.
Cheers,
Leif
<project name="Excalibur Driver Build file" default="main" basedir=".">
<!--
Give user a chance to override without editing this file
(and without typing -D each time he compiles it)
-->
<property file="ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<!-- location of intermediate products -->
<property name="build.dir" value="build"/>
<property name="build.reports" value="${build.dir}/reports"/>
<property name="build.tests" value="${build.dir}/tests"/>
<target name="main" depends="jar"/>
<target name="check-subproject-target" unless="subproject-target">
<echo message="subproject target was not set. defaulting to 'jar'"/>
<property name="subproject-target" value="jar"/>
</target>
<!-- ************************************************************ -->
<!-- Subproject targets -->
<!-- ************************************************************ -->
<!-- List projects in alphabetical order. All dependent projects -->
<!-- within Excalibur should be listed in the depends list. -->
<!-- Do not include test dependent jars in the depends list. -->
<!-- Altrmi -->
<target name="prj-altrmi" depends="prj-pool">
<ant dir="altrmi" target="${subproject-target}"/>
</target>
<!-- Baxter -->
<target name="prj-baxter">
<ant dir="baxter" target="${subproject-target}"/>
</target>
<!-- BZip2 -->
<target name="prj-bzip2">
<ant dir="bzip2" target="${subproject-target}"/>
</target>
<!-- Cache -->
<target name="prj-cache">
<ant dir="cache" target="${subproject-target}"/>
</target>
<!-- Cli -->
<target name="prj-cli">
<ant dir="cli" target="${subproject-target}"/>
</target>
<!-- Collections -->
<target name="prj-collections">
<ant dir="collections" target="${subproject-target}"/>
</target>
<!-- Component -->
<target name="prj-component" depends="prj-collections, prj-instrument, prj-instrument-manager, prj-logger, prj-pool">
<ant dir="component" target="${subproject-target}"/>
</target>
<!-- Concurrent -->
<target name="prj-concurrent">
<ant dir="concurrent" target="${subproject-target}"/>
</target>
<!-- Configuration -->
<target name="prj-configuration">
<ant dir="configuration" target="${subproject-target}"/>
</target>
<!-- ContainerKit -->
<target name="prj-containerkit" depends="prj-i18n">
<ant dir="containerkit" target="${subproject-target}"/>
</target>
<!-- Converter -->
<target name="prj-converter" depends="prj-i18n">
<ant dir="converter" target="${subproject-target}"/>
</target>
<!-- Datasource -->
<target name="prj-datasource" depends="prj-instrument, prj-pool">
<ant dir="datasource" target="${subproject-target}"/>
</target>
<!-- Event -->
<target name="prj-event" depends="prj-collections, prj-concurrent, prj-threadcontext, prj-util">
<ant dir="event" target="${subproject-target}"/>
</target>
<!-- Extension -->
<target name="prj-extension">
<ant dir="extension" target="${subproject-target}"/>
</target>
<!-- Fortress -->
<target name="prj-fortress" depends="prj-altrmi, prj-collections, prj-event, prj-instrument, prj-instrument-manager, prj-logger, prj-sourceresolve, prj-threadcontext">
<ant dir="fortress" target="${subproject-target}"/>
</target>
<!-- I18n -->
<target name="prj-i18n">
<ant dir="i18n" target="${subproject-target}"/>
</target>
<!-- Instrument -->
<target name="prj-instrument">
<ant dir="instrument" target="${subproject-target}"/>
</target>
<!-- InstrumentClient -->
<target name="prj-instrument-client" depends="prj-altrmi, prj-instrument-manager">
<ant dir="instrument-client" target="${subproject-target}"/>
</target>
<!-- InstrumentManager -->
<target name="prj-instrument-manager" depends="prj-altrmi, prj-instrument">
<ant dir="instrument-manager" target="${subproject-target}"/>
</target>
<!-- IO -->
<target name="prj-io">
<ant dir="io" target="${subproject-target}"/>
</target>
<!-- JProcess -->
<target name="prj-jprocess" depends="prj-io, prj-threadcontext">
<ant dir="jprocess" target="${subproject-target}"/>
</target>
<!-- Logger -->
<target name="prj-logger">
<ant dir="logger" target="${subproject-target}"/>
</target>
<!-- Merlin -->
<target name="prj-merlin" depends="prj-configuration" >
<ant dir="merlin" target="${subproject-target}"/>
</target>
<!-- Monitor -->
<target name="prj-monitor" depends="prj-logger, prj-sourceresolve">
<ant dir="monitor" target="${subproject-target}"/>
</target>
<!-- Naming -->
<target name="prj-naming">
<ant dir="naming" target="${subproject-target}"/>
</target>
<!-- Pool -->
<target name="prj-pool" depends="prj-collections, prj-instrument">
<ant dir="pool" target="${subproject-target}"/>
</target>
<!-- SourceResolve -->
<target name="prj-sourceresolve" depends="prj-pool">
<ant dir="sourceresolve" target="${subproject-target}"/>
</target>
<!-- Store -->
<target name="prj-store">
<ant dir="store" target="${subproject-target}"/>
</target>
<!-- Tar -->
<target name="prj-tar">
<ant dir="tar" target="${subproject-target}"/>
</target>
<!-- Testcase -->
<target name="prj-testcase" depends="prj-component, prj-logger">
<ant dir="testcase" target="${subproject-target}"/>
</target>
<!-- Thread -->
<target name="prj-thread" depends="prj-instrument, prj-pool, prj-threadcontext">
<ant dir="thread" target="${subproject-target}"/>
</target>
<!-- ThreadContext -->
<target name="prj-threadcontext">
<ant dir="threadcontext" target="${subproject-target}"/>
</target>
<!-- Tweety -->
<target name="prj-tweety">
<ant dir="tweety" target="${subproject-target}"/>
</target>
<!-- Util -->
<target name="prj-util">
<ant dir="util" target="${subproject-target}"/>
</target>
<!-- XMLBundle -->
<target name="prj-xmlbundle" depends="prj-component, prj-sourceresolve, prj-xmlutil">
<ant dir="xmlbundle" target="${subproject-target}"/>
</target>
<!-- XMLUtil -->
<target name="prj-xmlutil" depends="prj-collections, prj-component, prj-instrument, prj-logger, prj-pool, prj-sourceresolve, prj-store, prj-testcase">
<ant dir="xmlutil" target="${subproject-target}"/>
</target>
<!-- Zip -->
<target name="prj-zip">
<ant dir="zip" target="${subproject-target}"/>
</target>
<!-- ************************************************************ -->
<!-- Build all Subprojects target -->
<!-- ************************************************************ -->
<!-- This target depends on all of the projects above. Relies on -->
<!-- Ant to decide on the correct build order. -->
<target name="build-all-subprojects" depends="prj-altrmi, prj-baxter, prj-bzip2, prj-cache, prj-cli, prj-collections, prj-component, prj-concurrent, prj-configuration, prj-containerkit, prj-converter, prj-datasource, prj-event, prj-extension, prj-fortress, prj-i18n, prj-instrument, prj-instrument-client, prj-instrument-manager, prj-io, prj-jprocess, prj-logger, prj-merlin, prj-monitor, prj-pool, prj-sourceresolve, prj-store, prj-tar, prj-testcase, prj-thread, prj-threadcontext, prj-tweety, prj-util, prj-xmlbundle, prj-xmlutil, prj-zip">
</target>
<!-- ************************************************************ -->
<!-- Actual Build Targets -->
<!-- ************************************************************ -->
<!-- Build default targets of all subprojects. -->
<!-- The dependency checker was causing a strange problem where the version of -->
<!-- jars was being set to 2.2.D11 for some reason?? To work around the problem -->
<!-- depending on jar makes sure that all of the dependencies will be satisfied -->
<!-- in advance. -->
<target name="build-subprojects-dist" depends="jar">
<ant target="build-all-subprojects">
<property name="subproject-target" value="dist"/>
</ant>
</target>
<target name="jdepend" if="do.jdepend" description="Generate Dependency Analysis Report">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.reports}"/>
<path id="java.src">
<pathelement location="altrmi/src/java"/>
<pathelement location="altrmi/src/test"/>
<pathelement location="instrument/src/java"/>
<pathelement location="instrument/src/client"/>
<pathelement location="instrument/src/manager"/>
<pathelement location="instrument/src/test"/>
<pathelement location="concurrent/src/java"/>
<pathelement location="concurrent/src/test"/>
<pathelement location="collections/src/java"/>
<pathelement location="collections/src/test"/>
<pathelement location="baxter/src/java"/>
<pathelement location="baxter/src/test"/>
<pathelement location="bzip2/src/java"/>
<pathelement location="bzip2/src/test"/>
<pathelement location="cache/src/java"/>
<pathelement location="cache/src/test"/>
<pathelement location="cli/src/java"/>
<pathelement location="cli/src/test"/>
<pathelement location="extension/src/java"/>
<pathelement location="extension/src/test"/>
<pathelement location="i18n/src/java"/>
<pathelement location="i18n/src/test"/>
<pathelement location="io/src/java"/>
<pathelement location="io/src/test"/>
<pathelement location="monitor/src/java"/>
<pathelement location="monitor/src/test"/>
<pathelement location="naming/src/java"/>
<pathelement location="naming/src/test"/>
<pathelement location="sourceresolve/src/java"/>
<pathelement location="sourceresolve/src/test"/>
<pathelement location="store/src/java"/>
<pathelement location="store/src/test"/>
<pathelement location="tar/src/java"/>
<pathelement location="tar/src/test"/>
<pathelement location="xmlbundle/src/java"/>
<pathelement location="xmlbundle/src/test"/>
<pathelement location="zip/src/java"/>
<pathelement location="zip/src/test"/>
</path>
<!-- Classpath for product -->
<path id="jdepend.class.path">
<pathelement path="${java.class.path}"/>
<pathelement location="${checkstyle.jar}"/>
</path>
<!-- this invocation of jdepend requires the CVS version of ant for the xml format -->
<!-- thats why you are required to define do.jdepend property to generate the report -->
<jdepend outputfile="${build.dir}/jdepend-results.xml" format="xml" fork="yes">
<classpath refid="jdepend.class.path"/>
<sourcespath>
<path refid="java.src" />
</sourcespath>
</jdepend>
<mkdir dir="${build.reports}/jdepend"/>
<style in="${build.dir}/jdepend-results.xml"
processor="trax"
out="${build.reports}/jdepend/delete-me.txt"
style="${ant.home}/etc/jdepend-frames.xsl"/>
</target>
<!-- Build a summary test report from the results of the tests of all subprojects. -->
<target name="test-reports" depends="build-subprojects-dist">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.tests}"/>
<mkdir dir="${build.reports}"/>
<junitreport todir="${build.tests}">
<fileset dir="${basedir}">
<include name="*/build/tests/TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.reports}"/>
</junitreport>
</target>
<!-- Distribution build for all subprojects. -->
<target name="dist" depends="test-reports"
description="Create binary distributions of all the products"/>
<!-- Generate one jar functionally equivalent to the old avalon-excalibur.jar -->
<target name="jar" description="Generates avalon-excalibur.jar">
<!-- As we know the order here is correct, we don't need to do
dependency checking -->
<property name="skip.dependencies" value="true"/>
<ant target="build-all-subprojects">
<property name="subproject-target" value="dist-jar"/>
</ant>
<!-- Jump through hoops to avoid jlink size bug. -->
<property name="tmpjarA" value="avalon-excalibur-tmpA.jar"/>
<property name="tmpjarB" value="avalon-excalibur-tmpB.jar"/>
<property name="tmpjarAB" value="avalon-excalibur-tmpAB.jar"/>
<jlink compress="false" outfile="${tmpjarA}">
<mergefiles>
<fileset dir=".">
<include name="collections/dist/*.jar"/>
<include name="instrument/dist/*.jar"/>
<include name="instrument-manager/dist/*.jar"/>
<include name="concurrent/dist/*.jar"/>
<include name="i18n/dist/*.jar"/>
<include name="io/dist/*.jar"/>
<include name="pool/dist/*.jar"/>
<include name="logger/dist/*.jar"/>
<include name="component/dist/*.jar"/>
<include name="sourceresolve/dist/*.jar"/>
<exclude name="*/dist/*a.jar"/> <!-- Exclude alpha quality jars -->
</fileset>
</mergefiles>
</jlink>
<jlink compress="false" outfile="${tmpjarB}">
<mergefiles>
<fileset dir=".">
<include name="testcase/dist/*.jar"/>
<include name="datasource/dist/*.jar"/>
<include name="util/dist/*.jar"/>
<include name="store/dist/*.jar"/>
<include name="xmlbundle/dist/*.jar"/>
<include name="cli/dist/*.jar"/>
<include name="naming/dist/*.jar"/>
<include name="monitor/dist/*.jar"/>
<include name="store/dist/*.jar"/>
<!-- These jars should not be in avalon-excalibur.jar as they are quite large.
<include name="altrmi/dist/*.jar"/>
-->
<exclude name="*/dist/*a.jar"/> <!-- Exclude alpha quality jars -->
</fileset>
</mergefiles>
</jlink>
<jlink compress="false" outfile="${tmpjarAB}">
<mergefiles>
<fileset dir=".">
<include name="${tmpjarA}"/>
<include name="${tmpjarB}"/>
</fileset>
</mergefiles>
</jlink>
<jar jarfile="avalon-excalibur.jar" compress="true">
<zipfileset src="${tmpjarAB}" />
</jar>
<delete file="${tmpjarA}"/>
<delete file="${tmpjarB}"/>
<delete file="${tmpjarAB}"/>
</target>
<!-- Generate one mega jar-ball -->
<target name="mega-jar" description="Generate one large jar for all the products">
<ant target="build-all-subprojects">
<property name="subproject-target" value="jar"/>
</ant>
<jlink compress="false" outfile="excalibur-all-tmp.jar">
<mergefiles>
<fileset dir=".">
<include name="*/build/lib/*.jar"/>
<include name="altrmi/**"/>
<!-- Instrument client is a standalone application -->
<exclude name="instrument-client/**"/>
</fileset>
</mergefiles>
</jlink>
<jar jarfile="excalibur-all.jar" compress="true">
<zipfileset src="excalibur-all-tmp.jar" />
</jar>
<delete file="excalibur-all-tmp.jar"/>
<echo>
-----------------------------------------------
WARNING: the jlink task is buggy, and the final
jar may not contain all the classes it's meant
to! Use this target at your own risk.
-----------------------------------------------
</echo>
</target>
<!-- Generate all docs -->
<target name="docs" description="Generate all the docs">
<ant dir="site" target="docs"/>
</target>
<!-- Generate all docs -->
<target name="site" depends="mega-jar" description="Generate all the docs for site">
<ant dir="site" target="site"/>
</target>
<!-- Generate all docs -->
<target name="site-docs" depends="site" description="Generate all the docs for site and Copy to site CVS">
<ant dir="site" target="site-docs"/>
</target>
<!-- Clean -->
<target name="clean" description="Cleans each of the subprojects">
<delete dir="${build.dir}" />
<ant target="build-all-subprojects">
<property name="subproject-target" value="real-clean"/>
</ant>
</target>
</project>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>