<!--
o -projecthelp is useful to find out what to do
o If you do not have asciidoc installed (and dont' want
to install it), set no.asciidoc on the command line or
in here.
-->
<project name="vimdoclet" default="jar" basedir=".">
<property environment="env" />
<property name="src.dir" value="${basedir}/src"/>
<property name="java.src.dir" value="${src.dir}/java"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="jar" value="${build.dir}/${ant.project.name}.jar"/>
<property name="doc.dir" value="${basedir}/doc" />
<loadfile property="release.number" srcFile="${src.dir}/release.txt">
<filterchain>
<striplinebreaks />
</filterchain>
</loadfile>
<property name="release.name" value="vimdoclet-${release.number}" />
<property name="release.base.dir" value="${build.dir}/dist" />
<property name="release.dir.name" value="${release.name}" />
<property name="release.build.dir" value="${release.base.dir}/${release.dir.name}" />
<property name="samples.build.dir" value="${build.dir}/vimdoclet-${release.number}-samples" />
<path id="javadoc.classpath">
<fileset dir="${build.dir}"> <include name="*.jar"/> </fileset>
</path>
<target name="compile"
description="Compiles all code">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/classes"/>
<javac destdir="${build.dir}/classes"
debug="on">
<src path="${java.src.dir}"/>
</javac>
</target>
<target name="clean"
description="Removes all build artifacts">
<delete dir="${build.dir}" />
<delete file="doc/index.html" />
</target>
<target name="jar" depends="compile"
description="Packages code in a jar file">
<jar destfile="${jar}"
basedir="${build.dir}/classes">
</jar>
</target>
<target name="test.run" depends="jar"
description="Runs the doclet on the test classes"
>
<delete dir="${build.dir}/test-output" />
<mkdir dir="${build.dir}/test-output" />
<javadoc maxmemory="512M" classpathref="javadoc.classpath">
<packageset dir="${java.src.dir}" />
<doclet
name="com.naildrivin5.applications.vimdoclet.Main"
pathref="javadoc.classpath">
<param name="-outputDir" value="${build.dir}/test-output" />
</doclet>
</javadoc>
</target>
<target name="doc.push" depends="doc">
<scp verbose="true" sftp="true"
todir="davetron5000@shell.sourceforge.net:/home/groups/v/vi/vimdoclet/htdocs/" keyfile="/Users/davec/.ssh/id_dsa" passphrase="">
<fileset dir="${doc.dir}" excludes="README.txt"/>
</scp>
</target>
<target name="doc" unless="no.asciidoc"
description="Generate HTML from asciidoc"
>
<exec executable="asciidoc" dir="${doc.dir}">
<arg line="-a toc -a numbered -o index.html README.txt" />
</exec>
</target>
<target name="dist" depends="clean,jar,doc"
description="Creates a release tarball and zip in build/">
<mkdir dir="${release.build.dir}" />
<mkdir dir="${release.build.dir}/bin" />
<copy tofile="${release.build.dir}/bin/vimdoclet-${release.number}.jar" file="${jar}" />
<copy todir="${release.build.dir}/src">
<fileset dir="${src.dir}" excludes="release.txt" />
</copy>
<copy todir="${release.build.dir}" file="build.xml" />
<copy todir="${release.build.dir}" file="run.xml" />
<mkdir dir="${release.build.dir}/doc" />
<copy todir="${release.build.dir}/doc">
<fileset dir="${doc.dir}" />
</copy>
<tar destfile="${build.dir}/${release.name}.tar.gz" basedir="${release.base.dir}"
includes="${release.dir.name}/**"
compression="gzip" />
<zip destfile="${build.dir}/${release.name}.zip" basedir="${release.base.dir}"
includes="${release.dir.name}/**" />
</target>
<target name="dist-samples"
description="Creates the samples distribution">
<mkdir dir="${samples.build.dir}/vimdoclet-samples/samples" />
<copy todir="${samples.build.dir}/vimdoclet-samples/samples">
<fileset dir="${basedir}/sample" />
</copy>
<move
file="${samples.build.dir}/vimdoclet-samples/samples/README.txt"
tofile="${samples.build.dir}/vimdoclet-samples/README.txt" />
<zip destfile="${samples.build.dir}.zip" basedir="${samples.build.dir}" />
</target>
</project>