<?xml version="1.0" encoding="windows-1252" ?>
<!-- Ant Buildfile for SRDemoSample-->
<!--$Id: build.xml,v 1.11 2006/06/06 15:06:53 steve Exp $-->
<project default="usage" basedir=".">
  <property file="build.properties"/>
  
  <!-- various key directories -->
  <property name="dist.dir" value="${srdemo.home}/dist"/>
  <property name="doc.dir" value="${srdemo.home}/doc"/>  
  <property name="temp.dir" value="temp"/>  
  
  <property name="model.home.dir" value="${srdemo.home}/DataModel"/>    
  <property name="model.src.dir" value="${model.home.dir}/src"/>  
  <property name="model.build.dir" value="${model.home.dir}/classes"/>  

  <property name="fwkext.home.dir" value="${srdemo.home}/FrameworkExtensions"/>    
  <property name="fwkext.src.dir" value="${fwkext.home.dir}/src"/>  
  <property name="fwkext.build.dir" value="${fwkext.home.dir}/classes"/>
  <property name="fwkext.deploy.dir" value="${fwkext.home.dir}/deploy"/>
  
  
  <property name="view.home.dir" value="${srdemo.home}/UserInterface"/>      
  <property name="view.src.dir" value="${view.home.dir}/src"/>   
  <property name="view.build.dir" value="${view.home.dir}/classes"/> 

  <property name="tests.home.dir" value="${srdemo.home}/UnitTests"/>        
  <property name="tests.src.dir" value="${tests.home.dir}/src"/>   
  <property name="tests.build.dir" value="${tests.home.dir}/classes"/>  
  <property name="tests.reporting.dir" value="${tests.home.dir}/output"/>  

  <property name="runtime.config.home.dir" value="${srdemo.home}/ConfigurationData"/>  
  <property name="runtime.config.src.dir" value="${runtime.config.home.dir}/src"/>
  <property name="runtime.config.build.dir" value="${runtime.config.home.dir}/classes"/>
     
  
  <!-- Various library homes -->
  <property name="adfm.lib"     value="${jdeveloper.home}/bc4j/lib"/>
  <property name="adfbc.lib"     value="${jdeveloper.home}/bc4j/lib"/>  
  <property name="jdbc.lib"     value="${jdeveloper.home}/jdbc/lib"/>  
  <property name="adfbcdt.lib"  value="${jdeveloper.home}/jdev/extensions"/>
  <property name="ide.lib"      value="${jdeveloper.home}/ide/lib"/>
  <property name="jewt.lib"      value="${jdeveloper.home}/jlib"/>
  <property name="junit.lib"     value="${jdeveloper.home}/jdev/extensions/oracle.jdeveloper.junit.10.1.3/junit3.8.1"/>   
  <property name="j2ee.lib"       value="${jdeveloper.home}/j2ee/home/lib"/> 
  <property name="jazn.lib"   value="${jdeveloper.home}/j2ee/home"/> 
  <property name="jdbc.lib"      value="${jdeveloper.home}/jdbc/lib"/>
  <property name="jsf.lib"       value="${jdeveloper.home}/jsf-ri"/>
  <property name="adf-faces.lib" value="${jdeveloper.home}/jlib"/>
  <property name="adfc.lib"      value="${jdeveloper.home}/adfc/lib"/>
  <property name="jdevcm.lib"    value="${jdeveloper.home}/jlib"/>
  <property name="jlib.lib"      value="${jdeveloper.home}/jlib"/>  
  
  <path id="all.sources">
    <pathelement path="${model.src.dir}"/>
    <pathelement path="${tests.src.dir}"/>    
    <pathelement path="${view.src.dir}"/>
    <pathelement path="${fwkext.src.dir}"/>    
  </path>
  
  <path id="model.build.classpath">
    <pathelement location="${fwkext.build.dir}"/>
    <pathelement location="${runtime.config.build.dir}"/>
    <fileset dir="${adfm.lib}">
        <include name="adfm.jar"/>
    </fileset>
    <fileset dir="${adfbc.lib}">
        <include name="bc4jmt.jar"/>
        <include name="bc4jct.jar"/>
        <include name="bc4jdomorcl.jar"/>
        <include name="collections.jar"/>
    </fileset>
    <fileset dir="${jdbc.lib}">
        <include name="ojdbc14.jar"/>
    </fileset>  
  </path>

  <path id="fwkext.build.classpath">
    <fileset dir="${jewt.lib}">
        <include name="jewt4.jar"/>
    </fileset>
    <fileset dir="${ide.lib}">
        <include name="ide.jar"/>
    </fileset>
    <fileset dir="${adfbcdt.lib}">
        <include name="oracle.BC4J.10.1.3.jar"/>
    </fileset>
    <fileset dir="${adfm.lib}">
        <include name="adfm.jar"/>
    </fileset>
    <fileset dir="${adfbc.lib}">
        <include name="bc4jmt.jar"/>
        <include name="bc4jdomorcl.jar"/>
        <include name="collections.jar"/>
    </fileset>
    <fileset dir="${jdbc.lib}">
        <include name="ojdbc14.jar"/>
    </fileset>
  </path>

  <path id="view.build.classpath">
    <fileset dir="${adfm.lib}">
        <include name="adfm.jar"/>
        <include name="adfbinding.jar"/>
    </fileset>
    <fileset dir="${jsf.lib}">
        <include name="*.jar"/>
    </fileset>
    <fileset dir="${adf-faces.lib}">
      <include name="adf-faces-api.jar"/>
    </fileset>
    <fileset dir="${adfc.lib}">
      <include name="adf-controller.jar"/>
    </fileset>    
    <fileset dir="${j2ee.lib}">
        <include name="servlet.jar"/>
    </fileset>       
  </path>

  <path id="tests.classpath">
    <path refid="model.build.classpath"/>
    <path refid="fwkext.build.classpath"/>
    <fileset dir="${jdeveloper.home}/lib">
        <include name="xmlparserv2.jar"/>
        <include name="xml.jar"/>
    </fileset>
    <fileset dir="${junit.lib}">
        <include name="junit.jar"/>
    </fileset>
    <fileset dir="${jdbc.lib}">
        <include name="ojdbc14.jar"/>
    </fileset>
    <fileset dir="${jdevcm.lib}">
        <include name="jdev-cm.jar"/>
    </fileset>
    <fileset dir="${jazn.lib}">
        <include name="jazn.jar"/>
        <include name="jazncore.jar"/>
    </fileset>
    <fileset dir="${jlib.lib}">
      <include name="ojmisc.jar"/>
      <include name="commons-el.jar"/>
      <include name="jsp-el-api.jar"/>
      <include name="oracle-el.jar"/>
    </fileset>
    <fileset dir="${adfbc.lib}">
      <include name="adfshare.jar"/>
    </fileset>
  </path>

  
  <!-- Targets ============================================================ -->
  
  <target name="usage">
    <echo message=""/>
    <echo message="SRDemoSample build file"/>
    <echo message="-----------------------"/>
    <echo message=""/>
    <echo message="Available targets are:"/>
    <echo message=""/>
    <echo message="setupDB   --> Initialize the database"/>
    <echo message="resetData --> Reset the data"/>
    <echo message=""/>    
    <echo message="clean     --> Clean output dirs"/>
    <echo message="build     --> Compile main Java sources"/>
    <echo message="doc       --> Create complete Javadoc documentation"/>
    <echo message="earfile   --> Build the web application EAR file"/>
    <echo message="tests     --> Run tests using initialized database"/>
    <echo message="all       --> Clean, build, docs, earfile, tests"/>
    <echo message="package  - -> Used to zip up the Demo for distribution"/>
    <echo message=""/>
  </target>
  
  <!-- Install / Setup tasks -->
  
  <target name="setupDB"
          description="Install the SRDemo schema and populate the test data">
    <ant antfile="setupDBOracle.xml" target="all"/>
  </target>

  <target name="resetData"
          description="Drop/recreate schema objects and populate the test data">
    <ant antfile="setupDBOracle.xml" target="resetData"/>
  </target>
  
  <target name="clean" description="Cleans out all compiled content, doc etc.">
    <delete includeemptydirs="yes">
        <fileset dir="${srdemo.home}" includes="**/classes/**"/>
        <fileset dir="${srdemo.home}" includes="**/deploy/**"/>
    </delete>
    <delete dir="${dist.dir}"/>
    <delete dir="${doc.dir}"/>
  </target>
  
  <target name="build" description="Compile Java Classes" depends="clean, buildFwkExt, buildModel, buildConfigData">
  
  </target>
  
  <target name="buildConfigData" description="builds jazn config data">
    <mkdir dir="${runtime.config.build.dir}"/>
    <copy todir="${runtime.config.build.dir}" preservelastmodified="true">
        <fileset dir="${runtime.config.src.dir}">
            <include name="META-INF/**"/>
        </fileset>
    </copy>
  </target>
  <target name="buildModel" depends="buildFwkExt" description="Compiles the DataModel project">
    <mkdir dir="${model.build.dir}"/>
    
    <javac destdir="${model.build.dir}" source="1.5" target="1.5" debug="true"
           deprecation="false" optimize="false" failonerror="true">
        <src path="${model.src.dir}"/>
        <classpath refid="model.build.classpath"/>
    </javac>   

    <copy todir="${model.build.dir}" preservelastmodified="true">
        <fileset dir="${model.src.dir}">
            <include name="**/bc4j.xcfg"/>
            <include name="**/*.xml"/>
            <include name="*.jpx"/>
        </fileset>
    </copy>
  </target>

  <target name="buildFwkExt" description="Compiles the FrameworkExtensions project">
    <mkdir dir="${fwkext.build.dir}"/>
    
    <javac destdir="${fwkext.build.dir}" source="1.5" target="1.5" debug="true"
           deprecation="false" optimize="false" failonerror="true">
        <src path="${fwkext.src.dir}"/>
        <classpath refid="fwkext.build.classpath"/>
    </javac>   

    <copy todir="${fwkext.build.dir}" preservelastmodified="true">
        <fileset dir="${fwkext.src.dir}">
            <include name="*.xml"/>
        </fileset>
    </copy>
    <mkdir dir="${fwkext.deploy.dir}"/>
    <jar destfile="${fwkext.deploy.dir}/DateMustComeAfterRule.jar">
       <fileset dir="${fwkext.build.dir}" includes="oracle/srdemo/model/frameworkExt/rules/DateMustComeAfterRule.class"/>
    </jar>
    <jar destfile="${fwkext.deploy.dir}/DateMustComeAfterRuleDT.jar">
       <fileset dir="${fwkext.build.dir}" includes="oracle/srdemo/model/frameworkExt/rules/DateMustComeAfterRuleBeanInfo.class"/>
       <fileset dir="${fwkext.build.dir}" includes="oracle/srdemo/model/frameworkExt/rules/DateMustComeAfterRuleCustomizer.class"/>
    </jar>
  </target>
  
  <target name="tests" description="Run the model layer Unit tests"
          depends="build, buildTests">
    <mkdir dir="${tests.reporting.dir}"/>
    <junit printsummary="true" fork="true">
      <formatter usefile="true" type="xml"/>
      <test name="oracle.srdemo.tests.model.SRServiceAllTests"
            todir="${tests.reporting.dir}"/>
      <sysproperty key="jbo.debugoutput" value="file"/>
      <classpath path="${model.build.dir}"/>
      <classpath path="${tests.build.dir}"/>
      <classpath refid="tests.classpath"/>
    </junit>
    <junitreport todir="${tests.reporting.dir}">
      <fileset dir="${tests.reporting.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${tests.reporting.dir}"/>
    </junitreport>
  </target>

  <target name="buildTests" description="Compile unit tests" depends="buildModel">
    <mkdir dir="${tests.build.dir}"/>
    
    <javac destdir="${tests.build.dir}" source="1.5" target="1.5" debug="true"
           deprecation="false" optimize="false" failonerror="true">
        <src path="${tests.src.dir}"/>
        <classpath path="${model.build.dir}"/>
        <classpath path="${tests.build.dir}"/>
        <classpath refid="tests.classpath"/>
    </javac>       
  </target>

  <target name="doc" description="Generate JavaDoc for the workspace">
    <delete dir="${doc.dir}"/>
    <mkdir dir="${doc.dir}"/>  
  
    <javadoc packagenames="oracle.srdemo.*"
             destdir="${doc.dir}/api"
             windowtitle="SRDemoSample JavaDoc"
             verbose="false">
        <sourcepath refid="all.sources"/>
        <classpath refid="tests.classpath"/>
        <classpath refid="view.build.classpath"/>
        <classpath refid="model.build.classpath"/>
        <classpath refid="fwkext.build.classpath"/>
        <doctitle><![CDATA[<h1>SRDemo Sample JavaDoc</h1>]]></doctitle>
        <bottom><![CDATA[<i>Copyright &#169; 2006 Oracle Corp. All Rights Reserved.</i>]]></bottom>
        <group title="SRDemo DataModel - Framework Extensions" packages="oracle.srdemo.model.frameworkExt,oracle.srdemo.model.frameworkExt.rules"/>        
        <group title="SRDemo UserInterface - Framework Extensions" packages="oracle.srdemo.view.frameworkExt"/>
        <group title="SRDemo DataModel - Business Service" packages="oracle.srdemo.model"/>        
        <group title="SRDemo DataModel - Implementation" packages="oracle.srdemo.model.*"/>
        <group title="SRDemo Tests - Business Service Tests" packages="oracle.srdemo.tests.model.unittests"/>
        <group title="SRDemo Tests - Test Fixtures" packages="oracle.srdemo.tests.model.fixtures"/>
        <group title="SRDemo Testsuite" packages="oracle.srdemo.tests.model"/>
        <group title="SRDemo UserInterface - Page Backing Beans" packages="oracle.srdemo.view.backing"/>
        <group title="SRDemo UserInterface - Declarative Menu Code" packages="oracle.srdemo.view.menu"/>
        <group title="SRDemo UserInterface - Utility Classes" packages="oracle.srdemo.view.util"/>
        <group title="SRDemo UserInterface - Resource Access" packages="oracle.srdemo.view.resources,oracle.srdemo.view.pageDefs"/>        
        <group title="SRDemo UserInterface - Misc" packages="oracle.srdemo.view"/>                
    </javadoc>    
  </target>


  <!-- Admin functions used to package this for distribution --> 

  <target name="package" description="Packages this demo for distribution" depends="adminCleanBeforeZip">
  </target>
  
  <target name="adminCleanBeforeZip">
    <delete failonerror="no" verbose="yes" includeemptydirs="yes">
      <fileset dir="${srdemo.home}" includes="SRDemoSampleADFBCExtension.zip"/>
      <fileset dir="${view.home.dir}/public_html/WEB-INF" includes="temp/**"/>
      <fileset dir="${srdemo.home}" includes="BuildAndDeploy/${temp.dir}/**"/>
      <fileset dir="${srdemo.home}" includes="**/classes/**" excludes="**/SRDemoADFPhaseListener.class"/>
      <fileset dir="${srdemo.home}" includes="**/SRDemoSampleADFBC-*"/>
      <fileset dir="${srdemo.home}" includes="oc4j-connectors.xml"/>
      <fileset dir="${srdemo.home}" includes="**/deploy/**" excludes="FrameworkExtensions/deploy/DateMustComeAfter**"/>      
      <fileset dir="${srdemo.home}" includes="**/*.log"/>
      <fileset dir="${srdemo.home}" includes=".adf/**"/>
      <fileset dir="${srdemo.home}" includes="**/.history/**"/>
      <fileset dir="${srdemo.home}" includes="**/*.*.bak" defaultexcludes="no" />
      <fileset dir="${srdemo.home}" includes="**/*.*~" defaultexcludes="no" />
      <fileset dir="${srdemo.home}" includes="**/*.~[0-9].[0-9]*~" defaultexcludes="no" />
      <fileset dir="${srdemo.home}" includes="**/#*#" defaultexcludes="no" />
      <fileset dir="${tests.reporting.dir}" includes="**/*"/>
      <fileset dir="${srdemo.home}" includes="doc/**/*"/>
      <fileset dir="${srdemo.home}" includes="**/junit*.properties"/>
    </delete>
  </target>
  
  
</project>
