<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="XEMELIOS-entrees-directes-stock" default="usage" basedir=".">
	<description>Builds, tests, and runs the project XEMELIOS entrees-directes- stock</description>
	<property file="${user.home}/.ant.properties"/>

	<target name="usage">
		<echo> Using ${ant.version} These are targets supported by this ANT build script: compile -
			compile all .java files, except thoses in ./tmp folder. clean - deletes all compiled and
			generated files and resources. jars - build jar files. Do not call this script directly,
			use the one located at root of projet (in ../..) instead. </echo>
	</target>

	<target name="compile" depends="mk-output-dirs">
		<javac srcdir="java" destdir="build/classes" debug="${compile.debug}" encoding="ISO-8859-1">
			<classpath>
				<pathelement path="../starter/build/jars"/>
				<pathelement path="../xemelios-core/build/classes"/>
				<pathelement path="../xml-marshall/build/classes"/>
				<fileset dir="../core/lib" includes="*.jar"/>
				<pathelement path="../mysql-persistence/build/classes"/>
				<pathelement path="../core/build/classes"/>
			</classpath>
		</javac>
		<copy todir="build/classes">
			<fileset dir="java">
				<include name="**/*"/>
				<exclude name="**/*.class"/>
				<exclude name="**/*.java"/>
				<exclude name="**/*.form"/>
			</fileset>
		</copy>
	</target>

	<target name="jars">
		<property file="component.properties"/>
		<copy file="manifest/manifest.txt" tofile="build/manifest.txt">
			<filterset>
				<filter token="version" value="${component.release}"/>
				<filter token="name" value="${component.name}"/>
			</filterset>
		</copy>
		<jar destfile="build/jars/entrees-directes-stock.jar" basedir="build/classes"
			manifest="build/manifest.txt"/>
	</target>

	<target name="config" depends="check-config">
		<property file="component.properties"/>
		<property name="component.dir" value="build/config/${component.name}/${component.release}"/>
		<mkdir dir="${component.dir}"/>
		<copy todir="${component.dir}">
			<fileset dir="conf">
				<include name="**/*"/>
				<exclude name="**/CVS/*"/>
			</fileset>
			<fileset dir="build/jars">
				<include name="*.jar"/>
			</fileset>
		</copy>
		<propertyfile file="${component.dir}/component.properties">
			<entry key="description" value="Configuration pour entrees-directes-stock"/>
			<entry key="type" value="config-updates"/>
			<entry key="base.dest" value="${xemelios.prg}/root/documents-def/"/>
			<entry key="requires" value="${component.requires}"/>
			<entry key="entrees-directes-stock.jar.dest" value="${xemelios.prg}/root/lib/"/>
		</propertyfile>
	</target>

	<target name="clean">
		<delete dir="build"/>
		<delete file="check-result.txt"/>
	</target>

	<target name="setup">
		<copy todir="../../build/setup/root/lib">
			<fileset dir="build/jars" includes="*.jar"/>
		</copy>
		<copy todir="../../build/setup/root/documents-def">
			<fileset dir="conf" includes="**/*" excludes="**/CVS"/>
		</copy>
	</target>

	<target name="mk-output-dirs">
		<mkdir dir="build/config"/>
		<mkdir dir="build/classes"/>
		<mkdir dir="build/jars"/>
	</target>
	<target name="check-config">
		<xslt style="../../utils/persistence-verifier.xsl"
			in="conf/fen0070a/fen0070a-persistence.xml" out="check-result.txt" force="true">
			<param name="fileName" expression="conf/fen0070a/fen0070a-persistence.xml"/>
		</xslt>
		<exec executable="more">
			<arg value="check-result.txt"/>
		</exec>
		<delete file="check-result.txt"/>
	</target>

</project>
