<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="XEMELIOS-plugin-signerfichier-pes" default="usage" basedir=".">
	<description>Builds, tests the  signature plugin</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,compile-file-signer,compile-APXS-file-signer">
		<javac srcdir="java" destdir="build/classes" debug="${compile.debug}" encoding="ISO-8859-1">
			<classpath>
				<pathelement path="../xml-marshall/build/classes"/>
                <pathelement path="../xemelios-core/build/classes"/>
                <pathelement path="../starter/build/classes"/>
                <fileset dir="../core/lib" includes="*.jar"/>
                <fileset dir="../xemelios-core/lib" includes="*.jar"/>
                <pathelement path="../core/build/classes"/>
                <pathelement path="file-signer/build/classes"/>
                <fileset dir="lib" includes="*.jar"/>
			</classpath>
		</javac>
		<copy todir="build/classes">
			<fileset dir="java">
				<include name="**/*"/>
				<exclude name="**/*.java"/>
				<exclude name="**/CVS/*"/>
                <exclude name="**/*.form"/>
                <exclude name="**/*.class"/>
			</fileset>
		</copy>
	</target>
	
	<target name="jars"><!--  depends="jars-file-signer,jars-APXS-file-signer" -->
            <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-->
                <manifest file="build/manifest.txt">
                    <attribute name="Jar-Version" value="${component.release}"/>
                    <attribute name="Jar-Content" value="${component.name}"/>
                    <attribute name="Main-Class" value="fr.gouv.finances.cp.xemelios.plugin.signerfichier.Starter"/>
                    <attribute name="Tool-Class" value="fr.gouv.finances.cp.xemelios.plugin.signerfichier.SignerFichierPlugin"/>
                    <attribute name="Tool-Description" value="Signature des fichiers PES"/>
                    <!--attribute name="Class-Path" value="../lib/xemelios-core.jar ../lib/swing-layout-1.0.jar ../lib/xercesImpl.jar APXS-file-signer.jar bc-jce-jdk13-129.jar jna.jar ../lib/wizard.jar"/-->
                </manifest>
            <jar destfile="build/jars/${component.name}.jar" basedir="build/classes" manifest="build/manifest.txt">
            </jar>
        <!--copy todir="build/jars">
			<fileset dir="lib">
				<include name="**/*.jar"/>
			</fileset>
		</copy-->
	</target>

	<target name="clean">
		<delete dir="build"/>
        <ant dir="file-signer" target="clean"/>
        <ant dir="APXS-file-signer" target="clean"/>
	</target>
	
	
	<target name="mk-output-dirs">
		<mkdir dir="build/classes"/>
		<mkdir dir="build/jars"/>
	</target>
        
    <target name="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="lib">
                <!-- exclude name="bc-jce-jdk13-129.jar"/ -->
                <exclude name="wizard.jar"/>
                <include name="*.jar"/>
            </fileset>
            <fileset dir="build/jars" includes="*.jar"/>
            <fileset dir="file-signer/build/jars" includes="*.jar"/>
            <fileset dir="APXS-file-signer/build/jars" includes="*.jar"/>
		</copy>
		<propertyfile file="${component.dir}/component.properties">
			<entry key="description" value="Plugin de signature de flux PES"/>
			<entry key="type" value="features-updates"/>
			<entry key="base.dest" value="${xemelios.prg}/root/tools/"/>
            <entry key="xmlsec-1.4.2.jar.dest" value="${xemelios.prg}/root/lib"/>
            <entry key="file-signer.jar.dest" value="${xemelios.prg}/root/lib"/>
            <entry key="jna.jar.dest" value="${xemelios.prg}/root/lib"/>
			<entry key="requires" value="${component.requires}"/>
		</propertyfile>
    </target>
	
	<target name="setup">
		<copy todir="../../build/setup/root/tools">
			<fileset dir="build/jars" includes="*.jar"/>
            <fileset dir="APXS-file-signer/build/jars" includes="*.jar"/>
            <fileset dir="lib">
                <include name="jna.jar"/>
                <include name="win32-x86.jar"/>
                <include name="xalan.jar"/>
            </fileset>
		</copy>
        <copy todir="../../build/setup/root/lib">
            <fileset dir="file-signer/build/jars" includes="*.jar"/>
            <fileset dir="lib">
                <include name="bc-jce-jdk13-129.jar"/>
                <include name="xmlsec-1.4.2.jar"/>
            </fileset>
        </copy>
	</target>

    <target name="compile-file-signer" depends="">
        <ant dir="file-signer" target="compile">
            <property name="element.name" value="file-signer"/>
        </ant>
    </target>

    <target name="jars-file-signer" depends="compile-file-signer">
        <ant dir="file-signer" target="jars">
            <property name="element.name" value="file-signer"/>
        </ant>
    </target>

    <target name="compile-APXS-file-signer" depends="">
        <ant dir="APXS-file-signer" target="compile">
            <property name="element.name" value="APXS-file-signer"/>
        </ant>
    </target>

    <target name="jars-APXS-file-signer" depends="compile-APXS-file-signer">
        <ant dir="APXS-file-signer" target="jars">
            <property name="element.name" value="APXS-file-signer"/>
        </ant>
    </target>


</project>
 
