<commit_before><?xml version="1.0"?>

<!--
	$Id$
	$URL$

	Top-level build file for SubEtha  Imports build files for the
	various modules, so this is the only entry point.
	
	To run the junit tests, you must copy junit.jar into ANT_HOME/lib.
-->

<project name="subetha" default="compile" basedir=".">

	<property name="name" value="${ant.project.name}" />
	
	<property file="user.properties" />
	<property file="${user.home}/build.properties" />
	<property file="build.properties" />
	<property file="jar.properties" />

	<property name="base.dir" location="." />

	<property name="build.dir" location="target" />
	
	<property name="build.debug" value="on" />
	<property name="build.deprecation" value="on" />

	<property name="ant.build.javac.target" value="1.5" />
	<property name="ant.build.javac.source" value="1.5" />

	<property name="deploy.dir" location="${jboss.dir}/server/default/deploy" />

	<!-- ******************************************************** -->
	<path id="jboss.classpath">
		<fileset dir="${jboss.dir}">
			<include name="server/default/deploy/**/*.jar"/>
			<include name="server/default/lib/**/*.jar"/>
			<include name="lib/**/*.jar"/>
		</fileset>
	</path>

	<path id="propertize.classpath">
		<fileset dir="${base.dir}/lib">
			<include name="${asm.jar}"/>
			<include name="${jen.jar}"/>
			<include name="${tagonist.jar}"/>
		</fileset>
	</path>

	<path id="common.classpath">
		<path refid="jboss.classpath" />
	</path>

	<path id="entity.classpath">
		<pathelement location="${build.dir}/common/common.jar" />
		<path refid="jboss.classpath" />
	</path>

	<path id="core.classpath">
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${velocity.jar}"/>
			<include name="${smtp.jar}"/>
			<include name="${mina-core.jar}"/>
			<include name="${lucene-core.jar}"/>
		</fileset>

		<path refid="jboss.classpath" />
	</path>

	<path id="plugin.classpath">
		<pathelement location="${build.dir}/core/subetha-api.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<path refid="jboss.classpath" />
	</path>

	<path id="frontend.classpath">
		<pathelement location="${build.dir}/core/subetha-api.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${commons-fileupload.jar}"/>
			<include name="${tagonist.jar}"/>
		</fileset>
		<path refid="jboss.classpath" />
	</path>

	<path id="rtest.classpath">
		<pathelement location="${build.dir}/core/core.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${junit.jar}"/>
			<include name="${smtp.jar}"/>
			<include name="${wiser.jar}"/>
		</fileset>
		<path refid="jboss.classpath" />
	</path>

	<path id="rtest.run.classpath">
		<path refid="rtest.classpath" />

		<pathelement location="${build.dir}/rtest/rtest.jar" />
	</path>

	<!-- ******************************************************** -->

	<target name="common" depends="init">
		<mkdir dir="${build.dir}/common/classes" />
		<javac
			srcdir="${base.dir}/common/src/"
			destdir="${build.dir}/common/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">

			<classpath refid="common.classpath" />
		</javac>
		<jar jarfile="${build.dir}/common/common.jar">
			<fileset dir="${build.dir}/common/classes"/>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="entity" depends="init, common">
		<mkdir dir="${build.dir}/entity/classes"/>
		
		<javac 
			srcdir="${base.dir}/entity/src"
			destdir="${build.dir}/entity/classes" 
			includeAntRuntime="false"
			debug="${build.debug}" 
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="entity.classpath"/>			
		</javac>

		<jar jarfile="${build.dir}/entity/entity.jar">
			<metainf dir="${base.dir}/entity/meta/">
				<include name="persistence.xml"/>
			</metainf>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
			<fileset dir="${build.dir}/entity/classes"/>
		</jar>
	</target>

 	<target name="core" depends="init, entity">
		<mkdir dir="${build.dir}/core/classes" />
 		
		<javac
			srcdir="${base.dir}/core/src"
			destdir="${build.dir}/core/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="core.classpath" />			
		</javac>

		<jar jarfile="${build.dir}/core/subetha-api.jar">
			<!--
				Yes this means there is a duplicate of the entity interface classes
				in the entity jar.  Fortunately JBoss handles duplicates in the
				same JVM nicely, as long as the files are identical (which they
				should be).  The main point is that now remote clients have access
				to the validation constants.
			-->
			<fileset dir="${build.dir}/core/classes">
				<include name="**/i/**" />
			</fileset>
		
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<jar jarfile="${build.dir}/core/core.jar">			
			<metainf dir="${base.dir}/core/meta">
				<include name="mailcap"/>
				<include name="mime.types"/>
			</metainf>

			<fileset dir="${build.dir}/core/classes" />

			<fileset dir="${base.dir}/core/src">
				<include name="**/*.vm" />
			</fileset>

			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<jar destfile="${build.dir}/core/core.sar">
			<metainf dir="${base.dir}/core/meta">
				<include name="jboss-service.xml"/>
			</metainf>
			
			<fileset dir="${base.dir}/lib/">
				<include name="${velocity.jar}"/>
				<include name="${smtp.jar}"/>
				<include name="${lucene-core.jar}"/>
				<include name="${commons-beanutils.jar}"/>

				<!-- MINA and it's deps -->
				<include name="${mina-core.jar}"/>
				<include name="${slf4j-simple.jar}"/>
				<include name="${backport-util-concurrent.jar}"/>
				<include name="${commons-codec.jar}"/>
			</fileset>
			
			<fileset file="${build.dir}/common/subetha-api.jar"/>
			<fileset file="${build.dir}/common/common.jar"/>

			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="plugin" depends="common, core, entity">
		<mkdir dir="${build.dir}/plugin/classes" />
 		
		<javac
			srcdir="${base.dir}/plugin/src"
			destdir="${build.dir}/plugin/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="plugin.classpath" />
		</javac>

		<jar jarfile="${build.dir}/plugin/plugin.jar">
			<!--
			<metainf dir="${plugin.meta.dir}">
				<include name="jboss-service.xml"/>
			</metainf>
			-->
			
			<fileset dir="${build.dir}/plugin/classes"/>
			
			<!--
			<fileset dir="${plugin.lib.dir}"/>
			-->
			
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

	</target>

	<target name="frontend" depends="core">
		<mkdir dir="${build.dir}/frontend/classes"/>

		<javac 
			srcdir="${base.dir}/frontend/src/org"
			destdir="${build.dir}/frontend/classes" 
			includeAntRuntime="false"
			debug="${build.debug}" 
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="frontend.classpath"/>
		</javac>

		<taskdef name="propertize" classname="org.tagonist.propertize.PropertizeTask">
			<classpath>
				<path refid="propertize.classpath" />
			</classpath>
		</taskdef>		

		<propertize verbose="false">
			<fileset dir="${build.dir}/frontend/classes"/>
		</propertize>

		<jar jarfile="${build.dir}/frontend/frontend.jar">
			<fileset dir="${build.dir}/frontend/classes" />
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<war destfile="${build.dir}/frontend/frontend.war" 
			webxml="${base.dir}/frontend/meta/web.xml">

			<fileset dir="${base.dir}/frontend/content" />

			<lib file="${build.dir}/frontend/frontend.jar"/>

			<lib dir="${base.dir}/lib">
				<include name="${jstl.jar}"/>
				<include name="${standard.jar}"/>
				<include name="${tagonist.jar}"/>
				<include name="${commons-fileupload.jar}"/>
			</lib>
		</war>
	</target>

 	<target name="rtest-compile" depends="compile">
		<mkdir dir="${build.dir}/rtest/classes" />
 		
		<javac
			srcdir="${base.dir}/rtest/src"
			destdir="${build.dir}/rtest/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">

			<classpath refid="rtest.classpath" />
		</javac>
		<jar jarfile="${build.dir}/rtest/rtest.jar">
			<fileset dir="${build.dir}/rtest/classes"/>
			<fileset dir="${base.dir}/rtest/src/org/subethamail/rtest/msg">
				<include name="**/*.msg"/>
			</fileset>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="compile" depends="common, core, entity, plugin, frontend">
	</target>

	<target name="ear" depends="compile">
		<mkdir dir="${build.dir}/ear"/>
		<ear destfile="${build.dir}/ear/subetha.ear" appxml="${base.dir}/frontend/meta/application.xml">
			<metainf dir="${base.dir}/frontend/meta/">
				<include name="jboss-app.xml" />
			</metainf>

			<fileset file="${build.dir}/entity/entity.jar" />
			<fileset file="${build.dir}/core/core.jar" />
			<fileset file="${build.dir}/core/core.sar" />
			<fileset file="${build.dir}/plugin/plugin.jar" />
			<fileset file="${build.dir}/frontend/frontend.war" />
		</ear>
	</target>

	<target name="deploy" depends="ear">
		<copy file="${build.dir}/ear/subetha.ear" todir="${deploy.dir}" />
	</target>

	<target name="init">
		<tstamp/>
		<tstamp>
			<format property="YEAR" pattern="yyyy" />
		</tstamp>
		<typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
			<classpath>
				<fileset dir="${base.dir}/lib">
					<include name="svn*.jar"/>
					<include name="javasvn*.jar"/>
				</fileset>
			</classpath>
		</typedef>
		<svn><status path="." revisionProperty="version" /></svn>
	</target>

	<target name="clean">
		<delete dir="${build.dir}" />
	</target>

	<target name="cleandeploy" depends="clean, deploy">
	</target>

	<target name="junit" depends="rtest-compile">
		<junit printsummary="yes" showoutput="yes" fork="yes">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			
			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="**/*Test.class" />
				</fileset>
			</batchtest>
		</junit>
	</target>

	<target name="junit-special" depends="rtest-compile">
		<junit printsummary="true" showoutput="true" fork="true">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			
			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="${junit.special.tests}" />
				</fileset>
			</batchtest>
		</junit>
	</target>
	
	<target name="junit-debug" depends="rtest-compile">
		<junit printsummary="yes" showoutput="yes" fork="yes">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8001"/>
			<!-- <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001"/> -->

			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="${junit.special.tests}" />
				</fileset>
			</batchtest>
		</junit>
	</target>

	<target name="dist" depends="cleandeploy">
		<input addproperty="version-dist" message="Version number?" />
		<property name="dist.name" value="SubEtha-${version-dist}" />
	
		<copy todir="${build.dir}/${dist.name}/jboss">
			<fileset dir="${jboss.dir}">
				<exclude name="**/velocity.log" />
				<exclude name="**/log/**" />
				<exclude name="**/tmp/**" />
				<exclude name="**/work/**" />
				<exclude name="**/data/**" />
			</fileset>
		</copy>
		<copy todir="${build.dir}/${dist.name}/">
			<fileset dir=".">
				<include name="README.html" />
				<include name="LICENSE.txt" />
				<include name="www/**" /><commit_msg>dist now asks for a version number and non-dist just uses svn's changeset number.<commit_after><?xml version="1.0"?>

<!--
	$Id$
	$URL$

	Top-level build file for SubEtha  Imports build files for the
	various modules, so this is the only entry point.
	
	To run the junit tests, you must copy junit.jar into ANT_HOME/lib.
-->

<project name="subetha" default="compile" basedir=".">

	<property name="name" value="${ant.project.name}" />
	
	<property file="user.properties" />
	<property file="${user.home}/build.properties" />
	<property file="build.properties" />
	<property file="jar.properties" />

	<property name="base.dir" location="." />

	<property name="build.dir" location="target" />
	
	<property name="build.debug" value="on" />
	<property name="build.deprecation" value="on" />

	<property name="ant.build.javac.target" value="1.5" />
	<property name="ant.build.javac.source" value="1.5" />

	<property name="deploy.dir" location="${jboss.dir}/server/default/deploy" />

	<tstamp/>
	<tstamp>
		<format property="YEAR" pattern="yyyy" />
	</tstamp>

	<!-- ******************************************************** -->
	<path id="jboss.classpath">
		<fileset dir="${jboss.dir}">
			<include name="server/default/deploy/**/*.jar"/>
			<include name="server/default/lib/**/*.jar"/>
			<include name="lib/**/*.jar"/>
		</fileset>
	</path>

	<path id="propertize.classpath">
		<fileset dir="${base.dir}/lib">
			<include name="${asm.jar}"/>
			<include name="${jen.jar}"/>
			<include name="${tagonist.jar}"/>
		</fileset>
	</path>

	<path id="common.classpath">
		<path refid="jboss.classpath" />
	</path>

	<path id="entity.classpath">
		<pathelement location="${build.dir}/common/common.jar" />
		<path refid="jboss.classpath" />
	</path>

	<path id="core.classpath">
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${velocity.jar}"/>
			<include name="${smtp.jar}"/>
			<include name="${mina-core.jar}"/>
			<include name="${lucene-core.jar}"/>
		</fileset>

		<path refid="jboss.classpath" />
	</path>

	<path id="plugin.classpath">
		<pathelement location="${build.dir}/core/subetha-api.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<path refid="jboss.classpath" />
	</path>

	<path id="frontend.classpath">
		<pathelement location="${build.dir}/core/subetha-api.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${commons-fileupload.jar}"/>
			<include name="${tagonist.jar}"/>
		</fileset>
		<path refid="jboss.classpath" />
	</path>

	<path id="rtest.classpath">
		<pathelement location="${build.dir}/core/core.jar" />
		<pathelement location="${build.dir}/entity/entity.jar" />
		<pathelement location="${build.dir}/common/common.jar" />
		<fileset dir="${base.dir}/lib">
			<include name="${junit.jar}"/>
			<include name="${smtp.jar}"/>
			<include name="${wiser.jar}"/>
		</fileset>
		<path refid="jboss.classpath" />
	</path>

	<path id="rtest.run.classpath">
		<path refid="rtest.classpath" />

		<pathelement location="${build.dir}/rtest/rtest.jar" />
	</path>

	<!-- ******************************************************** -->

	<target name="common" depends="init">
		<mkdir dir="${build.dir}/common/classes" />
		<javac
			srcdir="${base.dir}/common/src/"
			destdir="${build.dir}/common/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">

			<classpath refid="common.classpath" />
		</javac>
		<jar jarfile="${build.dir}/common/common.jar">
			<fileset dir="${build.dir}/common/classes"/>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="entity" depends="init, common">
		<mkdir dir="${build.dir}/entity/classes"/>
		
		<javac 
			srcdir="${base.dir}/entity/src"
			destdir="${build.dir}/entity/classes" 
			includeAntRuntime="false"
			debug="${build.debug}" 
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="entity.classpath"/>			
		</javac>

		<jar jarfile="${build.dir}/entity/entity.jar">
			<metainf dir="${base.dir}/entity/meta/">
				<include name="persistence.xml"/>
			</metainf>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
			<fileset dir="${build.dir}/entity/classes"/>
		</jar>
	</target>

 	<target name="core" depends="init, entity">
		<mkdir dir="${build.dir}/core/classes" />
 		
		<javac
			srcdir="${base.dir}/core/src"
			destdir="${build.dir}/core/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="core.classpath" />			
		</javac>

		<jar jarfile="${build.dir}/core/subetha-api.jar">
			<!--
				Yes this means there is a duplicate of the entity interface classes
				in the entity jar.  Fortunately JBoss handles duplicates in the
				same JVM nicely, as long as the files are identical (which they
				should be).  The main point is that now remote clients have access
				to the validation constants.
			-->
			<fileset dir="${build.dir}/core/classes">
				<include name="**/i/**" />
			</fileset>
		
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<jar jarfile="${build.dir}/core/core.jar">			
			<metainf dir="${base.dir}/core/meta">
				<include name="mailcap"/>
				<include name="mime.types"/>
			</metainf>

			<fileset dir="${build.dir}/core/classes" />

			<fileset dir="${base.dir}/core/src">
				<include name="**/*.vm" />
			</fileset>

			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<jar destfile="${build.dir}/core/core.sar">
			<metainf dir="${base.dir}/core/meta">
				<include name="jboss-service.xml"/>
			</metainf>
			
			<fileset dir="${base.dir}/lib/">
				<include name="${velocity.jar}"/>
				<include name="${smtp.jar}"/>
				<include name="${lucene-core.jar}"/>
				<include name="${commons-beanutils.jar}"/>

				<!-- MINA and it's deps -->
				<include name="${mina-core.jar}"/>
				<include name="${slf4j-simple.jar}"/>
				<include name="${backport-util-concurrent.jar}"/>
				<include name="${commons-codec.jar}"/>
			</fileset>
			
			<fileset file="${build.dir}/common/subetha-api.jar"/>
			<fileset file="${build.dir}/common/common.jar"/>

			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="plugin" depends="common, core, entity">
		<mkdir dir="${build.dir}/plugin/classes" />
 		
		<javac
			srcdir="${base.dir}/plugin/src"
			destdir="${build.dir}/plugin/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="plugin.classpath" />
		</javac>

		<jar jarfile="${build.dir}/plugin/plugin.jar">
			<!--
			<metainf dir="${plugin.meta.dir}">
				<include name="jboss-service.xml"/>
			</metainf>
			-->
			
			<fileset dir="${build.dir}/plugin/classes"/>
			
			<!--
			<fileset dir="${plugin.lib.dir}"/>
			-->
			
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

	</target>

	<target name="frontend" depends="core">
		<mkdir dir="${build.dir}/frontend/classes"/>

		<javac 
			srcdir="${base.dir}/frontend/src/org"
			destdir="${build.dir}/frontend/classes" 
			includeAntRuntime="false"
			debug="${build.debug}" 
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">
			
			<classpath refid="frontend.classpath"/>
		</javac>

		<taskdef name="propertize" classname="org.tagonist.propertize.PropertizeTask">
			<classpath>
				<path refid="propertize.classpath" />
			</classpath>
		</taskdef>		

		<propertize verbose="false">
			<fileset dir="${build.dir}/frontend/classes"/>
		</propertize>

		<jar jarfile="${build.dir}/frontend/frontend.jar">
			<fileset dir="${build.dir}/frontend/classes" />
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>

		<war destfile="${build.dir}/frontend/frontend.war" 
			webxml="${base.dir}/frontend/meta/web.xml">

			<fileset dir="${base.dir}/frontend/content" />

			<lib file="${build.dir}/frontend/frontend.jar"/>

			<lib dir="${base.dir}/lib">
				<include name="${jstl.jar}"/>
				<include name="${standard.jar}"/>
				<include name="${tagonist.jar}"/>
				<include name="${commons-fileupload.jar}"/>
			</lib>
		</war>
	</target>

 	<target name="rtest-compile" depends="compile">
		<mkdir dir="${build.dir}/rtest/classes" />
 		
		<javac
			srcdir="${base.dir}/rtest/src"
			destdir="${build.dir}/rtest/classes"
			includeAntRuntime="false"
			debug="${build.debug}"
			deprecation="${build.deprecation}"
			target="${ant.build.javac.target}"
			source="${ant.build.javac.source}">

			<classpath refid="rtest.classpath" />
		</javac>
		<jar jarfile="${build.dir}/rtest/rtest.jar">
			<fileset dir="${build.dir}/rtest/classes"/>
			<fileset dir="${base.dir}/rtest/src/org/subethamail/rtest/msg">
				<include name="**/*.msg"/>
			</fileset>
			<manifest>
				<attribute name="Specification-Version" value="${version}" />
				<attribute name="Implementation-Version" value="${TODAY}" />
			</manifest>
		</jar>
	</target>

	<target name="compile" depends="common, core, entity, plugin, frontend">
	</target>

	<target name="ear" depends="compile">
		<mkdir dir="${build.dir}/ear"/>
		<ear destfile="${build.dir}/ear/subetha.ear" appxml="${base.dir}/frontend/meta/application.xml">
			<metainf dir="${base.dir}/frontend/meta/">
				<include name="jboss-app.xml" />
			</metainf>

			<fileset file="${build.dir}/entity/entity.jar" />
			<fileset file="${build.dir}/core/core.jar" />
			<fileset file="${build.dir}/core/core.sar" />
			<fileset file="${build.dir}/plugin/plugin.jar" />
			<fileset file="${build.dir}/frontend/frontend.war" />
		</ear>
	</target>

	<target name="deploy" depends="ear">
		<copy file="${build.dir}/ear/subetha.ear" todir="${deploy.dir}" />
	</target>

	<target name="init">
		<typedef resource="org/tigris/subversion/svnant/svnantlib.xml">
			<classpath>
				<fileset dir="${base.dir}/lib">
					<include name="svn*.jar"/>
					<include name="javasvn*.jar"/>
				</fileset>
			</classpath>
		</typedef>
		<svn><status path="." revisionProperty="revisionVersion" /></svn>
		<!--  A hack because svnant does not respect Ant's properties can't be overwritten rule. -->
		<property name="version" value="${revisionVersion}" />
	</target>

	<target name="init-dist">
		<input addproperty="version" message="Version number?" />
		<property name="dist.name" value="SubEtha-${version}" />
	</target>

	<target name="clean">
		<delete dir="${build.dir}" />
	</target>

	<target name="cleandeploy" depends="clean, deploy">
	</target>

	<target name="junit" depends="rtest-compile">
		<junit printsummary="yes" showoutput="yes" fork="yes">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			
			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="**/*Test.class" />
				</fileset>
			</batchtest>
		</junit>
	</target>

	<target name="junit-special" depends="rtest-compile">
		<junit printsummary="true" showoutput="true" fork="true">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			
			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="${junit.special.tests}" />
				</fileset>
			</batchtest>
		</junit>
	</target>
	
	<target name="junit-debug" depends="rtest-compile">
		<junit printsummary="yes" showoutput="yes" fork="yes">
			<jvmarg value="-Dlog4j.configuration=file:${base.dir}/rtest/log4j.properties"/>
			<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8001"/>
			<!-- <jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001"/> -->

			<classpath refid="rtest.run.classpath"/>
			
			<syspropertyset>
				<propertyref prefix="java.naming" />
			</syspropertyset>
			
			<formatter type="plain" />
			
			<batchtest todir="${build.dir}">
				<fileset dir="${build.dir}/rtest/classes">
					<include name="${junit.special.tests}" />
				</fileset>
			</batchtest>
		</junit>
	</target>

	<target name="dist" depends="init-dist, cleandeploy">
		<copy todir="${build.dir}/${dist.name}/jboss">
			<fileset dir="${jboss.dir}">
				<exclude name="**/velocity.log" />
				<exclude name="**/log/**" />
				<exclude name="**/tmp/**" />
				<exclude name="**/work/**" />
				<exclude name="**/data/**" />
			</fileset>
		</copy>
		<copy todir="${build.dir}/${dist.name}/">
			<fileset dir=".">
				<include name="README.html" />
				<include name="LICENSE.txt" />
				<include name="www/**" />
{'fraction_non_alphanumeric': 0.2245897536734475, 'fraction_numerical': 0.001501555182152944, 'mean_word_length': 3.8910648714810283, 'pattern_counts': {'":': 0, '<': 671, '<?xml version=': 2, '>': 671, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6755659', 'n_tokens_mistral': 11107, 'n_tokens_neox': 9449, 'n_words': 1497}