<?xml version="1.0"?>
<project name="OpenID4Java Library" default="jar" basedir=".">
<property environment="env"/>
<property file="local.properties"/>
<property file="project.properties"/>
<target name="create_paths">
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${endorsed.dir}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${libext.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<path refid="classpath"/>
<pathelement location="${classes}"/>
</path>
</target>
<target name="prepare" depends="create_paths">
<mkdir dir="${build}"/>
</target>
<target name="clean" depends="prepare"
description="Removes all build artifacts">
<delete dir="${build}" />
<delete dir="${apidoc}"/>
<delete file="${component.name}-${version}.tar.gz"/>
</target>
<target name="echoproperties" depends="create_paths"
description="Displays properties; useful for debugging">
<echoproperties/>
</target>
<target name="launch_browser" if="browser.cmd">
<fail unless=".html.file.to.browse"/>
<exec command="${browser.cmd} ${.html.file.to.browse}" spawn="yes"/>
</target>
<target name="compile" depends="prepare" description="Compiles main code">
<mkdir dir="${classes}"/>
<javac srcdir="${src}"
destdir="${classes}"
includeAntRuntime="no"
debug="${debug}"
deprecation="yes"
source="${jvm.ver}"
target="${jvm.ver}">
<classpath refid="classpath"/>
</javac>
</target>
<target name="jar" depends="compile"
description="Packages compiled class files into a jar archive">
<jar jarfile="${build}/${component.name}.jar">
<fileset dir="${classes}"/>
</jar>
</target>
<target name="version-update">
<taskdef resource="svntask.properties" classpathref="classpath"/>
<svn>
<status path="." lastchangedrevisionproperty="svn.rev" />
</svn>
<property file="VERSION"/>
<condition value="${Version}" else="${component.ver}.${svn.rev}"
property="version">
<equals arg1="" arg2="${svn.rev}" />
</condition>
<propertyfile file="VERSION">
<entry key="Version" value="${version}"/>
</propertyfile>
</target>
<target name="dist" depends="jar, apidoc, version-update"
description="Builds distribution zip package">
<move file="${build}/${component.name}.jar"
tofile="${basedir}/${component.name}-${component.ver}.jar"/>
<delete dir="${build}"/>
<delete file="${component.name}-${version}.tar.gz"/>
<tar destfile="${component.name}-${version}.tar.gz"
compression="gzip">
<tarfileset dir="${basedir}" prefix="${component.name}-${version}">
<exclude name="OpenID Library*"/>
<exclude name="libsrc/**"/>
</tarfileset>
</tar>
<delete file="${component.name}-${component.ver}.jar"/>
<delete dir="${apidoc}"/>
</target>
<target name="apidoc" depends="prepare"
description="Builds Javadoc documentation">
<mkdir dir="${apidoc}"/>
<javadoc
failonerror="yes"
sourcepath="${src}"
overview="${src}/overview.html"
packagenames="*"
destdir="${apidoc}"
classpathref="classpath"
access="private"
use="yes"
version="yes"
author="yes"
windowtitle="OpenID4Java Library" >
<doctitle>OpenID4Java Library</doctitle>
<bottom>
<![CDATA[<i>Copyright 2006-2007 Sxip Identity Corporation</i>]]>
</bottom>
</javadoc>
<antcall target="launch_browser">
<param name=".html.file.to.browse" value="${apidoc}/index.html"/>
</antcall>
</target>
<target name="compile_test" depends="compile"
description="Compiles test classes">
<mkdir dir="${classes.test}"/>
<javac srcdir="${test.src}"
destdir="${classes.test}"
source="${jvm.ver}"
target="${jvm.ver}"
debug="true"
deprecation="true"
fork="true"
includeAntRuntime="false">
<classpath>
<path refid="classpath.test"/>
<pathelement location="${classes}"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile_test"
description="Runs tests">
<delete dir="${build}/test/data"/>
<copy todir="${build}/test/data">
<fileset dir="${test.data}" />
</copy>
<replace token="SERVLET_PORT" value="${test.servlet.port}"
dir="${build}/test/data" />
<delete dir="${build}/test/junit/xml"/>
<mkdir dir="${build}/test/junit/xml"/>
<junit printsummary="yes" fork="no" failureproperty="test.failed">
<sysproperty key="YADIS_TEST_DATA" value="${build}/test/data"/>
<sysproperty key="SERVLET_PORT" value="${test.servlet.port}"/>
<sysproperty key="TEST_DATA" value="${test.src}/org/openid4java/"/>
<classpath>
<pathelement location="${classes.test}"/>
<pathelement location="${classes}"/>
<path refid="classpath"/>
</classpath>
<!--<formatter type="xml"/>-->
<formatter type="plain"/>
<batchtest fork="true" todir="${build}/test/junit/xml">
<formatter type="xml"/>
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
<exclude name="**/Abstract*.java"/>
</fileset>
</batchtest>
</junit>
<delete dir="${build}/test/junit/html"/>
<mkdir dir="${build}/test/junit/html"/>
<junitreport todir="${build}/test/junit/html">
<fileset dir="${build}/test/junit/xml">
<include name="*.xml"/>
</fileset>
<report todir="${build}/test/junit/html"/>
</junitreport>
<antcall target="launch_browser">
<param name=".html.file.to.browse"
value="build/test/junit/html/index.html"/>
</antcall>
<fail if="test.failed" message="Unit Tests Failed"/>
</target>
</project>