wiki_to_canoprof_fetcher.ant 2.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?xml version="1.0" encoding="UTF-8"?>
<project name="wikiToCanoprof" default="main" basedir="..">
    
    <!-- Path -->
    <property name="resultPath"        value="${basedir}/result"/>
    <property name="hdoc_to_canoprof" location="${basedir}/../hdoc_to_canoprof"/>
    
    <target name="main">
        <antcall target="wiki_to_hdoc"/>
        <antcall target="move_output_hdoc_wikipediaToHdoc_into_input_hdocToCanoprof"/>
        <antcall target="hdoc_to_canoprof"/>
        <antcall target="move_output_hdocToCanoprof_into_ouput_wikipediaToCanoprof"/>
    </target>
    
    <target name="wiki_to_hdoc">
        <!-- First: wiki to Hdoc -->
        <ant antfile="../wikipedia_to_hdoc/ant/wiki_to_hdoc_fetcher.ant" dir="../wikipedia_to_hdoc"/>
    </target>
    
    <target name="move_output_hdoc_wikipediaToHdoc_into_input_hdocToCanoprof">
21 22
        <!-- copy .hdoc file from wikipedia_to_hdoc_result into input of hdoc_to_canoprof -->
        <delete dir="../hdoc_to_canoprof/input"/>
23
        <mkdir dir="../hdoc_to_canoprof/input"/>
24
        <copy todir="../hdoc_to_canoprof/input" file="../wikipedia_to_hdoc/result/${filename}/${filename}.hdoc"/>
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
		<mkdir dir="./testing_ant"/>
		<copy todir="./testing_ant" file="../wikipedia_to_hdoc/result/${filename}/${filename}.hdoc"/>
    </target>
    
    <target name="hdoc_to_canoprof">
        <!-- Mandatory ressource to use if conditions -->
        <taskdef resource="net/sf/antcontrib/antlib.xml">
            <classpath>
                <fileset dir="lib"/>
            </classpath>
        </taskdef>
        
        <!-- Check for family OS -->
        <condition property="is_windows">
            <os family="windows"/>
        </condition>
        
        <condition property="is_unix">
            <os family="unix"/>
        </condition>
        
        <antcall target="run_hdoc_to_canoprof_unix"/>
        <antcall target="run_hdoc_to_canoprof_windows"/>
    </target>
    
    <!-- Run hdoc_to_canoprof bat -->
    <target name="run_hdoc_to_canoprof_windows" if="${is_windows}"> 
52
        <exec executable="cmd" dir="${hdoc_to_canoprof}">
53 54
            <arg value="/c"/>
            <arg value="${hdoc_to_canoprof}/run.bat"/>
55
        </exec>
56 57 58 59
    </target>
    
    <!-- Run hdoc_to_canoprof sh -->
    <target name="run_hdoc_to_canoprof_unix" if="${is_unix}">
60
        <exec executable="/bin/bash" dir="${hdoc_to_canoprof}">
61
            <arg value="${hdoc_to_canoprof}/run.sh"/>
62
        </exec>
63 64 65
    </target>
    
    <target name="move_output_hdocToCanoprof_into_ouput_wikipediaToCanoprof">
66
        <copy todir="${resultPath}" failonerror="false">  
67
            <fileset dir="../hdoc_to_canoprof/output" includes="**"/>  
68
        </copy>
69 70
    </target>
</project>