wiki_to_canoprof.ant 3.18 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="wikiToCanoprof" default="main" basedir="..">
    
    <!-- inputFile is the only required parameter to run the script -->
    <property name="inputFile"               value="input/source.xml"/>
    
    <!-- Name of the output file -->
    <basename property="filename"            file="${inputFile}" suffix=".xml"/>
    
    <!-- Path -->
    <property name="resultPath"        value="${basedir}/result"/>
    <property name="hdoc_to_canoprof" location="${basedir}/../hdoc_to_canoprof"/>
    
    <target name="main">
        <antcall target="move_input_xml_wikipediaToCanoprof_into_input_wikipediaToHdoc"/>
        <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="move_input_xml_wikipediaToCanoprof_into_input_wikipediaToHdoc">
        <copy todir="../wikipedia_to_hdoc/input" file="input/source.xml"/> 
    </target>
    
    <target name="wiki_to_hdoc">
        <!-- First: wiki to Hdoc -->
        <ant antfile="../wikipedia_to_hdoc/ant/wiki_to_hdoc.ant" dir="../wikipedia_to_hdoc"/>
    </target>
    
    <target name="move_output_hdoc_wikipediaToHdoc_into_input_hdocToCanoprof">
        <!--copy .hdoc file from wikipedia_to_hdoc_result into input of hdoc_to_canoprof -->
33
        <delete dir="../hdoc_to_canoprof/input"/>
34
        <mkdir dir="../hdoc_to_canoprof/input"/>
35
        <copy todir="../hdoc_to_canoprof/input" file="../wikipedia_to_hdoc/result/${filename}/${filename}.hdoc"/>
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
		<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}"> 
63
        <exec executable="cmd" dir="${hdoc_to_canoprof}">
64
65
            <arg value="/c"/>
            <arg value="${hdoc_to_canoprof}/run.bat"/>
66
        </exec>
67
68
69
70
    </target>
    
    <!-- Run hdoc_to_canoprof sh -->
    <target name="run_hdoc_to_canoprof_unix" if="${is_unix}">
71
        <exec executable="/bin/bash" dir="${hdoc_to_canoprof}">
72
            <arg value="${hdoc_to_canoprof}/run.sh"/>
73
        </exec>
74
75
76
    </target>
    
    <target name="move_output_hdocToCanoprof_into_ouput_wikipediaToCanoprof">
77
        <copy todir="${resultPath}" failonerror="false">  
78
            <fileset dir="../hdoc_to_canoprof/output" includes="**"/>  
79
        </copy>
80
81
    </target>
</project>