<project name="jai" default="war">
	<!-- on suppose que JEELIB est initialisée en paramètre de l'application --> 
	<property file="project.properties" />
	<property name="project.java.version" value="1.8" />
	<property name="encoding" value="UTF-8" />
	<property name="build" value="build" />
	<property name="testreports" value="testreports" />
	<property name="src" value="src" />

	<target name="prepare" description="Cree les repertoires et initialise certaines valeurs">
		<!-- Create the time stamp -->
		<tstamp />
		<mkdir dir="${build}" />
		<mkdir dir="${testreports}" />
	</target>

	<path id="webapp-path">
		<pathelement location="${build}" />
		<fileset dir="${JEELIB}">
					<include name="*.jar" />
				</fileset>
		<fileset dir="WebContent/WEB-INF/lib">
			<include name="*.jar" />
		</fileset>
	</path>


	<target name="clean" description="Efface tous les fichiers generes">
		<!-- Delete directory trees -->
		<delete dir="${build}" />
		<delete dir="${testreports}" />
		<delete dir="${target}" />
	</target>

	<target name="war" description="construction d'un war à partir d'un projet web eclipse" depends="clean,prepare">
		<javac includeantruntime="true" srcdir="src" destdir="${build}" source="${project.java.version}" debug="true" encoding="${encoding}">
			<classpath refid="webapp-path" />
		</javac>
		<mkdir dir="currentwar" />
		<copy todir="currentwar">
			<fileset dir="WebContent">
			</fileset>
		</copy>
		<mkdir dir="currentwar/WEB-INF/classes" />
		<copy todir="currentwar/WEB-INF/classes">
			<fileset dir="${build}" />
			<fileset dir="${src}">
				<include name="**/*.properties" />
				<include name="**/*.xml" />
			</fileset>
		</copy>
		<jar destfile="microfolielens.war" basedir="currentwar" />
		<delete dir="currentwar" />
	</target>
</project>
