blob: 038636ffcd658d5ce3cc413a712711e8cb93857a [file] [log] [blame]
<project name="jspf" default="jar" basedir=".">
<property file="${user.home}/.m2/maven.properties"/>
<property name="maven.build.output" value="target/classes"/>
<property name="maven.build.directory" value="target"/>
<property name="maven.build.final.name" value="jspf-0.9-SNAPSHOT"/>
<property name="maven.test.reports" value="${maven.build.directory}/test-reports"/>
<property name="maven.test.output" value="target/test-classes"/>
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
<path id="build.classpath">
<fileset dir="${maven.repo.local}">
<include name="commons-lang/commons-lang/1.0/commons-lang-1.0.jar"/>
<include name="commons-logging/commons-logging/1.0/commons-logging-1.0.jar"/>
<include name="dnsjava/dnsjava/2.0.3/dnsjava-2.0.3.jar"/>
<include name="commons-cli/commons-cli/1.0/commons-cli-1.0.jar"/>
<include name="log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
</fileset>
</path>
<target name="clean" description="Clean the output directory">
<delete dir="${maven.build.directory}"/>
</target>
<target name="compile" depends="check-commons-lang, check-commons-cli, check-commons-logging, check-dnsjava, check-log4j" description="Compile the code">
<mkdir dir="${maven.build.output}"/>
<javac destdir="${maven.build.output}" excludes="**/package.html" debug="true" deprecation="true" optimize="false">
<src>
<pathelement location="src/main/java"/>
</src>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${maven.build.output}">
<fileset dir="src/main/resources"/>
</copy>
</target>
<target name="jar" depends="compile,test" description="Clean the JAR">
<jar jarfile="${maven.build.directory}/${maven.build.final.name}.jar" basedir="${maven.build.output}" excludes="**/package.html">
<manifest>
<attribute name="Main-class" value="org.apache.james.jspf.impl.SPFQuery"/>
</manifest>
</jar>
</target>
<target name="compile-tests" depends="junit-present, compile" description="Compile the test code" if="junit.present">
<mkdir dir="${maven.test.output}"/>
<javac destdir="${maven.test.output}" excludes="**/package.html" debug="true" deprecation="true" optimize="false">
<src>
<pathelement location="src/test/java"/>
</src>
<classpath>
<path refid="build.classpath"/>
<pathelement location="${maven.build.output}"/>
</classpath>
</javac>
<copy todir="${maven.test.output}">
<fileset dir="src/test/resources"/>
</copy>
</target>
<target name="test" depends="junit-present, compile-tests" if="junit.present" description="Run the test cases">
<mkdir dir="${maven.test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.classpath"/>
<pathelement location="${maven.build.output}"/>
<pathelement location="${maven.test.output}"/>
</classpath>
<batchtest todir="${maven.test.reports}">
<fileset dir="src/test/java">
<include name="**/*Test.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present"/>
</target>
<target name="junit-present" depends="test-junit-present" unless="junit.present">
<echo>================================= WARNING ================================</echo>
<echo> Junit isn&apos;t present in your $ANT_HOME/lib directory. Tests not executed. </echo>
<echo>==========================================================================</echo>
</target>
<target name="check-commons-lang" depends="test-commons-lang-present" unless="commons.lang.present">
<echo>================================ ERROR =====================================</echo>
<echo> You missing some dependencies to build jSPF. Please download and add them to </echo>
<echo> the buildpath of this project. After that try to build again. </echo>
<echo> The dependency that is missing is: </echo>
<echo> - commons-lang </echo>
<echo> </echo>
<echo> Get it from: http://jakarta.apache.org/commons/lang/</echo>
<echo>============================================================================</echo>
</target>
<target name="check-commons-logging" depends="test-commons-logging-present" unless="commons.logging.present">
<echo>================================ ERROR =====================================</echo>
<echo> You missing some dependencies to build jSPF. Please download and add them to </echo>
<echo> the buildpath of this project. After that try to build again. </echo>
<echo> The dependency that is missing is: </echo>
<echo> - commons-logging </echo>
<echo> </echo>
<echo> Get it from: http://jakarta.apache.org/commons/logging/</echo>
<echo>============================================================================</echo>
</target>
<target name="check-commons-cli" depends="test-commons-cli-present" unless="commons.cli.present">
<echo>================================ ERROR =====================================</echo>
<echo> You missing some dependencies to build jSPF. Please download and add them to </echo>
<echo> the buildpath of this project. After that try to build again. </echo>
<echo> The dependency that is missing is: </echo>
<echo> - commons-cli </echo>
<echo> </echo>
<echo> Get it from: http://jakarta.apache.org/commons/cli/</echo>
<echo>============================================================================</echo>
</target>
<target name="check-dnsjava" depends="test-dnsjava-present" unless="dnsjava.present">
<echo>================================ ERROR =====================================</echo>
<echo> You missing some dependencies to build jSPF. Please download and add them to </echo>
<echo> the buildpath of this project. After that try to build again. </echo>
<echo> The dependency that is missing is: </echo>
<echo> - dnsjava </echo>
<echo> </echo>
<echo> Get it from: http://www.dnsjava.org</echo>
<echo>============================================================================</echo>
</target>
<target name="check-log4j" depends="test-log4j-present" unless="log4j.present">
<echo>================================ ERROR =====================================</echo>
<echo> You missing some dependencies to build jSPF. Please download and add them to </echo>
<echo> the buildpath of this project. After that try to build again. </echo>
<echo> The dependency that is missing is: </echo>
<echo> - log4j </echo>
<echo> </echo>
<echo> Get it from: http://logging.apache.org/log4j/</echo>
<echo>============================================================================</echo>
</target>
<target name="test-commons-lang-present">
<available classname="org.apache.commons.lang.CharSet" property="commons.lang.present" classpathref="build.classpath"></available>
</target>
<target name="test-commons-logging-present">
<available classname="org.apache.commons.logging.Log" property="commons.logging.present" classpathref="build.classpath"></available>
</target>
<target name="test-commons-cli-present">
<available classname="org.apache.commons.cli.CommandLineParser" property="commons.cli.present" classpathref="build.classpath"></available>
</target>
<target name="test-dnsjava-present">
<available classname="org.xbill.DNS.Address" property="dnsjava.present" classpathref="build.classpath"></available>
</target>
<target name="test-log4j-present">
<available classname="org.apache.log4j.Logger" property="log4j.present" classpathref="build.classpath"></available>
</target>
</project>