<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="ninja">
    <property name="dist" value="dev"/>

    <!--environment is broken for Win XP -->
    <!--property environment="env"/-->
    <property name="env.USERDOMAIN" value="cunix"/>
    <property location="/tmp" name="env.TMP"/>

    <property file="../properties/${env.USERDOMAIN}_${user.name}.properties"/>
    <property location="${env.TMP}/ninja" name="build"/>
    <property location="${www}/core" name="dist.dir"/>
    <property location="${dist.dir}/code" name="code.dir"/>
    <property location="${dist.dir}/code-dl" name="code-dl.dir"/>
    <taskdef classname="org.jini.rio.tools.ant.ClassDepTask" classpath="${src}\lib\ant-rio-ext.jar" name="classdep"/>

    <target depends="" name="dirs">
        <mkdir dir="${dist.dir}"/>
        <mkdir dir="${code.dir}"/>
        <mkdir dir="${code-dl.dir}"/>
    </target>

    <target depends="clean,jars" name="all">
        <!-- WRITEME -->
    </target>

    <target name="clean">
        <delete dir="${build}" failonerror="true" verbose="false"/>
    </target>
    <target depends="dirs" name="jars">
        <property name="class.dir" value="${build}"/>
        <path id="class.path">
            <pathelement path="${src}/lib/jini-core.jar"/>
            <pathelement path="${src}/lib/jini-ext.jar"/>
            <pathelement path="${src}/lib/sun-util.jar"/>
            <pathelement path="${src}/lib/rio-core.jar"/>
            <pathelement path="${src}/lib/reggie-dl.jar"/>
            <pathelement path="${src}/lib/servlet.jar"/>
        </path>
        <mkdir dir="${class.dir}"/>
        <javac classpathref="class.path" debug="false" destdir="${class.dir}" failonerror="true" includes="**/*.java" source="1.3" srcdir="${src}/net/jini/print" target="1.1"/>
        <javac classpathref="class.path" destdir="${class.dir}" failonerror="true" includes="**/*.java" source="1.3" srcdir="${src}/org/jpwg/jini/print" target="1.1"/>
        <javac classpath="" destdir="${class.dir}" failonerror="true" includes="**/*.java" source="1.3" srcdir="${src}/com/millipad/util" target="1.1"/>
        <!--javac classpathref="class.path" destdir="${class.dir}" failonerror="true" includes="**/*.java" source="1.3" srcdir="${src}/edu/columbia/reggie" target="1.1"/-->
        <javac classpathref="class.path" debug="true" debuglevel="lines,vars,source" depend="false" destdir="${class.dir}" failonerror="true" includes="**/*.java" source="1.3" srcdir="${src}/edu/columbia/print/ninja/core" target="1.1" verbose="false"/>
        <rmic base="${class.dir}" debug="true" verify="true">
            <classpath path="${class.dir}"/>
            <classpath refid="class.path"/>
        </rmic>

        <copy todir="${class.dir}/edu/columbia/print/ninja/core">
            <fileset dir="${src}/edu/columbia/print/ninja/core" id="changeme" includes="**/*.properties,**/*.ser"/>
        </copy>

        <classdep basedir="${class.dir}" compress="true" files="true" jarfile="${code.dir}/ninja.jar" manifest="MANIFEST.MF">
            <classpath>
                    <pathelement path="${class.dir}"/>
                    <pathelement path="${src}/lib/jini-core.jar"/>
                    <pathelement path="${src}/lib/jini-ext.jar"/>
                    <pathelement path="${src}/lib/serviceui.jar"/>
                    <pathelement path="${src}/lib/sun-util.jar"/>
                    <pathelement path="${src}/lib/rio-core.jar"/>
            </classpath>
            <out name="java"/>
            <out name="javax"/>
            <out name="sun"/>
            <element name="edu.columbia.print.ninja.core.service.Ninja"/>
            <element name="edu.columbia.print.ninja.core.service.RemotePrintServiceAdapter"/>
            <element name="com.millipad.util.RemoteBlockingStackImpl_Stub"/>
            <include name="edu/columbia/print/ninja/core/**/*.properties"/>
        </classdep>
        
        <classdep basedir="${class.dir}" compress="true" edges="false" files="true" jarfile="${code-dl.dir}/ninja-dl.jar" manifest="MANIFEST-DL.MF" outer="true">
            <classpath>
                    <pathelement path="${class.dir}"/>
                    <pathelement path="${src}/lib/jini-core.jar"/>
                    <pathelement path="${src}/lib/jini-ext.jar"/>
                    <pathelement path="${src}/lib/serviceui.jar"/>
                    <pathelement path="${src}/lib/sun-util.jar"/>
                    <pathelement path="${src}/lib/rio-core.jar"/>
            </classpath>
            <out name="java"/>
            <out name="javax"/>
            <out name="sun"/>

            <element name="net.jini.print.lookup.AttributeEntry"/>
            <element name="edu.columbia.print.ninja.core.AdminBean"/>
            <element name="edu.columbia.print.ninja.core.service.Ninja_Stub"/>
            <element name="edu.columbia.print.ninja.core.service.GenericLandlord_Stub"/>
            <element name="edu.columbia.print.ninja.core.service.RemotePrintServiceAdapter_Stub"/>
            <element name="edu.columbia.print.ninja.core.service.ListRequest_Stub"/>
            <element name="org.jpwg.jini.print.data.RmiInputStream$$BackendImpl_Stub"/>
            <include name="edu/columbia/print/ninja/core/**/*.properties"/>
        </classdep>

        <classdep basedir="${class.dir}" compress="true" edges="false" files="true" jarfile="${src}/edu/columbia/print/ninja/core/admin/WEB-INF/lib/ninja.jar" outer="true">
            <classpath>
                    <pathelement path="${class.dir}"/>
                    <pathelement path="${src}/lib/jini-core.jar"/>
                    <pathelement path="${src}/lib/jini-ext.jar"/>
                    <pathelement path="${src}/lib/serviceui.jar"/>
                    <pathelement path="${src}/lib/sun-util.jar"/>
                    <pathelement path="${src}/lib/rio-core.jar"/>
                    <pathelement path="${src}/lib/servlet.jar"/>
            </classpath>
            <out name="java"/>
            <out name="javax"/>
            <out name="sun"/>
            <element name="net.jini.print.lookup.AttributeEntry"/>
            <element name="edu.columbia.print.ninja.core.AdminBean"/>
            <element name="edu.columbia.print.ninja.core.service.Admin"/>
            <element name="edu.columbia.print.ninja.core.event.PrintQueueEvent"/>
            <include name="edu/columbia/print/ninja/core/*.properties"/>
        </classdep>
        
        <!--exec executable="${jdk.home}\bin\jarsigner">
            <arg value="-storepass"/>
            <arg value="password"/>
            <arg value="${code-dl.dir}\ninja-dl.jar"/>
            <arg value="atg"/>
        </exec-->
        <copy failonerror="true" file="${code-dl.dir}/ninja-dl.jar" todir="${src}/edu/columbia/print/ninja/prix/admin/WEB-INF/lib"/>

        <war basedir="${src}/edu/columbia/print/ninja/core/admin" compress="true" warfile="${code-dl.dir}/ninja.war" webxml="${src}/edu/columbia/print/ninja/core/admin/WEB-INF/web.xml">

        </war>
        
    </target>
</project>
