<project name="benow-imdb" default="compile" basedir=".">

  <property name="app.name"      value="benow-imdb"/>
  <property name="short.name"    value="benow-imdb"/>
  <property name="app.version"   value="1.0"/>

  <property file="/etc/benow/build.properties"/>
  <property file="etc/build.properties"/>


  <path id="compile.classpath">

    <!-- Include all JAR files that will be included in /WEB-INF/lib -->
    <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** 
    <pathelement location="${benow-util.jar}"/>
    -->

    <!-- Include all needed jars -->
    <fileset dir="${lib.home}">
      <include name="*.jar"/>
    </fileset>
    <fileset dir="${lib.home}/linux/i386">
      <include name="*.jar"/>
    </fileset>
  </path>

  <target name="all" depends="clean,jar"
   description="Clean build and dist, then compile"/>

  <target name="clean"
   description="Delete old build and dist directories">
    <delete dir="${build.home}"/>
    <delete dir="${dist.home}"/>
    <delete>
      <fileset dir="." includes="**/*~" defaultexcludes="no"/>
    </delete>
  </target>


  <target name="compile" depends="prepare"
   description="Compile Java sources">

    <!-- Compile Java classes as necessary -->
    <javac srcdir="src"
          destdir="${build.home}"
           debug="${compile.debug}"
	   nowarn="${compile.nowarn}"
        deprecation="${compile.deprecation}"
        optimize="${compile.optimize}">
        <classpath refid="compile.classpath"/>
    </javac>

  </target>

  <target name="rmi_deploy" depends="compile"
   description="Compile Java sources">

    <rmic classname="org.benow.security.SecurityAdministratorImpl" base="build">
      <classpath refid="compile.classpath"/>
    </rmic>

	<mkdir  dir="rmi_deploy/org/benow/security/"/>
    <copy todir="rmi_deploy/org/benow/security/">
	  <fileset dir="build/org/benow/security/"/>
    </copy>

  </target>



  <target name="dist" depends="jar,javadoc"
   description="Create binary distribution">
    <mkdir dir="docs"/>

    <!-- Copy documentation subdirectory -->
    <copy    todir="${dist.home}/docs">
      <fileset dir="docs"/>
    </copy>

  </target>

  <target name="jar" depends="compile"
   description="Create binary distribution">
    <mkdir dir="${lib.home}"/>

    <delete file="${short.name}.jar"/>

    <!-- Update jar file -->
    <jar jarfile="${short.name}.jar" 
      basedir="${build.home}"
      update="yes"
    />
    

  </target>



<!-- ==================== Javadoc Target ================================== -->

<!--

  The "javadoc" target creates Javadoc API documentation for the Java
  classes included in your application.  Normally, this is only required
  when preparing a distribution release, but is available as a separate
  target in case the developer wants to create Javadocs independently.

-->

  <target name="javadoc" depends="compile"
   description="Create Javadoc API documentation">

    <mkdir          dir="${dist.home}/docs/api"/>
    <javadoc sourcepath="src"
                destdir="${dist.home}/docs/api"
           packagenames="org.benow.*">
      <link href="http://benow.ca/docs/benow/util/api"/>
      <link href="http://benow.ca/docs/benow/repository/api/"/>
      <classpath refid="compile.classpath"/>
    </javadoc> 

  </target>



<!-- ==================== Prepare Target ================================== -->

<!--

  The "prepare" target is used to create the "build" destination directory,
  and copy the static contents of your web application to it.  If you need
  to copy static files from external dependencies, you can customize the
  contents of this task.

  Normally, this task is executed indirectly when needed.

-->

  <target name="prepare">

    <!-- Create build directory and copy static content -->
    <mkdir  dir="${build.home}"/>

    <!-- Copy static files from external dependencies as needed -->

  </target>

</project>
