opale_to_pdf.ant 3.11 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
		<antcall target="opale_to_hdoc" />
		<antcall target="hdoc_to_pdf" />
		<antcall target="copy_pdf_output" />
20
		<antcall target="clean_everything_after" />
Raphaël's avatar
Raphaël committed
21
	</target>
22

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

Raphaël's avatar
Raphaël committed
30 31 32 33 34 35 36
	<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-->
37

Raphaël's avatar
Raphaël committed
38 39 40
			<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 -->
41
			<!--
Raphaël's avatar
Raphaël committed
42 43 44 45
			<fileset id="fileset_scar" dir="${InputPath}" casesensitive="yes">
				<include name="*.scar"/>
			</fileset>
			<pathconvert property="ScarFile" pathsep="" refid="fileset_scar" />
46 47 48 49 50 51 52 53 54 55 56
			-->

			<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
57 58 59
		  </then>
		  <else>
			<!--There is an input-->
60

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

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

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

Raphaël's avatar
Raphaël committed
72
	<target name="hdoc_to_pdf">
73 74 75 76 77 78
		<!--<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
79 80 81 82
		<ant antfile="../hdoc_to_pdf/hdoc_to_pdf.ant" inheritAll="false">
			<property name="DocType" value="${DocType}"/>
		</ant>
	</target>
83

Raphaël's avatar
Raphaël committed
84
	<target name="copy_pdf_output">
85 86 87 88 89 90
		<!--<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
91
	</target>
92

93 94 95 96 97 98 99 100 101
	<target name="clean_everything_after">
		<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>
	</target>

102
</project>