opale_to_pdf.ant 2.88 KB
Newer Older
Raphaël's avatar
Raphaël committed
1
2
3
4
5
6
7
<project name="ProjetOpale" default="convert">

	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="lib/ant-contrib.jar" />
		</classpath>
	</taskdef>
8

Raphaël's avatar
Raphaël committed
9
10
11
12
13
14
15
	<!-- Arguments properties -->
	<property name="DocType" 			value="paper" />
	<property name="Source" 			value="none" />
	<property name="InputPath" 			value="input" />

	<!-- Beginning -->
	<target name="convert">
16
		<antcall target="clean_everything" />
Raphaël's avatar
Raphaël committed
17
18
19
20
		<antcall target="opale_to_hdoc" />
		<antcall target="hdoc_to_pdf" />
		<antcall target="copy_pdf_output" />
	</target>
21

Raphaël's avatar
Raphaël committed
22
	<target name="clean_everything">
23
24
25
26
27
28
		<delete>
          <fileset dir="../opale_to_hdoc/input" excludes=".gitkeep"/>
          <fileset file="../opale_to_hdoc/output/result.hdoc"/>
          <fileset dir="../hdoc_to_pdf/input" excludes=".gitkeep"/>
          <fileset file="../hdoc_to_pdf/output/result.pdf"/>
        </delete>
Raphaël's avatar
Raphaël committed
29
	</target>
30

Raphaël's avatar
Raphaël committed
31
32
33
34
35
36
37
	<target name="opale_to_hdoc">

		<!--Check wether there is an input using command line or not-->
	    <if>
		  <equals arg1="${Source}" arg2="none" />
		  <then>
			<!--There is no input, check the input folder-->
38

Raphaël's avatar
Raphaël committed
39
40
41
			<echo message="The value of property InputFile is ${Source} ... Checking the input folder" />
			<echo message="The value of property DocType is ${DocType}" />
			<!-- get input hdoc file path -->
42
			<!--
Raphaël's avatar
Raphaël committed
43
44
45
46
			<fileset id="fileset_scar" dir="${InputPath}" casesensitive="yes">
				<include name="*.scar"/>
			</fileset>
			<pathconvert property="ScarFile" pathsep="" refid="fileset_scar" />
47
48
49
50
51
52
53
54
55
56
57
			-->

			<copy todir="../opale_to_hdoc/input">
				<fileset dir="${InputPath}" casesensitive="yes">
					<include name="*.scar"/>
				</fileset>
		  </copy>

			<!--<copy tofile="../opale_to_hdoc/input/sample.scar" file="${ScarFile}"/>-->

			<ant antfile="../opale_to_hdoc/opale_to_hdoc.ant" inheritAll="false"/>
Raphaël's avatar
Raphaël committed
58
59
60
		  </then>
		  <else>
			<!--There is an input-->
61

Raphaël's avatar
Raphaël committed
62
63
64
			<echo message="The value of property Source is ${Source}" />
			<echo message="The value of property DocType is ${DocType}" />
			<echo message="Executing conversion..." />
65

Raphaël's avatar
Raphaël committed
66
			<copy tofile="../opale_to_hdoc/input/sample.scar" file="${Source}"/>
67
68
			<ant antfile="../opale_to_hdoc/opale_to_hdoc.ant" inheritAll="false"/>

Raphaël's avatar
Raphaël committed
69
		  </else>
70
		</if>
Raphaël's avatar
Raphaël committed
71
	</target>
72

Raphaël's avatar
Raphaël committed
73
	<target name="hdoc_to_pdf">
74
75
76
77
78
79
		<!--<copy tofile="../hdoc_to_pdf/input/sample.hdoc" file="../opale_to_hdoc/output/result.hdoc"/>-->
		<copy todir="../hdoc_to_pdf/input">
			<fileset dir="../opale_to_hdoc/output" casesensitive="yes">
				<include name="*.hdoc"/>
			</fileset>
		</copy>
Raphaël's avatar
Raphaël committed
80
81
82
83
		<ant antfile="../hdoc_to_pdf/hdoc_to_pdf.ant" inheritAll="false">
			<property name="DocType" value="${DocType}"/>
		</ant>
	</target>
84

Raphaël's avatar
Raphaël committed
85
	<target name="copy_pdf_output">
86
87
88
89
90
91
		<!--<copy tofile="output/result.pdf" file="../hdoc_to_pdf/output/result.pdf"/>-->
		<copy todir="output">
			<fileset dir="../hdoc_to_pdf/output" casesensitive="yes">
				<include name="*.pdf"/>
			</fileset>
		</copy>
Raphaël's avatar
Raphaël committed
92
	</target>
93
94

</project>