canoprof_to_hdoc.ant 2.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
<project name="ProjetOpale" default="convert" xmlns:if="ant:if"
    xmlns:unless="ant:unless">

    <property file="canoprof_to_hdoc.properties" />

    <!-- Main target -->
    <target name="convert">
        <antcall target="init" />
        <antcall target="unzip_scar" />
        <antcall target="process_canoscar"/>
11
		<antcall target="not_canoscar"/>
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
        <echo message="OK" file="${out}/testfile"/>
        <antcall target="zip" />
        <antcall target="clean"/>
        
    </target>
    
    
    <!-- Initialize folders -->
    <target name="init">
        <!-- create folders (to be sure) -->
        <mkdir dir="${unzipfolder}"/>
        <mkdir dir="${tmp}"/>
        <mkdir dir="${out}"/>
        <touch file="get_ressources.ant"/>
    </target>
    
    <!-- Clean : delete old files -->
    <target name="clean">
        <!-- delete folders -->
        <delete dir="${unzipfolder}"/>
        <delete dir="${tmp}"/>
        <delete file="get_ressources.ant"/>
    </target>
    
    <!-- Check if the scar input is a Canoprof one or not -->
    <target name="check_scar">
        <xmlproperty semanticattributes="true" file="${unzipfolder}/.wspmeta" keeproot="true"/>
        <condition property="canoprof.is_canoprof_scar">
            <equals arg1="${wspType.defaultCode}" arg2="${canoprof_code}"/>
        </condition>
    </target>
    
    
    <target name="process_canoscar" depends="check_scar" if="${canoprof.is_canoprof_scar}">
        <!-- TODO traitement du fichier -->
47
        <echo file="${out}/scar_cano_or_not_scar_cano.txt" message="C'est un scar canoprof"/>
48 49
    </target>
    
50 51 52 53
	<target name="not_canoscar" depends="check_scar" unless="${canoprof.is_canoprof_scar}">
        <echo file="${out}/scar_cano_or_not_scar_cano.txt" message="Ce n'est pas un scar canoprof"/>
    </target>
	
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    <!-- Unzip the scar -->
    <target name="unzip_scar">
        <!-- get scar file path -->
        <fileset id="fileset_scar" dir="input" casesensitive="yes">
            <include name="*.scar"/>
        </fileset>
        <pathconvert property="scar.path" pathsep="" refid="fileset_scar" />
        <unzip src="${scar.path}" dest="${unzipfolder}"/>
    </target>
    
    <!-- Zip the final content into a scar file -->
    <target name="zip">
        <!-- TODO zip the output files -->
    </target>
</project>