<project name="Scheduler" default="compile" basedir=".">

  <!-- include compiled-servlet and tomcat-dir properties -->

  <property file="global.properties" />


  <property name="model" location="classes" /> 
  
<path id="servlet-classpath">
    <fileset dir="${tomcat.dir}/common/lib">
        <include name="*.jar" />
    </fileset>
    <fileset dir="${tomcat.dir}/common/endorsed">
        <include name="*.jar" />
    </fileset>
    <fileset dir="${junit.dir}/">
     <include name="${junit.jar}" />
    </fileset>
</path>

<target name="saywhat">
  <echo message="             Read README File First!" />
  <echo message="             -----------------------" />
  <echo message="clean:       Deletes and remakes the build and dist directories." />
  <echo message="compile:     Compiles the servlet controller and model classes." />
  <echo message="create-war:  Creates the WAR file." />
  <echo message="deploy:      Deploys the servlet from the development environment to deployment." />
  <echo message="saywhat:     This menu!." />
  <echo message="javadoc:     Generates the Javadoc for all files." /> 
  <echo message="deploy-doc:  Places the JavaDoc so it can be viewed on the web." />
  <!--<echo message="create-db:   Prompts you for your MySql password and runs the movies script no your database." />-->
</target>

<target name="compile">
    <echo message="Compiling the servlet...."/>
    <javac srcdir="${src}" destdir="${build}"
           includes="com/example/web/**,com/example/model/**"
           classpath="${tomcat.jar}"> 

    </javac>
</target>

<target name="clean">
  <echo message="Deleting and remaking the build and dist directories." />
  <delete dir="${build}" /> 
  <mkdir dir="${build}" /> 

  <delete dir="${dist}" /> 
  <mkdir dir="${dist}" /> 
 
</target>


<target name="create-war" description="creates war file" depends="clean, compile">
  <echo message="Creating ${web-app-name}.war" />

  <war destfile="${dist}/${web-app-name}.war" 
       webxml="${etc}/web.xml">
       <classes dir="${build}" />
       <!-- <lib dir="${lib}" -->
       <fileset dir="${web}" />
  </war>
</target>

<target name="deploy" description="deploys war file" depends="create-war">
  <echo message="Deploying war file ${web-app-name}.war" />

  <copy todir="${war.destination}">
    <fileset dir="${dist}">
      <include name="${web-app-name}.war" />
    </fileset>
  </copy>
</target>

<target name="javadoc">

  <delete dir="${javadoc.build}" />
  <mkdir dir="${javadoc.build}" />
  <javadoc
  packagenames="com.example.web.*,com.example.model.*"
  sourcepath="${src}" destdir="${javadoc.build}" author="true" version="true" use="true">
  <classpath refid="servlet-classpath" />
  </javadoc>

</target>

<target name="deploy-doc" depends="javadoc">

  <copy todir="${javadoc.destination}">
    <fileset dir="${javadoc.build}"/>
  </copy>

  <chmod perm="a+rx">
  <dirset dir="${javadoc.destination}" />
  <fileset dir="${javadoc.destination}" />
  </chmod>

</target>

<target name="create-db">
  <exec executable="mysql">
  <arg value=" --password=s157cl -u parise &lt; movies.sql" />
  </exec>
</target>

</project>
