<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="compile" name="jtds" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="libs">
<fileset dir="lib" includes="*.jar"/>
</path>
<!-- include maven ant task lib -->
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
<target name="init">
<tstamp/>
<property name="build" value="build"/>
<property name="build.compiler" value="modern"/>
<property name="javac.debug" value="on"/>
<property name="javac.optimize" value="on"/>
<property name="src" value="src"/>
<property name="dist" value="dist"/>
<property name="test" value="test"/>
<property name="version" value="1.3.1"/>
</target>
<target name="clean" depends="init">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${build}"/>
<mkdir dir="${build}/classes"/>
<mkdir dir="${build}/testclasses"/>
<mkdir dir="${build}/src"/>
<mkdir dir="${build}/testsrc"/>
<mkdir dir="${build}/testrep"/>
<copy todir="${build}/src">
<fileset dir="${src}/main" includes="**/*.java"/>
</copy>
<copy todir="${build}/testsrc">
<fileset dir="${src}/test" includes="**/*.java"/>
</copy>
<copy todir="${build}/classes">
<fileset dir="${src}/main" includes="**/*.properties"/>
</copy>
<copy todir="${build}/testclasses">
<fileset dir="${src}/test" includes="**/*.properties"/>
</copy>
</target>
<target name="compile" depends="init,prepare">
<javac destdir="${build}/classes" srcdir="${build}/src" classpathref="libs" debug="${javac.debug}" optimize="${javac.optimize}" encoding="latin1"/>
</target>
<target name="compile-test" depends="init,prepare,compile">
<javac destdir="${build}/testclasses" srcdir="${build}/testsrc" classpathref="libs" classpath="${build}/classes" debug="${javac.debug}" optimize="${javac.optimize}" encoding="latin1"/>
</target>
<target name="javadoc" depends="prepare">
<mkdir dir="${build}/doc"/>
<javadoc sourcepath="${build}/src;${build}/testsrc" destdir="${build}/doc" packagenames="net.sourceforge.jtds.*" Author="true"
Doctitle="jTDS API Documentation" Use="true" Version="true" bottom="Generated on ${TODAY}"
Windowtitle="jTDS API" Private="true" classpathref="libs" encoding="latin1">
<tag name="todo" description="To do:"/>
<tag name="created" description="Created:"/>
</javadoc>
<!-- create Maven javadoc artifact -->
<jar basedir="${build}/doc"
excludes="**/*Test*/**"
includes="**/*"
jarfile="${build}/${ant.project.name}-${version}-javadoc.jar">
<manifest>
<attribute name="Implementation-Title" value="jTDS JDBC Driver"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-URL" value="http://jtds.sourceforge.net"/>
<attribute name="Specification-Title" value="JDBC"/>
<attribute name="Specification-Version" value="3.0"/>
<attribute name="Main-Class" value="net.sourceforge.jtds.jdbc.Driver"/>
</manifest>
</jar>
<!-- create Maven sources artifact -->
<jar basedir="${build}/src"
excludes="**/*Test*/**"
includes="**/*.java"
jarfile="${build}/${ant.project.name}-${version}-sources.jar">
<manifest>
<attribute name="Implementation-Title" value="jTDS JDBC Driver"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-URL" value="http://jtds.sourceforge.net"/>
<attribute name="Specification-Title" value="JDBC"/>
<attribute name="Specification-Version" value="3.0"/>
</manifest>
</jar>
</target>
<target name="test" depends="compile,compile-test">
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<junit fork="no" haltonfailure="no" printsummary="yes">
<classpath>
<pathelement location="build/classes"/>
<pathelement location="build/testclasses"/>
<path refid="libs"/>
</classpath>
<formatter type="plain"/>
<batchtest todir="${build}/testrep" >
<fileset dir="${build}/testsrc">
<include name="**/*Test.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="dist" depends="clean,compile,javadoc">
<mkdir dir="${dist}"/>
<!-- runtime jar -->
<copy todir="${build}/classes/META-INF">
<fileset dir="${src}/META-INF" includes="**/*"/>
</copy>
<jar basedir="${build}/classes"
excludes="**/*Test*/**"
includes="**/*"
jarfile="${build}/${ant.project.name}-${version}.jar">
<manifest>
<attribute name="Implementation-Title" value="jTDS JDBC Driver"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-URL" value="http://jtds.sourceforge.net"/>
<attribute name="Specification-Title" value="JDBC"/>
<attribute name="Specification-Version" value="3.0"/>
<attribute name="Main-Class" value="net.sourceforge.jtds.jdbc.Driver"/>
</manifest>
</jar>
<!-- source package -->
<mkdir dir="${dist}/tmp"/>
<copy todir="${dist}/tmp/doc">
<fileset dir="${build}/doc" includes="**/*"/>
</copy>
<copy todir="${dist}/tmp">
<fileset dir="." includes="README,README.SSL,README.XA,README.SSO,CHANGELOG,LICENSE,*.bat,*.sh,*.xml,src/**/*,lib/**/*,html/**/*,conf/**/*.xml,conf/**/*.tmpl"/>
</copy>
<zip basedir="${dist}/tmp" includes="**/*" zipfile="${dist}/${ant.project.name}-${version}-src.zip"/>
<delete dir="${dist}/tmp"/>
<!-- binary package -->
<mkdir dir="${dist}/tmp"/>
<copy todir="${dist}/tmp">
<fileset dir="." includes="README,README.SSL,README.XA,README.SSO,CHANGELOG,LICENSE,conf/**/*.xml,conf/**/*.tmpl,html/**/*"/>
<fileset dir="${build}" includes="${ant.project.name}-${version}.jar"/>
</copy>
<mkdir dir="${dist}/tmp/x86/XA"/>
<copy todir="${dist}/tmp/x86/XA">
<fileset dir="lib/x86/XA" includes="JtdsXA.dll"/>
<fileset dir="src/XA" includes="*.sql"/>
</copy>
<mkdir dir="${dist}/tmp/x86/SSO"/>
<copy todir="${dist}/tmp/x86/SSO">
<fileset dir="lib/x86/SSO" includes="ntlmauth.dll"/>
</copy>
<mkdir dir="${dist}/tmp/x64/SSO"/>
<copy todir="${dist}/tmp/x64/SSO">
<fileset dir="lib/x64/SSO" includes="ntlmauth.dll"/>
</copy>
<mkdir dir="${dist}/tmp/IA64/SSO"/>
<copy todir="${dist}/tmp/IA64/SSO">
<fileset dir="lib/IA64/SSO" includes="ntlmauth.dll"/>
</copy>
<zip basedir="${dist}/tmp" includes="**/*" zipfile="${dist}/${ant.project.name}-${version}-dist.zip"/>
<delete dir="${dist}/tmp"/>
</target>
<!-- Maven repository upload, disabled by default -->
<target name="maven_upload" depends="dist" description="deploy release version to Maven staging repository">
<input message="Please enter GPG passphrase:" addproperty="passphrase" />
<!-- define Maven coordinates -->
<property name="groupId" value="jtds.sourceforge.net" />
<property name="artifactId" value="jtds" />
<!-- define artifact names, following the Maven conventions -->
<property name="maven-jar" value="${build}/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${build}/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${build}/${artifactId}-${version}-sources.jar" />
<!-- defined Maven staging repository ID and URL -->
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- sign and deploy the driver artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Dgpg.passphrase=${passphrase}" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Dgpg.passphrase=${passphrase}" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Dgpg.passphrase=${passphrase}" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>