You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/06/16 18:40:56 UTC

cvs commit: jakarta-avalon/tools generic-build.xml

leosimons    2002/06/16 09:40:56

  Added:       tools    generic-build.xml
  Log:
  non project specific avalon-oriented buildfile, very useful until tools like centipede/maven grow up.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/tools/generic-build.xml
  
  Index: generic-build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- =============================================================================================
  Generic Avalon-based Project Ant Buildfile
  ==================================================================================================
  
  Type 'ant' to build. The flag '-projecthelp' will list available targets.
  
  We assume ant 1.4.1 is installed on your system.
  
  Authors:
    Leo Simons <ls...@multimia.com>
  Legal:
    Copyright (c) 2002 Multi-M/IA Internet Architects BV. All rights reserved.
  ============================================================================================== -->
  
  <project name="Avalon XXX" default="main" basedir=".">
  	<!-- =====================================================================================
  	  property setup
  	====================================================================================== -->
  	<!-- Give user a chance to override -->
  	<property file="ant.properties"/>
  	<property file="${user.home}/.ant.properties"/>
  
  	<!-- Set project information -->
  	<property name="name" value="xxx"/>
  	<property name="Name" value="Xxx"/>
  	<property name="version" value="N.n-status-n"/>
  	<property name="year" value="1999-2002"/>
  	<property name="status" value="status"/>
  	<property name="release" value="Nth"/>
  	<property name="short.version" value="N.n"/>
  	<property name="copyright"
  			value="&quot;Copyright &#169; &{year} Apache Jakarta Project. All Rights Reserved.&quot;"/>
  
  	<!-- Set source directories -->
  	<property name="src.dir" value="src"/>
  	<property name="src.java" value="${src.dir}/java"/>
  	<property name="src.test" value="${src.dir}/test"/>
  	<property name="src.conf" value="${src.dir}/conf"/>
  	<property name="src.sql" value="${src.dir}/sql"/>
  	<property name="src.templates" value="${src.dir}/templates"/>
  	<property name="src.xdocs" value="${src.dir}/xdocs"/>
  	<property name="src.resources" value="${src.dir}/resources"/>
  	<property name="src.manifest" value="${src.dir}/manifest"/>
  
  	<!-- Set build directories -->
  	<property name="build.dir" value="build"/>
  	<property name="build.lib" value="${build.dir}/lib"/>
  	<property name="build.classes" value="${build.dir}/classes"/>
  	<property name="build.docs" value="${build.dir}/docs"/>
  	<property name="build.javadocs" value="${build.docs}/api"/>
  	<property name="build.testdocs" value="${build.docs}/test"/>
  	<property name="build.reports" value="${build.docs}/reports"/>
  
  	<!-- Set dist directories -->
  	<property name="dist.dir" value="dist"/>
  	<property name="dist.src" value="${dist}"/>
  	<property name="dist.bin" value="${dist}"/>
  
  	<!-- Set external directories -->
  	<property name="framework.dir" value="../jakarta-avalon"/>
  	<property name="excalibur.dir" value="../jakarta-avalon-excalibur"/>
  	<property name="cornerstone.dir" value="../jakarta-avalon-cornerstone"/>
  	<property name="logkit.dir" value="../jakarta-avalon-logkit"/>
  	<property name="phoenix.dir" value="../jakarta-avalon-phoenix"/>
  	<property name="phoenix.dist" value="../jakarta-avalon-phoenix/dist"/>
  	<property name="phoenix.apps" value="${phoenix.dist}/apps"/>
  	<property name="www.dir" value="../jakarta-avalon-site/docs"/>
  	<property name="apps.dir" value="../jakarta-avalon-apps"/>
  
  	<!-- Set install directories -->
  	<property name="install.dir" value="${phoenix.apps}"/>
  	<property name="install.www" value="${www.dir}/${name}"/>
  
  	<!-- Set other directories -->
  	<property name="work.dir" value="${build.dir}/work"/>
  	<property name="lib.dir" value="${framework.dir}/lib"/>
  	<property name="tools.dir" value="${framework.dir}/tools"/>
  	<property name="tools.lib" value="${tools.dir}/lib"/>
  	<property name="tools.ext" value="${tools.dir}/ext"/>
  
  	<!-- Set build properties -->
  	<property name="build.debug" value="on"/>
  	<property name="build.optimize" value="off"/>
  	<property name="build.deprecation" value="off"/>
  	<property name="build.compress.jars" value="true"/>
  	<property name="build.jdk.target" value="1.2"/>
  	<property name="build.javadocs.packages" value="com.multimia.*"/>
  	<property name="build.jar" value="${build.lib}/${dist.name}.jar"/>
  
  	<!-- Set dist properties -->
  	<property name="dist.name" value="${name}-${version}"/>
  	<property name="dist.jar" value="${dist.name}.jar"/>
  	<property name="dist.src.tar" value="${name}-${version}-src.tar"/>
  	<property name="dist.src.tar.gz" value="${name}-${version}-src.tar.gz"/>
  	<property name="dist.bin.tar" value="${name}-${version}-bin.tar"/>
  	<property name="dist.bin.tar.gz" value="${name}-${version}-bin.tar.gz"/>
  	<property name="dist.src.zip" value="${name}-${version}-src.zip"/>
  	<property name="dist.bin.zip" value="${name}-${version}-bin.zip"/>
  
  	<!-- Set library locations -->
  	<property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
  	<property name="junit.jar" value="${tools.dir}/lib/junit-3.7.jar"/>
  	<property name="xerces.jar" value="${tools.dir}/lib/xerces.jar"/>
  	<property name="servlet.jar" value="${tools.lib}/servlet.jar"/>
  
  	<!-- Set miscellaneous properties -->
  
  	<!-- Set classpaths -->
  	<path id="tools.class.path">
  		<fileset dir="${lib.dir}">
  			<include name="*.jar" />
  		</fileset>
  		<fileset dir="${tools.lib}">
  			<include name="*.jar" />
  		</fileset>
  		<fileset dir="${tools.ext}">
  			<include name="*.jar" />
  		</fileset>
  		<pathelement location="${tools.jar}"/>
  	</path>
  	<path id="library.class.path">
  		<pathelement location="${xerces.jar}"/>
  		<pathelement location="${junit.jar}"/>
  		<pathelement location="${servlet.jar}"/>
  		<path refid="tools.class.path"/>
  	</path>
  	<path id="project.class.path">
  		<fileset dir="${lib.dir}">
  			<include name="*.jar" />
  		</fileset>
  		<pathelement path="${build.classes}" />
  		<path refid="tools.class.path"/>
  		<pathelement path="${java.class.path}" />
  	</path>
  	<path id="test.class.path">
  		<path refid="tools.class.path"/>
  		<path refid="project.class.path"/>
  	</path>
  
  	<!-- =====================================================================================
  	  main targets
  	====================================================================================== -->
  
  	<target name="main"		depends="build"
  			description="Creates everything but the documentation">
  	</target>
  	<target name="all"		depends="build, docs, dist"
  			description="Creates everything"/>
  	<target name="build"		depends="compile-java, build-jars" description="Create all the binaries">
  		<echo message="Created all the binaries."/>
  	</target>
  	<target name="docs"		depends="html-docs, javadocs"
  			description="Creates the documentation">
  		<echo message="Created the documentation."/>
  	</target>
  	<target name="test"		depends="unittests" description="Test all the binaries">
  		<echo message="Tested all the binaries."/>
  	</target>
  	<target name="jars"		depends="build-jars"
  			description="Create all the jar archives">
  		<echo message="Created all the jar archives."/>
  	<target name="dist"		depends="dist-src, dist-bin"
  			description="Create all the distributions">
  		<echo message="Created the distributions."/>
  	</target>
  	<target name="clean"		depends="clean-build, clean-docs, clean-dist"
  			description="Cleans up all the binaries and distributions">
  		<echo message="Cleaned up all the binaries and distributions."/>
  	</target>
  	<target name="install"		depends="install-jar" description="Install the application"/>
  
  	<target name="re-build"	depends="clean,compile" description="Re-create all the binaries"/>
  	<target name="re-dist"	depends="clean,dist"
  			description="Re-create the webapp distributon"/>
  	<target name="re-install"	depends="clean, install-war"
  			description="Re-install the webapp"/>
  	<target name="uninstall"	depends="uninstall-war" description="Uninstall the webapp"/>
  
  
  	<!-- =====================================================================================
  	  preparation targets
  	====================================================================================== -->
  
  	<!-- Prepare for build -->
  	<target name="prepare-build">
  		<mkdir dir="${build.dir}"/>
  	</target>
  
  	<!-- Prepare for testing -->
  	<target name="prepare-test" depends="build">
  		<mkdir dir="${build.testdocs}"/>
  		<mkdir dir="${build.reports}"/>
  	</target>
  
  	<!-- Prepare for docs -->
  	<target name="prepare-docs">
  		<mkdir dir="${build.docs}"/>
  		<delete dir="${build.javadocs}"/>
  		<mkdir dir="${build.javadocs}"/>
  	</target>
  
  	<!-- Prepare for dist -->
  	<target name="prepare-dist" depends="build, docs">
  		<mkdir dir="${dist.dir}"/>
  		<mkdir dir="${dist.src}"/>
  		<mkdir dir="${dist.bin}"/>
  	</target>
  
  	<!-- =====================================================================================
  	  build targets
  	====================================================================================== -->
  
  	<!-- Compile source code -->
  	<target name="compile" depends="prepare-build">
  
  		<mkdir dir="${build.classes}"/>
  
  		<javac srcdir="${src.java}"
  				destdir="${build.classes}"
  				debug="${build.debug}"
  				optimize="${build.optimize}"
  				deprecation="${build.deprecation}"
  				target="${build.jdk.target}">
  			<classpath refid="project.class.path" />
  			<src path="${src.test}"/>
  		</javac>
  
  	</target>
  
  	<!-- create .jar files -->
  	<target name="build-jars" depends="prepare-build">
  		<jar jarfile="${build.jar}"
  				basedir="${build.classes}"
  				compress="${build.compress.jars}"
  				manifest="${manifest.dir}/${name}.mf">
  		</jar>
  	</target>
  
  
  	<!-- =====================================================================================
  	  testing targets
  	====================================================================================== -->
  
  	<!-- Run unit tests -->
  	<target name="unittests" depends="prepare-test">
  
  		<junit fork="true" printsummary="yes" dir="${build.testdocs}">
  			<formatter type="plain" usefile="false"/>
  			<classpath>
  				<path refid="test.class.path"/>
  				<pathelement location="${build.classes}"/>
  			</classpath>
  			<batchtest todir="${build.reports}">
  				<fileset dir="${build.classes}">
  				<exclude name="**/test/Abstract*TestCase.class"/>
  				<include name="**/test/**/*TestCase.class"/>
  				</fileset>
  			</batchtest>
  		</junit>
  
  	</target>
  
  	<!-- =====================================================================================
  	  documentation targets
  	====================================================================================== -->
  
  	<!-- Compile javadocs -->
  	<target name="javadocs" depends="prepare-docs, compile">
  		<javadoc packagenames="${build.javadocs.packages}"
  				sourcepath="${src.java}"
  				destdir="${build.javadocs}">
  			<classpath refid="project.class.path" />
  			<doclet name="com.sun.tools.doclets.standard.Standard">
  				<param name="-author"/>
  				<param name="-version"/>
  				<param name="-doctitle" value="${Name}"/>
  				<param name="-windowtitle" value="${Name} API"/>
  				<param name="-bottom"
  						value="${copyright}"/>
  			</doclet>
  		</javadoc>
  	</target>
  
  	<!-- Compile html docs -->
  	<target name="compile-html-docs" depends="prepare-docs">
  		<!-- call anakia, cocoon, forrest, ... -->
  	</target>
  
  	<!-- Create html docs -->
  	<target name="html-docs" depends="prepare-docs, compile-html-docs">
  		<copy todir="${build.docs}">
  			<fileset dir="${src.xdocs}">
  				<exclude name="**/*.xml"/>
  				<exclude name="**/*.dtd"/>
  				<exclude name="javadocs/**"/>
  			</fileset>
  		</copy>
  	</target>
  
  	<!-- =====================================================================================
  	  distribution targets
  	====================================================================================== -->
  
  	<!-- create source distribution -->
  	<target name="dist-src" depends="prepare-dist, javadocs"
  		description="Create source distribution">
  		<tar tarfile="${build.work}/${dist.src.tar}" basedir="." longfile="gnu">
  			<exclude name="build/**"/>
  			<exclude name="webapp/**"/>
  			<exclude name="tools/setup-files/**"/>
  			<exclude name="tools/apps/**"/>
  			<exclude name="conf/**"/>
  			<exclude name="defaultroot/**"/>
  			<exclude name="bak/**"/>
  			<exclude name="**/CVS"/>
  		</tar>
  		<gzip zipfile="${dist.src}/${dist.src.tar.gz}" src="${build.work}/${dist.src.tar}"/>
  		<delete file="${build.work}/${dist.src.tar}"/>
  	</target>
  
  	<!-- create binary distribution -->
  	<target name="dist-bin" depends="prepare-dist, dist-src, dist-war"
  			description="Create binary distribution">
  		<tar tarfile="${build.work}/${dist.bin.tar}" basedir="." longfile="gnu">
  			<exclude name="tools/apps/**"/>
  			<exclude name="conf/**"/>
  			<exclude name="defaultroot/**"/>
  			<exclude name="bak/**"/>
  			<exclude name="**/CVS"/>
  		</tar>
  		<gzip zipfile="${dist.src}/${dist.bin.tar.gz}" src="${build.work}/${dist.bin.tar}"/>
  		<delete file="${build.work}/${dist.bin.tar}"/>
  	</target>
  	<!-- =====================================================================================
  	  cleanup targets
  	====================================================================================== -->
  
  	<!-- remove all files created by build -->
  	<target name="clean-build">
  		<delete dir="${build.dir}"/>
  	</target>
  	<!-- remove all files created by docs -->
  	<target name="clean-docs">
  		<delete dir="${docs.dir}"/>
  	</target>
  	<!-- remove all files created by dist -->
  	<target name="clean-dist">
  		<delete dir="${dist.dir}"/>
  	</target>
  
  	<!-- =====================================================================================
  	  instalation targets
  	====================================================================================== -->
  
  	<!-- install the .jar distribution into the container -->
  	<target name="install-jar" depends="dist-jar">
  		<copy file="${dist.jar}" todir="${install.dir}"/>
  	</target>
  
  	<!-- uninstall the .jar distribution from the container -->
  	<target name="uninstall-jar">
  		<delete file="${install.dir}/${dist.jar}"/>
  	</target>
  
  	<!-- =====================================================================================
  	  compatibility targets
  	====================================================================================== -->
  
  	<!-- direct to -projecthelp option -->
  	<target name="usage">
  		<echo message="Use the -projecthelp option instead"/>
  	</target>
  
  	<!-- direct to test target -->
  	<target name="check">
  		<echo message="This is a deprecated target. Calling the test target."/>
  		<antcall target="test" inheritAll="true" inheritRefs="true" />
  	</target>
  
  	<!-- direct to clean target -->
  	<target name="distclean">
  		<echo message="This is a deprecated target. Calling the clean target."/>
  		<antcall target="clean" inheritAll="true" inheritRefs="true" />
  	</target>
  
  	<!-- direct to html-docs target -->
  	<target name="printerdocs">
  		<echo message="This is a deprecated target. Calling the docs target."/>
  		<antcall target="docs" inheritAll="true" inheritRefs="true" />
  	</target>
  </project>
  
  
  

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