<?xml version="1.0" encoding="UTF-8"?>
<!-- Builds the "JHotDraw BezierDemo" demo application and demo applet. -->
<project name="build-TSCCDemo" default="all" basedir=".">
    <target name="init">
        <property name="lib" value="lib"/>
        <property name="src" value="src/main"/>
        <property name="src.jmf" value="src/main.jmf"/>
        <property name="rsrc" value="resources"/>
        <property name="build" value="build"/>
        <property name="classes" value="${build}/classes"/>
        <property name="author" value="Werner Randelshofer"/>
        <property name="version" value="0.5"/>
        <property name="versionDate" value="2012-03-28"/>
        <property name="versionLong" value="${version} ${versionDate}"/>
        <property name="dist" value="dist"/>
    </target>
    <target name="clean" depends="init">
        <delete dir="${classes}" />
        <delete dir="${dist}/TSCCDemo ${version}" />
    </target>
    <target name="application.compile" depends="init,clean">
        <mkdir dir="${classes}"/>
        <javac
                destdir="${classes}"
                srcdir="${src}:${src.jmf}"
                debug="true"
                source="1.5"
                target="1.5"
                optimize="true"
                encoding="UTF-8"
                includeantruntime="false"
         >
            <include name="org/monte/media/jmf/codec/video/TSCCCodec.java"/> 
            <include name="org/monte/jmfavidemo/Main.java"/> 
            <include name="org/monte/jmftsccdemo/Main.java"/> 
            <classpath>
                <fileset dir="${lib}">
                    <include name="jmf.jar"/>
                </fileset>
            </classpath>
        </javac>
        <copy todir="${classes}">
            <fileset dir="${src}" >
                <include name="org/monte/media/avi/TechSmithCodecCore.java"/>
                <include name="org/monte/media/io/ByteArrayImageInputStream.java"/>
                <include name="org/monte/media/io/ByteArrayImageOutputStream.java"/>
                <include name="org/monte/media/io/ImageInputStreamImpl2.java"/>
                <include name="org/monte/media/io/ImageInputStreamAdapter.java"/>
                <include name="org/monte/media/io/SeekableByteArrayOutputStream.java"/>
                <include name="org/monte/media/io/UncachedImageInputStream.java"/>
                <include name="org/monte/media/AbstractVideoCodecCore.java"/>
                <exclude name="**/.*"/>
            </fileset>
            <fileset dir="${src.jmf}" >
                <include name="org/monte/jmfavidemo/Main.java"/>
                <include name="org/monte/jmftsccdemo/Main.java"/>
                <include name="org/monte/media/jmf/codec/video/AbstractVideoDecoder.java"/>
                <include name="org/monte/media/jmf/codec/video/TSCCCodec.java"/>
                <include name="org/monte/media/jmf/codec/AbstractCodec.java"/>
                <exclude name="**/.*"/>
            </fileset>
        </copy>
    </target>
    <target name="application.jar" depends="init,application.compile">
        <mkdir dir="${dist}/TSCCDemo ${version}"/>
        <copy file="${rsrc}/tsccdemo_license.html" tofile="${classes}/license.html" />
        <jar destfile="${dist}/TSCCDemo ${version}/TSCCDemo.jar" basedir="${classes}">
            <manifest>
                <attribute name="Built-By" value="${author}"/>
                <attribute name="Main-Class" value="org.monte.jmftsccdemo.Main"/>
                <attribute name="Class-Path" value="jmf.jar"/>
                <attribute name="Implementation-Version" value="${versionLong}"/>
            </manifest>
        </jar>
    </target>
    <target name="application.run-jar" depends="init">
        <java fork="true" jar="${dist}/TSCCDemo ${version}/TSCCDemo.jar">
            <jvmarg value="-Xdock:name=TSCCDemo"/>
            <jvmarg value="-Dlocale=en"/>
            <jvmarg value="-Dapple.awt.graphics.UseQuartz=false"/>
            <jvmarg value="-Djava.library.path=${lib}"/>
        </java>
    </target>
    <target name="dist" depends="init,application.jar">
        <copy file="${lib}/jmf.jar" todir="${dist}/TSCCDemo ${version}"/>
        <copy file="${lib}/jmf.properties" todir="${dist}/TSCCDemo ${version}"/>
        <zip destfile="${dist}/tsccdemo-${version}.zip">
         <fileset dir="${dist}">
             <include name="TSCCDemo ${version}/**"/>
             <exclude name="**/.*"/>
         </fileset>   
        </zip>
    </target>
</project>
