mindmapping_to_canoprof.ant 8.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="default">
    <property name="module" value="default"/>
    <property name="in" location="${basedir}/input"/>
    <property name="out" value="${basedir}/output"/>
    <property name="resultFile" value="${basedir}/output"/>
    
    <taskdef resource="net/sf/antcontrib/antlib.xml">
        <classpath>
            <pathelement location="${basedir}/lib/ant-contrib.jar"/>
        </classpath>
    </taskdef>
    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
        <classpath>
            <pathelement location="${basedir}/lib/ant-contrib.jar"/>
        </classpath>
    </taskdef>
    
    
    <target name="default" depends="preparation">
        <echo>----------------------------Begin of
            conversion----------------------------------</echo>
        
        <antcall target="conversion"/>
        
        <echo>----------------------------End of conversion----------------------------------</echo>
    </target>
    
    <target depends="ifOSWindows, ifOSUnix" name="conversion"/>
    
    <condition property="isOSUnix">
        <os family="unix" />
    </condition>
    
    <condition property="isOSWindows">
        <os family="windows" />
    </condition>
    
    <!-- if the OS is windows call the target run.script.windows -->
    <target name="ifOSWindows" if="isOSWindows">
        <echo>is Windows........</echo>
        <echo>InputPath : ${inputPath}</echo>
        <if>
            <isset property="inputPath"/>
            <then>
                <antcall target="conversion.windows.input-path"/>
            </then>
            <else>
                <antcall target="conversion.windows.no-input-path"/>
            </else>
        </if>
    </target>
    
    <!-- if the OS is not windows call the target run.script.unix-->
    <target name="ifOSUnix" if="isOSUnix">
        <echo>is Unix........</echo>
        <echo>InputPath : ${inputPath}</echo>
        <if>
            <isset property="inputPath"/>
            <then>
                <antcall target="conversion.linux.input-path"/>
            </then>
            <else>
                <antcall target="conversion.linux.no-input-path"/>
            </else>
        </if>
    </target>
    
    <target name="conversion.windows.input-path">
        <basename property="filename" file="${inputPath}" suffix=".mm"/>
        <echo>There is an input path in parameter : conversion of this file</echo>
        <!-- Conversion from mm to hdoc -->
        <exec dir="${basedir}/../mindmapping_to_hdoc" executable="cmd">
            <arg value="${basedir}/../mindmapping_to_hdoc/run.bat"/>
            <arg line="-DinputPath ./../mindmapping_to_canoprof/input/${filename}.mm"/>
        </exec>
        <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${resultFile}/hdoc"/>
        <!-- Conversion from hdoc to scar -->
        <!-- Files have to be copied in hdoc_to_canoprof in order to be treated -->
        <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${basedir}/../hdoc_to_canoprof/input"/>
        <exec dir="${basedir}/../hdoc_to_canoprof" executable="cmd">
            <arg value="${basedir}/../hdoc_to_canoprof/run.bat"/>
        </exec>
        <copy todir="${resultFile}/scar/${filename}">
            <fileset dir="${basedir}/../hdoc_to_canoprof/output/${filename}"/>
        </copy>
    </target>
    
    <target name="conversion.windows.no-input-path">
        <echo>There is no input path in parameter : conversion of all the files in ./input</echo>
        <for param="inputFile">
            <path>
                <fileset dir="${in}" includes="**/*.mm"/>
            </path>
            <sequential>
                <local name="filename"/>
                <basename property="filename" file="@{inputFile}" suffix=".mm"/>
                <!-- Conversion from mm to hdoc -->
                <!-- Conversion script is call with the file in parameter (no copy of files in minmapping_to_hdoc) -->
                <exec dir="${basedir}/../mindmapping_to_hdoc" executable="cmd">
                    <arg value="${basedir}/../mindmapping_to_hdoc/run.bat"/>
                    <arg line="-DinputPath ./../mindmapping_to_canoprof/input/${filename}.mm"/>
                </exec>
                <property name="filename" value="${filename}"/>
                <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${resultFile}/hdoc"/>
                <!-- Conversion from hdoc to scar -->
                <!-- Files have to be copied in hdoc_to_canoprof in order to be treated -->
                <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${basedir}/../hdoc_to_canoprof/input"/>
                <exec dir="${basedir}/../hdoc_to_canoprof" executable="cmd">
                    <arg value="${basedir}/../hdoc_to_canoprof/run.bat"/>
                </exec>
                <copy todir="${resultFile}/scar/${filename}">
                    <fileset dir="${basedir}/../hdoc_to_canoprof/output/${filename}"/>
                </copy>
            </sequential>
        </for>
    </target>
    
    <target name="conversion.linux.input-path">
        <basename property="filename" file="${inputPath}" suffix=".mm"/>
        <echo>There is an input path in parameter : conversion of the file ${inputPath}</echo>
        <!-- Conversion from mm to hdoc -->
        <exec dir="${basedir}/../mindmapping_to_hdoc" executable="/bin/sh">
            <arg value="${basedir}/../mindmapping_to_hdoc/run.sh"/>
            <arg line="-DinputPath ./../mindmapping_to_canoprof/input/${filename}.mm"/>
        </exec>
        <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${resultFile}/hdoc"/>
        <!-- Conversion from hdoc to scar -->
        <!-- Files have to be copied in hdoc_to_canoprof in order to be treated -->
        <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${basedir}/../hdoc_to_canoprof/input"/>
        <exec dir="${basedir}/../hdoc_to_canoprof" executable="/bin/sh">
            <arg value="${basedir}/../hdoc_to_canoprof/run.sh"/>
        </exec>
        <copy todir="${resultFile}/scar/${filename}">
            <fileset dir="${basedir}/../hdoc_to_canoprof/output/${filename}"/>
        </copy>
    </target>
    
    <target name="conversion.linux.no-input-path">
        <echo>There is no input path in parameter : conversion of all the files in ./input</echo>
        <for param="inputFile">
            <path>
                <fileset dir="${in}" includes="**/*.mm"/>
            </path>
            <sequential>
                <local name="filename"/>
                <basename property="filename" file="@{inputFile}" suffix=".mm"/>
                <!-- Conversion from mm to hdoc -->
                <!-- Conversion script is call with the file in parameter (no copy of files in minmapping_to_hdoc) -->
                <exec dir="${basedir}/../mindmapping_to_hdoc" executable="/bin/sh">
                    <arg value="${basedir}/../mindmapping_to_hdoc/run.sh"/>
                    <arg line="-DinputPath ./../mindmapping_to_canoprof/input/${filename}.mm"/>
                </exec>
                <property name="filename" value="${filename}"/>
                <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${resultFile}/hdoc"/>
                <!-- Conversion from hdoc to scar -->
                <!-- Files have to be copied in hdoc_to_canoprof in order to be treated -->
                <copy file="${basedir}/../mindmapping_to_hdoc/output/${filename}.hdoc" todir="${basedir}/../hdoc_to_canoprof/input"/>
                <exec dir="${basedir}/../hdoc_to_canoprof" executable="/bin/sh">
                    <arg value="${basedir}/../hdoc_to_canoprof/run.sh"/>
                </exec>
                <copy todir="${resultFile}/scar/${filename}">
                    <fileset dir="${basedir}/../hdoc_to_canoprof/output/${filename}"/>
                </copy>
            </sequential>
        </for>
    </target>
    
    <target name="preparation">
        <echo>Setting up the conversion</echo>
        <delete dir="${basedir}/temp"/>
        <mkdir dir="${basedir}/temp"/>
        <delete dir="${basedir}/output"/>
        <mkdir dir="${basedir}/output"/>
        <delete dir="${resultFile}/hdoc"></delete>
        <mkdir dir="${resultFile}/hdoc" />
        <delete dir="${resultFile}/scar"></delete>
        <mkdir dir="${resultFile}/scar" />
        <echo>--- End ----</echo>
    </target>
    
</project>