<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="laf-widget" default="all">

	<!-- Compiler options -->
	<property name="compiler.debug" value="on" />
	<property name="compiler.generate.no.warnings" value="off" />
	<property name="compiler.args" value="" />
	<property name="compiler.max.memory" value="128m" />
	<patternset id="compiler.excluded" />
	<patternset id="compiler.resources">
		<include name="**/?*.properties" />
		<include name="**/?*.xml" />
		<include name="**/?*.gif" />
		<include name="**/?*.png" />
		<include name="**/?*.jpeg" />
		<include name="**/?*.jpg" />
		<include name="**/?*.html" />
		<include name="**/?*.dtd" />
		<include name="**/?*.license" />
		<include name="**/?*.tld" />
		<include name="**/?*.ttf" />
	</patternset>
	<!-- JDK definitions -->

	<property name="jdk.home.java_version_1.5.0" value="C:\Program Files\Java\jdk1.5.0_11" />
	<path id="jdk.classpath.java_version_1.5.0">
		<fileset dir="${jdk.home.java_version_1.5.0}">
			<include name="jre/lib/charsets.jar" />
			<include name="jre/lib/deploy.jar" />
			<include name="jre/lib/javaws.jar" />
			<include name="jre/lib/jce.jar" />
			<include name="jre/lib/jsse.jar" />
			<include name="jre/lib/plugin.jar" />
			<include name="jre/lib/rt.jar" />
			<include name="jre/lib/ext/dnsns.jar" />
			<include name="jre/lib/ext/localedata.jar" />
			<include name="jre/lib/ext/sunjce_provider.jar" />
			<include name="jre/lib/ext/sunpkcs11.jar" />
		</fileset>
	</path>

	<property name="project.jdk.home" value="${jdk.home.java_version_1.5.0}" />
	<property name="project.jdk.classpath" value="jdk.classpath.java_version_1.5.0" />
	<!-- Project Libraries -->
	<!-- Global Libraries -->


	<dirname property="module.laf-widget.basedir" file="${ant.file}" />

	<property name="compiler.args.laf-widget" value="${compiler.args}" />

	<property name="laf-widget.build.dir" value="${module.laf-widget.basedir}/build/" />
	<property name="laf-widget.output.dir" value="${laf-widget.build.dir}/classes" />
	<property name="laf-widget.drop.dir" value="${module.laf-widget.basedir}/drop" />
	<property name="laf-widget.lib.dir" value="${module.laf-widget.basedir}/lib" />
	<property name="laf-widget.src.dir" value="${module.laf-widget.basedir}/src/" />

	<path id="laf-widget.module.bootclasspath">
		<!-- Paths to be included in compilation bootclasspath -->
	</path>

	<property name="module.jdk.home.laf-widget" value="${project.jdk.home}" />
	<property name="module.jdk.classpath.laf-widget" value="${project.jdk.classpath}" />

	<path id="laf-widget.module.classpath">
		<path refid="${module.jdk.classpath.laf-widget}" />
		<pathelement location="${laf-widget.lib.dir}/asm-all-2.2.2.jar" />
		<pathelement location="${laf-widget.lib.dir}/ant.jar" />
	</path>

	<patternset id="excluded.from.module.laf-widget" />

	<patternset id="excluded.from.compilation.laf-widget">
		<patternset refid="excluded.from.module.laf-widget" />
		<patternset refid="compiler.excluded" />
	</patternset>

	<path id="laf-widget.module.sourcepath">
		<dirset dir="${laf-widget.src.dir}">
			<include name="org/jvnet/lafwidget" />
			<include name="contrib" />
		</dirset>
	</path>

	<path id="laf-widget.module.testsourcepath">
		<dirset dir="${laf-widget.src.dir}">
			<include name="test" />
		</dirset>
	</path>

	<target name="compile.module.laf-widget" depends="compile.module.laf-widget.production, compile.module.laf-widget.tests" description="compile module laf-widget" />

	<target name="compile.module.laf-widget.production" description="compile module laf-widget production classes">
		<mkdir dir="${laf-widget.output.dir}" />
		<javac destdir="${laf-widget.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" executable="${module.jdk.home.laf-widget}/bin/javac">
			<compilerarg line="${compiler.args.laf-widget}" />
			<bootclasspath refid="laf-widget.module.bootclasspath" />
			<classpath refid="laf-widget.module.classpath" />
			<src refid="laf-widget.module.sourcepath" />
			<patternset refid="excluded.from.compilation.laf-widget" />
		</javac>
		<copy todir="${laf-widget.output.dir}">
			<fileset dir="${laf-widget.src.dir}">
				<patternset refid="compiler.resources" />
				<type type="file" />
				<patternset refid="excluded.from.compilation.laf-widget" />
			</fileset>
		</copy>
	</target>

	<target name="compile.module.laf-widget.tests" description="compile module laf-widget test classes" unless="skip.tests">
		<mkdir dir="${laf-widget.output.dir}" />
		<javac destdir="${laf-widget.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" executable="${module.jdk.home.laf-widget}/bin/javac">
			<compilerarg line="${compiler.args.laf-widget}" />
			<bootclasspath refid="laf-widget.module.bootclasspath" />
			<classpath refid="laf-widget.module.classpath" />
			<src refid="laf-widget.module.testsourcepath" />
			<patternset refid="excluded.from.compilation.laf-widget" />
		</javac>
		<copy todir="${laf-widget.output.dir}/test">
			<fileset dir="${laf-widget.output.dir}/test">
				<patternset refid="compiler.resources" />
				<type type="file" />
				<patternset refid="excluded.from.compilation.laf-widget" />
			</fileset>
		</copy>
	</target>

	<target name="clean.module.laf-widget" description="cleanup module">
		<delete dir="${laf-widget.output.dir}" />
	</target>

	<target name="init" description="Build initialization">
		<!-- Perform any build initialization in this target -->
	</target>

	<target name="jar-bin" description="create runtime jar">
		<delete file="${laf-widget.drop.dir}/laf-widget.jar" />
		<jar compress="true" destfile="${laf-widget.drop.dir}/laf-widget.jar" manifest="${laf-widget.src.dir}/META-INF/MANIFEST.MF">
			<fileset dir="${laf-widget.output.dir}/" excludes="test/**,contrib/com/blogofbug/examples/**" />
			<fileset dir="${module.laf-widget.basedir}/" includes="resources/**" />
		</jar>
	</target>

	<target name="jar-bin-tst" description="create test runtime jar">
		<delete file="${laf-widget.drop.dir}/laf-widget-tst.jar" />
		<jar destfile="${laf-widget.drop.dir}/laf-widget-tst.jar">
			<fileset dir="${laf-widget.output.dir}/" includes="test/**" />
		</jar>
	</target>

	<target name="distro" description="create distribution">
		<delete file="${module.laf-widget.basedir}/laf-widget-all.zip" />
		<zip destfile="${module.laf-widget.basedir}/laf-widget-all.zip" compress="true">
			<fileset dir="${module.laf-widget.basedir}">
				<include name="3rd/*.bat" />
				<include name="docs/**" />
				<include name="lib/**" />
				<include name="src/**" />
				<include name="drop/**" />
				<include name="www/index.html" />
				<include name="www/docs/**" />
				<include name="www/images/**" />
				<include name="build*.xml" />
				<include name="www/release-info/3.0/**" />
			</fileset>
		</zip>
	</target>

	<target name="jar" depends="jar-bin, jar-bin-tst" description="create all jars" />

	<target name="clean" depends="clean.module.laf-widget" description="cleanup all" />

	<target name="all" depends="init, clean, compile.module.laf-widget, jar" description="build all" />
</project>