Newer
Older
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="tap" basedir="." default="buildLib">
gmantele
committed
<property name="version" value="2.0beta" />
<property name="srcDir" value="src" />
<property name="libDir" value="lib" />
<property name="compileDir" value="antBuild" />
<property name="classesDir" value="${compileDir}"/>
<property name="javadocDir" value="javadoc/tap" />
gmantele
committed
<property name="cosJarName" value="cos-1.5beta.jar" />
<property name="cosJar" value="${libDir}/${cosJarName}" />
<property name="stilJarName" value="stil_3.0-11.jar" />
gmantele
committed
<property name="stilJar" value="${libDir}/${stilJarName}" />
<property name="tapPath" value="tap/**,adql/**,uws/**,cds/**" />
<property name="jsonPath" value="org/json/**" />
<property name="extLibsPath" value="com/oreilly/servlet/**,nom/tam/**,org/apache/tools/bzip2/**,uk/ac/starlink/**" />
gmantele
committed
<property name="licensePath" value="COPYING.LESSER" />
<property name="includesList" value="${tapPath},${jsonPath},${extLibsPath}" />
<property name="jarDest" value="." />
<property name="libJarFile" value="${jarDest}/tap_${version}.jar" />
<property name="srcJarFile" value="${jarDest}/tap_src_${version}.jar" />
<property name="javadocJarFile" value="${jarDest}/tap_javadoc_${version}.jar" />
<property name="testsDir" value="test" />
<property name="adqlJunitReportsDir" value="reports/adql" />
<property name="uwsJunitReportsDir" value="reports/uws" />
<property name="tapJunitReportsDir" value="reports/tap" />
gmantele
committed
<fail message="The property POSTGRES must be set! It provides the path toward a directory or a JAR which contains all classes inside org.postgresql.">
<condition><not><isset property="POSTGRES"/></not></condition>
gmantele
committed
<fail message="The property SERVLET-API must be set! It provides the path toward a directory or a JAR which contains all classes inside javax.servlet.">
<condition><not><isset property="SERVLET-API"/></not></condition>
</fail>
<fail message="The property JUNIT-API must be set! It provides the path toward a directory or a JAR which contains all classes needed to use JUnit.">
<condition><not><isset property="JUNIT-API"/></not></condition>
</fail>
<fail message="The property JNDI-API must be set! It provides the path toward a directory or a JAR which contains all classes needed to use Simple-JNDI.">
<condition><not><isset property="JNDI-API"/></not></condition>
</fail>
<!-- CLASSPATHS -->
<path id="tap.classpath">
<pathelement location="${cosJar}" />
gmantele
committed
<pathelement location="${jsonJar}" />
<pathelement location="${stilJar}" />
<pathelement location="${POSTGRES}" />
<pathelement location="${SERVLET-API}" />
</path>
gmantele
committed
<path id="junit.class.path">
<path refid="tap.classpath" />
<pathelement path="${JNDI-API}" />
gmantele
committed
<pathelement path="${JUNIT-API}" />
<pathelement location="bin" />
</path>
<echo>TAP LIBRARY VERSION = ${version}</echo>
<!-- BUILD ALL TASK -->
<target name="buildAll" depends="buildLibAndSrc,buildJavadoc"
description="Build three JARs: the library (classes), its sources and its Javadoc. Then, except the JAR, all the compiled javadoc files are deleted." >
<antcall target="cleanJavadocBuild" />
</target>
<target name="cleanAll" depends="clean,cleanJavadoc,cleanJUnitReports" description="Delete all files generated by this ANT file for the set version." />
<!-- JUNIT VALIDATION -->
<target name="cleanJUnitReports" description="Clean the JUnit reports directory of the ADQL, UWS and TAP library ONLY.">
<delete dir="${adqlJunitReportsDir}" failonerror="false" />
<delete dir="${uwsJunitReportsDir}" failonerror="false" />
<delete dir="${tapJunitReportsDir}" failonerror="false" />
</target>
<target name="junitValidation" depends="cleanJUnitReports" description="Executes all JUnit tests before building the library and stop ANT at any error.">
<mkdir dir="${adqlJunitReportsDir}"/>
<mkdir dir="${uwsJunitReportsDir}"/>
<mkdir dir="${tapJunitReportsDir}"/>
<junit errorproperty="testsFailure" failureproperty="testsFailure">
<classpath refid="junit.class.path" />
<formatter type="brief" usefile="yes" />
<batchtest todir="${adqlJunitReportsDir}">
<fileset dir="${testsDir}" includes="adql/**/Test*.java" />
</batchtest>
<batchtest todir="${uwsJunitReportsDir}">
<fileset dir="${testsDir}" includes="uws/**/Test*.java" />
</batchtest>
<batchtest todir="${tapJunitReportsDir}">
<fileset dir="${testsDir}" includes="tap/**/Test*.java" />
</batchtest>
</junit>
<fail if="${testsFailure}" message="Failed JUnit validation for ADQL, UWS or TAP Lib.!" />
</target>
<!-- LIB & SOURCES -->
<target name="clean" description="Delete the JARs for the library (classes) and for its sources for the set version.">
<delete file="${libJarFile}" failonerror="false" />
<delete file="${srcJarFile}" failonerror="false" />
<delete dir="${compileDir}" failonerror="false" />
</target>
<target name="compileLib" depends="clean,junitValidation" description="Build all the classes of the TAP library. This target is particularly usefull because it lets highlighting missing dependencies.">
<mkdir dir="${compileDir}" />
<javac destdir="${compileDir}" srcdir="${srcDir}" includes="${includesList}" includeantruntime="false" encoding="utf8">
<classpath refid="tap.classpath" />
</javac>
</target>
<target name="buildLib" depends="compileLib" description="After 'clean', build the library JAR (only classes).">
<echo>Generate the library:</echo>
<jar basedir="${classesDir}" destfile="${libJarFile}" includes="${includesList}">
<zipfileset src="${cosJar}" excludes="META-INF/*" />
<zipfileset src="${stilJar}" excludes="META-INF/*" />
gmantele
committed
<zipfileset dir="src" includes="${licensePath}" />
<jar basedir="${classesDir}" destfile="${libJarFile}2" includes="${includesList}">
<zipfileset src="${cosJar}" excludes="META-INF/*" />
<zipfileset dir="src" includes="${licensePath}" />
</jar>
<delete dir="${compileDir}" failonerror="true" />
</target>
<target name="buildLibAndSrc" depends="buildLib" description="After 'clean' and 'buildLib', build the sources JAR (only .java).">
gmantele
committed
<jar compress="false" destfile="${srcJarFile}">
<zipfileset dir="${srcDir}" includes="${includesList},${licensePath}" prefix="${srcDir}" />
<zipfileset dir="${libDir}" includes="${cosJarName}" fullPath="${cosJar}" />
<zipfileset dir="${libDir}" includes="${stilJarName}" fullPath="${stilJar}" />
<jar compress="false" destfile="${srcJarFile}2">
<zipfileset dir="${srcDir}" includes="${includesList},${licensePath}" prefix="${srcDir}" />
<zipfileset dir="${libDir}" includes="${cosJarName}" fullPath="${cosJar}" />
</jar>
</target>
<!-- JAVADOC -->
<target name="cleanJavadocBuild" description="Delete the whole generated/compiled Javadoc directory.">
<delete dir="${javadocDir}" failonerror="false" />
</target>
<target name="cleanJavadoc" depends="cleanJavadocBuild" description="Delete the Javadoc JAR AND the whole generated/compiled Javadoc directory.">
<delete file="${jarDest}/${javadocJarFile}" failonerror="false" />
</target>
<target name="compileJavadoc" depends="cleanJavadoc" description="After 'cleanJavadoc', compile the whole Javadoc.">
<javadoc encoding="utf-8" charset="utf-8" docencoding="utf-8" access="protected" author="true" destdir="${javadocDir}" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.7" splitindex="true" use="true" version="true">
<packageset dir="${srcDir}" includes="${includesList}" />
<classpath refid="tap.classpath" />
</javadoc>
</target>
<target name="buildJavadoc" depends="compileJavadoc" description="After 'compileJavadoc', build the Javadoc JAR.">
<jar destfile="${javadocJarFile}" basedir="${javadocDir}" />
</target>