opale_to_pdf.ant 2.34 KB
Newer Older
Raphaël's avatar
Raphaël committed
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
<project name="ProjetOpale" default="convert">

	<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="lib/ant-contrib.jar" />
		</classpath>
	</taskdef>
	
	<!-- Arguments properties -->
	<property name="DocType" 			value="paper" />
	<property name="Source" 			value="none" />
	<property name="InputPath" 			value="input" />

	<!-- Beginning -->
	<target name="convert">
		<antcall target="clean_everything" />	  	
		<antcall target="opale_to_hdoc" />
		<antcall target="hdoc_to_pdf" />
		<antcall target="copy_pdf_output" />
	</target>
	
	<target name="clean_everything">
		<delete dir="../opale_to_hdoc/input"/>
		<delete dir="../opale_to_hdoc/output/result.hdoc"/>
		<delete dir="../hdoc_to_pdf/input"/>
		<delete dir="../hdoc_to_pdf/output/result.pdf"/>
	</target>
	
	<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-->
			
			<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 -->
			<fileset id="fileset_scar" dir="${InputPath}" casesensitive="yes">
				<include name="*.scar"/>
			</fileset>
			<pathconvert property="ScarFile" pathsep="" refid="fileset_scar" />
			
			<copy tofile="../opale_to_hdoc/input/sample.scar" file="${ScarFile}"/>
			<ant antfile="../opale_to_hdoc/opale_to_hdoc.ant" inheritAll="false"/>		
		  </then>
		  <else>
			<!--There is an input-->
			
			<echo message="The value of property Source is ${Source}" />
			<echo message="The value of property DocType is ${DocType}" />
			<echo message="Executing conversion..." />
		
			<copy tofile="../opale_to_hdoc/input/sample.scar" file="${Source}"/>
			<ant antfile="../opale_to_hdoc/opale_to_hdoc.ant" inheritAll="false"/>	
			
		  </else>
		</if>   
	</target>
	
	<target name="hdoc_to_pdf">
		<copy tofile="../hdoc_to_pdf/input/sample.hdoc" file="../opale_to_hdoc/output/result.hdoc"/>
		<ant antfile="../hdoc_to_pdf/hdoc_to_pdf.ant" inheritAll="false">
			<property name="DocType" value="${DocType}"/>
		</ant>
	</target>
	
	<target name="copy_pdf_output">
		<copy tofile="output/result.pdf" file="../hdoc_to_pdf/output/result.pdf"/>
	</target>
	
</project>