<project name="SimplyHTML" default="dist" basedir=".">
	<property name="version" value="0_16_07" />
	<property name="src" value="." />
	<property name="help" value="${src}/com/lightdev/app/shtm/help" />
	<property name="lib" value="../lib" />
	<property name="base" value="../" />
	<property name="build" value="../bin/classes" />
	<property name="dist" value="../dist" />
	<property name="dist.api" value="${dist}/api" />
	<property name="dist.src" value="${dist}/src" />
	<property name="dist.help" value="${dist}/help" />
	<property name="dist.lib" value="${dist}/lib" />
	<property name="SimplyHTML.jar" value="${dist.lib}/SimplyHTML.jar"/>
	<property name="SimplyHTMLHelp.jar" value="${dist.lib}/SimplyHTMLHelp.jar"/>
	<property name="post" value="../post" />
	<property name="debug" value="on" />
	<property name="java_source_version" value="1.5" />
	<property name="java_target_version" value="1.5" />
	<property name="build.compiler" value="modern" />
	<property name="jhall.jar" value="..\lib\jhall.jar" />
	<property name="gnu-regexp.jar" value="..\lib\gnu-regexp-1.1.4.jar" />
	<property name="classpath" value="${jhall.jar}:${gnu-regexp.jar}"/>

	<target name="build" depends="clean">
		<mkdir dir="${build}"/>
		<javac	srcdir="${src}"
			destdir="${build}"
			classpath="${classpath}"
			debug="${debug}"
    	   source="${java_source_version}"
	       target="${java_target_version}"
			>
			<!-- Currently, JUnit tests are only supported inside eclipse due to
			     classpath problems of the plugins. -->
			<exclude name="tests/**" />
			<exclude name="plugins/**" />
		</javac>
	</target>

	<target name="dist" depends="jar,help, dist-src"/>
	<target name="full-dist" depends="dist,javadoc"/>
	<target name="dist-src">
		<mkdir dir="${dist.src}" />
		<copy todir="${dist.src}">
			<fileset dir="${src}">
				<include name="**/MANIFEST.MF"/>
				<include name="**/*.java"/>
				<include name="**/*.xml"/>
				<include name="**/*.properties"/>
				<include name="**/*.gif"/>
				<include name="**/*.jpg"/>
				<include name="**/*.htm"/>
				<include name="**/*.html"/>
				<include name="**/*.css"/>
				<include name="**/*.hs"/>
				<include name="**/*.jhm"/>
				<include name="**/*.prf"/>
				<include name="**/*.TAB"/>
				<include name="**/*.txt"/>
				<include name="**/*.jar"/>
				<include name="**/SCHEMA"/>
				<include name="**/TMAP"/>
			</fileset>
		</copy>
		<tar destfile="${dist}/SimplyHTML_src_${version}.tar.gz" compression="gzip">
			<tarfileset	dir="${dist.src}" prefix="simplyhtml-${version}/src" 
				excludes="**/*.jar" />
			<tarfileset dir="${base}" prefix="simplyhtml-${version}" includes="*.txt" />
		</tar>

	</target>

	<target name="help">
		<mkdir dir="${dist.help}" />
		<copy todir="${dist.help}">
			<fileset dir="${help}">
				<include name="**/*"/>
			</fileset>
		</copy>
		<zip destfile="${dist}/SimplyHTML_manual_${version}.zip">
			<zipfileset dir="${dist.help}" prefix="SimplyHTML/manual" />
			<zipfileset dir="${base}" prefix="SimplyHTML" includes="*.txt" />
		</zip>
	</target>
	<target name="jar" depends="build">
		<mkdir dir="${dist.lib}" />
		<jar jarfile="${SimplyHTML.jar}"
		     manifest="${src}/MANIFEST.MF"
			update="true">
			<fileset dir="${build}">
			</fileset>
 			<fileset dir="${src}">
 				<include name="com/lightdev/app/shtm/resources/**"/>
			</fileset>
		</jar>
		<jar jarfile="${SimplyHTMLHelp.jar}"
			update="true">
			<fileset dir="${src}">
				<include name="com/lightdev/app/shtm/help/**"/>
			</fileset>
		</jar>
		<copy file="${jhall.jar}" tofile="${dist.lib}/jhall.jar" />
		<copy file="${gnu-regexp.jar}" tofile="${dist.lib}/gnu-regexp.jar" />
		<zip destfile="${dist}/SimplyHTML_bin_${version}.zip">
			<zipfileset dir="${dist.lib}" prefix="SimplyHTML/lib" />
			<zipfileset dir="${base}" prefix="SimplyHTML" includes="*.txt" />
		</zip>
	</target>
	<target name="clean">
		<delete dir="${build}"  quiet="true"/>
		<delete dir="${dist}"  quiet="true"/>
		<delete>
			<fileset defaultexcludes="no" dir="${src}" includes="**/*~"/>
			<fileset defaultexcludes="no" dir="${src}" includes="**/backup/**"/>
		</delete>

	</target>
	<target name="javadoc">
		<mkdir dir="${dist.api}" />
		<javadoc
			sourcepath="${src}"
			destdir="${dist.api}"
			packagenames="com.lightdev.*,de.calcom.*"
			classpath="${classpath}"
		/>
	</target>

</project>

