<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- JBoss build file                                                       -->
<!-- ======================================================================= -->

<project name="JBoss" default="war" basedir=".">

   <property environment="env"/>
   <property name="src.dir" value="${basedir}/src"/>
   <property name="build.dir" value="${basedir}/build"/>
   <property name="build.classes.dir" value="${build.dir}/classes"/>
   <property name="lib.dir" value="../../../lib"/>
   <property name="conf.dir" value="../../../conf"/>

   <!-- Build classpath -->
   <path id="build.classpath">
      <!-- So that we can get jndi.properties for InitialContext and log4j.xml
   -->
      <fileset dir="${lib.dir}">
         <include name="*.jar"/>
      </fileset>
      <pathelement location="${conf.dir}"/>
   </path>

   <!-- =================================================================== -->
   <!-- Prepares the build directory                                        -->
   <!-- =================================================================== -->
   <target name="prepare">
      <mkdir dir="${build.dir}"/>
      <mkdir dir="${build.classes.dir}"/>
   </target>

   <!-- =================================================================== -->
   <!-- Compiles the source code                                            -->
   <!-- =================================================================== -->
   <target name="compile" depends="prepare">
      <javac srcdir="${src.dir}"
         destdir="${build.classes.dir}"
         debug="on"
         deprecation="on"
         optimize="off"
         includes="**">
         <classpath refid="build.classpath"/>
      </javac>
   </target>

   <target name="war" depends="compile">
      <jar jarfile="build/tutorial.jar">
         <fileset dir="${build.classes.dir}">
            <include name="**/*.class"/>
         </fileset>
         <fileset dir="resources">
            <include name="META-INF/persistence.xml"/>
         </fileset>
      </jar>
      <war warfile="${build.dir}/standalone.war"
         webxml="resources/web.xml">
         <lib dir="${lib.dir}">
            <include name="*.jar"/>
         </lib>
         <lib dir="${build.dir}">
            <include name="tutorial.jar"/>
         </lib>
         <classes dir="conf">
            <include name="*.xml"/>
         </classes>
         <classes dir="${conf.dir}">
            <include name="*.xml"/>
            <include name="*.properties"/>
         </classes>
         <fileset dir="src">
            <include name="EmbeddedEJB3.jsp"/>
         </fileset>
      </war>
   </target>

   <!-- =================================================================== -->
   <!-- Cleans up generated stuff                                           -->
   <!-- =================================================================== -->
   <target name="clean">
      <delete dir="${build.dir}"/>
   </target>


</project>

