Jaim/build.xml

119 lines
4.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written to assume that classpath is rooted in the current directory. -->
<!-- So this should be OK if you make this script in the root of a filesystem. -->
<!-- If not, you may prefer to adjust the basedir, or move some directories around. -->
<!-- The idea is that both Ant and NetBeans have to know what the package root is -->
<!-- for the classes in your application. -->
<project basedir="." default="all" name="jaimlib">
<target name="init">
</target>
<target depends="init" name="compile">
<mkdir dir="build"/>
<!-- Both srcdir and destdir should be package roots. -->
<!-- They could be different of course; in that case NetBeans can also be set -->
<!-- up to compile to a different filesystem in the same way; see Compiler Types: -->
<javac debug="true" deprecation="true" destdir="build" srcdir="src">
</javac>
</target>
<target depends="init,compile" name="jar">
<mkdir dir="lib"/>
<copy todir="build">
<fileset dir="src">
<include name="**/*.properties"/>
</fileset>
</copy>
<jar basedir="build" compress="true" jarfile="lib/jaimlib.jar">
<exclude name="**/*.java"/>
<exclude name="**/jaimtest/**"/>
</jar>
</target>
<target depends="init,compile" name="jartest">
<mkdir dir="lib"/>
<jar basedir="build" compress="true" jarfile="lib/jaimtest.jar">
<manifest>
<attribute name="Main-Class" value="com.wilko.jaimtest.JaimTest"/>
</manifest>
<exclude name="**/*.java"/>
</jar>
</target>
<target depends="init,jar,jartest" description="Build everything." name="all">
</target>
<target depends="init" description="Javadoc for my API." name="javadoc">
<mkdir dir="doc/apidoc"/>
<javadoc destdir="doc/apidoc" packagenames="com.wilko.jaim.*">
<sourcepath>
<pathelement location="src"/>
</sourcepath>
<footer><![CDATA[<a href="http://jaimlib.sourceforge.net">jaimlib.sourceforge.net</a>]]></footer>
</javadoc>
</target>
<target depends="init" description="Clean all build products." name="clean">
<delete dir="doc/apidoc" includeEmptyDirs="true"/>
<delete dir="build" includeEmptyDirs="true"/>
<delete dir="lib" includeEmptyDirs="true"/>
<delete>
<fileset dir="src" includes="**/*.class"/>
</delete>
</target>
<target depends="javadoc,compile,jar,jartest" name="dist">
<delete>
<fileset dir="." includes="jaimlib.tar*"/>
</delete>
<mkdir dir="jaimlib"/>
<mkdir dir="jaimlib/lib"/>
<mkdir dir="jaimlib/doc"/>
<copy todir="jaimlib">
<fileset dir="." includes="license.txt"/>
<fileset dir="." includes="build.xml"/>
<fileset dir="." includes="changes.txt"/>
<fileset dir="." includes="readme.txt"/>
</copy>
<copy todir="jaimlib/lib">
<fileset dir="lib"/>
</copy>
<copy todir="jaimlib/doc">
<fileset dir="doc"/>
</copy>
<tar basedir="." includes="jaimlib/**/*" tarfile="jaimlib.tar"/>
<gzip src="jaimlib.tar" zipfile="jaimlib.tar.gz"/>
<delete file="jaimlib.tar"/>
<delete dir="jaimlib" includeEmptyDirs="true"/>
</target>
<target depends="javadoc,compile,jar,jartest" name="srcdist">
<delete>
<fileset dir="." includes="jaimlibsrc.tar*"/>
</delete>
<mkdir dir="jaimlib"/>
<mkdir dir="jaimlib/lib"/>
<mkdir dir="jaimlib/doc"/>
<mkdir dir="jaimlib/src"/>
<copy todir="jaimlib">
<fileset dir="." includes="license.txt"/>
<fileset dir="." includes="build.xml"/>
<fileset dir="." includes="changes.txt"/>
<fileset dir="." includes="readme.txt"/>
</copy>
<copy todir="jaimlib/lib">
<fileset dir="lib"/>
</copy>
<copy todir="jaimlib/doc">
<fileset dir="doc"/>
</copy>
<copy todir="jaimlib/src">
<fileset dir="src"/>
</copy>
<tar basedir="." includes="jaimlib/**/*" tarfile="jaimlibsrc.tar"/>
<gzip src="jaimlibsrc.tar" zipfile="jaimlibsrc.tar.gz"/>
<delete file="jaimlibsrc.tar"/>
<delete dir="jaimlib" includeEmptyDirs="true"/>
</target>
</project>