<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="XEMELIOS-core" default="usage" basedir=".">
	<description>Builds, tests, and runs the project XEMELIOS xemelios-core</description>
	<property file="${user.home}/.ant.properties"/>
	<property name="compile.debug" value="true"/>
	<property file="build.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>
				<fileset dir="lib" includes="*.jar"/>
				<pathelement path="../starter/build/classes"/>
				<pathelement path="../xml-marshall/build/classes"/>
				<pathelement path="../core/build/classes"/>
				<fileset dir="../core/lib/" includes="*.jar"/>
			</classpath>
		</javac>
		<copy todir="build/classes">
			<fileset dir="java">
				<include name="**/*"/>
				<exclude name="**/*.java"/>
				<exclude name="**/CVS/*"/>
				<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/xemelios-core.jar" basedir="build/classes"
			manifest="build/manifest.txt"/>
	</target>

	<target name="clean">
		<delete dir="build"/>
	</target>


	<target name="mk-output-dirs">
		<mkdir dir="build/classes"/>
		<mkdir dir="build/jars"/>
	</target>

	<target name="config" description="Genere l'arborescence de mise a jour">
		<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="lib" includes="*.jar *.dll"/>
			<fileset dir="build/jars" includes="*.jar"/>
			<fileset dir="res" includes="*.*"/>
			<fileset dir="../resources/templates">
				<include name="viewdoc.cmd"/>
				<include name="CP.bat"/>
				<include name="import-masse.bat"/>
			</fileset>
		</copy>
		<propertyfile file="${component.dir}/component.properties">
			<entry key="description" value="Programme Xemelios"/>
			<entry key="type" value="xemelios-updates"/>
			<entry key="base.dest" value="${xemelios.prg}/root/lib/"/>
			<entry key="deletes"
				value="${xemelios.prg}/root/documents-def/documents.xml,${xemelios.prg}/root/documents-def/etatPaye.xsl,${xemelios.prg}/root/documents-def/etatVersement.xsl,${xemelios.prg}/root/documents-def/nomenclature-import.xsl,${xemelios.prg}/root/documents-def/nomenclature-import-versement.xsl,${xemelios.prg}/root/documents-def/nomenclature-paye.xsl,${xemelios.prg}/root/documents-def/nomenclature-versement.xsl,${xemelios.prg}/root/documents-def/persistence-config/etatPaye-import-mysql.xsl,${xemelios.prg}/root/documents-def/persistence-config/etatVersement-import-mysql.xsl,${xemelios.prg}/root/documents-def/persistence-config/index.xsl,${xemelios.prg}/root/documents-def/persistence-config/paye-persistence.xml,${xemelios.prg}/root/documents-def/persistence-config/versement-persistence.xml,${xemelios.prg}/root/lib/import-batch.jar,${xemelios.prg}/root/lib/Xilize.jar,${xemelios.prg}/root/lib/cssparser-0-9-4-fs.jar,${xemelios.prg}/root/lib/looks-2.0.4.jar,${xemelios.prg}/root/lib/svgSalamander.jar,${xemelios.prg}/root/lib/itext-paulo-155.jar,${xemelios.prg}/root/setup-xemelios.zip,${xemelios.prg}/root/lib/commons-io-1.2.jar,${xemelios.prg}/root/lib/RegAccess.dll,${xemelios.prg}/root/lib/CP.bat,${xemelios.prg}/root/xemelios-reader.vbs,${xemelios.prg}/root/lib/logo_france.gif,${xemelios.prg}/root/lib/swingx-0.8.0.jar"/>
			<entry key="log4j.xml.dest" value="${xemelios.prg}/root"/>
			<entry key="modeleExcelHtml.xls.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="modeleExportXemelios.xls.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="modeleExportXemelios-97.xls.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="modeleExportXemelios-97SR1.xls.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="collapse-dwn.png.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="collapse-up.png.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="collapseAll.png.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="zoom.png.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="viewdoc.cmd.dest" value="${xemelios.prg}/root"/>
			<entry key="XMLPrettyPrint.xsl.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="couri.ttf.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="RegAcces.dll.dest" value="${xemelios.prg}/root"/>
			<entry key="CP.bat.dest" value="${xemelios.prg}/root"/>
			<entry key="import-masse.bat.dest" value="${xemelios.prg}/root"/>
			<entry key="logo_france.gif.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="logo_marianne.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="logo_ministere.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_beginning.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_beginning_inactive.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_close_criteres.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_end.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_end_inactive.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_left.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_left_inactive.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_open_criteres.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_right.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_right_inactive.png.dest" value="${xemelios.prg}/root/resources"/>
                        <entry key="navigate_summary.png.dest" value="${xemelios.prg}/root/resources"/>
			<entry key="configuration" value="fr.gouv.finances.cp.xemelios.patches.Core_4_0_0_42"/>
			<entry key="requires" value="${component.requires}"/>
		</propertyfile>
	</target>

	<target name="setup">
		<copy todir="../../build/setup/root/lib">
			<fileset dir="build/jars" includes="*.jar"/>
		</copy>
		<copy todir="../../build/setup/root/lib">
			<fileset dir="lib" includes="*.jar"/>
		</copy>
		<copy todir="../../build/setup/root/resources">
			<fileset dir="res">
				<include name="**/*"/>
				<exclude name="**/CVS"/>
				<exclude name="log4j.*"/>
				<exclude name="viewdoc.cmd"/>
			</fileset>
		</copy>
		<copy todir="../../build/setup/root">
			<fileset dir="res">
				<include name="log4j.*"/>
				<include name="viewdoc.cmd"/>
			</fileset>
			<fileset dir="lib">
				<include name="RegAccess.dll"/>
			</fileset>
		</copy>
	</target>

</project>
