All pastes #368172 Raw Edit

Unnamed

public text v1 · immutable
#368172 ·published 2007-02-22 21:55 UTC
rendered paste body
<?xml version="1.0" ?>
<project name="cms_framework" default="all">

	<!-- initialisation of variables etc -->
	<target name="init">
		<tstamp />
		<property name="name.project" value="${ant.project.name}" />
		<property name="dir.source" location="src" />
		<property name="dir.build" value="build" />
		<property name="dir.classes" location="${dir.build}/classes" />
		<property name="dir.doc" location="${dir.build}/doc" />

		<property name="dir.jboss" value="/home/jrfry/lib/jboss-4.0.5.GA" />
		<property name="dir.jboss.embedded" value="/home/jrfry/lib/jboss-EJB-3.0_Embeddable_ALPHA_9" />
	
		<property name="dir.install" value="../lib" />
				
		<property name="name.ejb3file" value="${dir.build}/${name.project}-framework.ejb3" />
		<property name="name.jarfile" value="${dir.build}/${name.project}-library.jar" />
		<property name="name.tarball" value="${dir.build}/${name.project}-library.tar.gz" />
		
		<mkdir dir="${dir.build}" />
		<mkdir dir="${dir.classes}" />
		<mkdir dir="${dir.doc}" />

	
		<!-- set the build class path -->
		<path id="path.classpath.compile">
			<!-- EJB3 server client jars -->
			<fileset dir="${dir.jboss}/client">
				<include name="*.jar"/>
			</fileset>
			
			<!-- EJB3 deployer jars -->
			<fileset dir="${dir.jboss}/server/default/deploy/ejb3.deployer">
				<include name="*.jar" />
			</fileset>
		</path>
		
		
		<!-- set the test class path -->
		<path id="path.classpath.test">
			<!-- EJB3 embedded container for testing -->
			<fileset dir="${dir.jboss}/server/default/deploy/ejb3.deployer">
				<include name="*.jar" />
			</fileset>

			<!-- EJB3 embedded container configuration -->
			<dirset dir="${dir.jboss.embedded}/conf" />

			<!-- junit 4.1 -->
			<pathelement location="/home/jrfry/lib/junit4.1/junit-4.1.jar"/>
		</path>			
	</target>

	
	<!-- clean the build directory -->
	<target name="clean">
		<delete dir="${dir.build}" />
	</target>
	
	
	<!-- compile everything -->
	<target name="compile" depends="init">
		<javac destdir="${dir.classes}" classpathref="path.classpath.compile" srcdir="${dir.source}" debug="on">
			<include name="**/*.java"/>
			<exclude name="**/*Test.java"/>
			<exclude name="**/test/*.java"/>
		</javac>
		<javac destdir="${dir.classes}" classpathref="path.classpath.test" srcdir="${dir.source}" debug="on">
			<include name="**/*Test.java"/>
			<include name="**/test/*.java"/>
		</javac>
	</target>
	
	
	<!-- javadoc -->
	<target name="javadoc" depends="init">
		<javadoc sourcepath="${dir.source}" destdir="${dir.doc}" packagenames="*" classpathref="path.classpath.compile" />
	</target>
	
	
	<!-- distribution tarball -->
	<target name="dist" depends="init">
		<tar tarfile="${name.tarball}" basedir=".." includes="${name.project}/**" excludes="${name.project}/${dir.build}/**" compression="gzip" />
	</target>
	
	
	<!-- build the library jar -->
	<target name="jar" depends="compile">
		<jar jarfile="${name.jarfile}" basedir="${dir.classes}">
			<exclude name="**/persistence/**" />
		</jar>
	</target>

	<!-- build the persistence ejb3 -->
	<target name="ejb3jar" depends="compile">
		<jar jarfile="${name.ejb3file}" basedir="${dir.classes}">
			<include name="**/persistence/**" />
			<include name="**/framework/**" />
		</jar>
	</target>

	
	<!-- install the jars into distribution directory -->
	<target name="install" depends="compile, jar">
		<copy todir="${dir.install}" file="${name.jarfile}" />
		<copy tofile="${dir.install}/${name.project}.jar" file="${name.jarfile}" />
	</target>
		
	
	
	<!-- unit tests -->
	<target name="test" depends="init">
		<java fork="true" classname="junit.textui.TestRunner">
			<arg value="cms.framework.UserManagerTest"/>
			<classpath>
				<path refid="path.classpath.test" />
				<pathelement location="${dir.build}/${name.jarfile}" />
				<pathelement location="${dir.build}/${name.ejb3file}" />
			</classpath>
		</java>
	</target>
	
	
	<!-- do everything (default) -->
	<target name="all" depends="clean, init, compile, jar, ejb3jar, dist" />
	
</project>