<project name="linux-help" default="build">

    <property environment="ENV"/>
    <property name="languages" value="English,Danish,Dutch,French,Italian,Japanese,Spanish"/>

    <target name="copy">
        <mkdir dir="build"/>
        <copy todir="build">
            <fileset dir="../../lightcrafts/help" includes="**" excludes="*.txt"/>
            <fileset file="LightZone.hs"/>
            <fileset file="LightZone_*.hs"/>
        </copy>
        <copy todir="build/neutral">
            <fileset dir="neutral" includes="**"/>
        </copy>
        <copy todir="build/neutral/images">
            <fileset dir="images" includes="**"/>
        </copy>
        <apply executable="rsync" parallel="false">
            <arg value="-a"/>
            <arg value="build/neutral/"/>
            <dirset dir="build" includes="${languages}"/>
        </apply>
    </target>

    <target name="tidy">
        <apply executable="./tidyall.sh" parallel="false">
            <dirset dir="build" includes="${languages}"/>
        </apply>
    </target>

    <target name="index">
        <apply executable="./jhindexer.sh" parallel="false">
            <dirset dir="build" includes="${languages}"/>
        </apply>
    </target>

    <target name="jar">
        <jar jarfile="lightzonehelp.jar">
            <fileset dir="build" includes="**" excludes="neutral/**"/>
        </jar>
    </target>

    <target name="build">
        <antcall target="clean"/>
        <antcall target="copy"/>
        <!--antcall target="tidy"/-->
        <antcall target="index"/>
        <antcall target="jar"/>
        <copy todir="../products" file="lightzonehelp.jar"/>
    </target>

    <target name="run">
        <fail unless="ENV.JH_HOME" message="Please define JH_HOME"/>
        <java jar="${ENV.JH_HOME}/demos/bin/hsviewer.jar" fork="true">
            <arg line="-helpset ./lightzonehelp.jar"/>
        </java>
    </target>

    <target name="clean">
        <delete file="lightzonehelp.jar"/>
        <delete dir="build"/>
    </target>

</project>
