Commit 9870e0e3 authored by Jean-Baptiste Martin's avatar Jean-Baptiste Martin

Ant script now can be run on multiple OS

parent 355e15ff
...@@ -21,10 +21,23 @@ ...@@ -21,10 +21,23 @@
</taskdef> </taskdef>
<!-- CHECK FOR WINDOWS FAMILY OS -->
<condition property="is_windows">
<os family="windows"/>
</condition>
<condition property="is_unix">
<os family="unix"/>
</condition>
<!-- Main target --> <!-- Main target -->
<target name="main"> <target name="main">
<antcall target="clean"/> <antcall target="clean"/>
<!-- Check that the input directory is not empty -->
<if> <if>
<length length="0" when="greater"> <length length="0" when="greater">
<fileset dir="${in}" followsymlinks="false"/> <fileset dir="${in}" followsymlinks="false"/>
...@@ -53,6 +66,8 @@ ...@@ -53,6 +66,8 @@
<!-- optim_to_hdoc -->
<!-- Moves files in optim_to_hdoc hierarchy --> <!-- Moves files in optim_to_hdoc hierarchy -->
<target name="prepare_optim_to_hdoc"> <target name="prepare_optim_to_hdoc">
<antcall target="add_log"> <antcall target="add_log">
...@@ -66,9 +81,37 @@ ...@@ -66,9 +81,37 @@
<!-- Simply run optim_to_hdoc script --> <!-- Simply run optim_to_hdoc script -->
<target name="run_optim_to_hdoc"> <target name="run_optim_to_hdoc">
<antcall target="run_optim_to_hdoc_unix"/>
<antcall target="run_optim_to_hdoc_windows"/>
</target> </target>
<!-- Run optim_to_hdoc bat -->
<target name="run_optim_to_hdoc_windows" if="${is_windows}">
<antcall target="add_log">
<param name="msg" value="Running optim_to_hdoc bat script"/>
</antcall>
<exec executable="cmd">
<arg value="${optim_to_hdoc}/run.bat"/>
</exec>
</target>
<!-- Run optim_to_hdoc sh -->
<target name="run_optim_to_hdoc_unix" if="${is_unix}">
<antcall target="add_log">
<param name="msg" value="Running optim_to_hdoc shell script"/>
</antcall>
<exec executable="/bin/bash">
<arg value="${optim_to_hdoc}/run.sh"/>
</exec>
</target>
<!-- hdoc_to_opale -->
<!-- Moves files in hdoc_to_opale hierarchy --> <!-- Moves files in hdoc_to_opale hierarchy -->
<target name="prepare_hdoc_to_opale"> <target name="prepare_hdoc_to_opale">
<antcall target="add_log"> <antcall target="add_log">
...@@ -81,7 +124,32 @@ ...@@ -81,7 +124,32 @@
</target> </target>
<!-- Simply run hdoc_to_opale script --> <!-- Simply run hdoc_to_opale script -->
<target name="run_hdoc_to_opale"></target> <target name="run_hdoc_to_opale">
<antcall target="run_hdoc_to_opale_unix"/>
<antcall target="run_hdoc_to_opale_windows"/>
</target>
<!-- Run hdoc_to_opale bat -->
<target name="run_hdoc_to_opale_windows" if="${is_windows}">
<antcall target="add_log">
<param name="msg" value="Running hdoc_to_opale bat script"/>
</antcall>
<exec executable="cmd">
<arg value="${hdoc_to_opale}/run.bat"/>
</exec>
</target>
<!-- Run hdoc_to_opale sh -->
<target name="run_hdoc_to_opale_unix" if="${is_unix}">
<antcall target="add_log">
<param name="msg" value="Running hdoc_to_opale shell script"/>
</antcall>
<exec executable="/bin/bash">
<arg value="${hdoc_to_opale}/run.sh"/>
</exec>
</target>
<!-- Move files to the outut directory --> <!-- Move files to the outut directory -->
<target name="output_files"> <target name="output_files">
...@@ -95,6 +163,12 @@ ...@@ -95,6 +163,12 @@
</target> </target>
<!-- Some basic functions -->
<!-- Print a line both on screen and in log/execution.log file -->
<target name="add_log"> <target name="add_log">
<tstamp> <tstamp>
<format property="now" pattern="HH:mm:ss:sss" locale="fr,FR"/> <format property="now" pattern="HH:mm:ss:sss" locale="fr,FR"/>
...@@ -104,7 +178,7 @@ ...@@ -104,7 +178,7 @@
<echo message="${msg}"/> <echo message="${msg}"/>
</target> </target>
<!-- Cleaning directories -->
<target name="clean"> <target name="clean">
<delete dir="${log}" failonerror="false"/> <delete dir="${log}" failonerror="false"/>
<mkdir dir="${log}"/> <mkdir dir="${log}"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment