<!--
#
# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description: 
#
-->

<project name="OmjPIMTests" default="deploy.ut" basedir=".">

  

  <property environment="env"/>
  <property name="java.src.root" location="${env.JAVA_SRC_ROOT}"/>
  <property name="java.bin.root" location="${env.JAVA_BIN_ROOT}"/>

  <import file="../../../../build/utilities.xml"/>

  <property name="src.dir" location="./src"/>
  <property name="build.dir" location="."/>
  <property name="resource_path" value="${build.dir}/res"/>
  <property name="classes.dir" location="${build.dir}/javabuild"/>
  <property name="jar_dir" value="${classes.dir};${resource_path}"/>
  <property name="installer.jar.filename" value="javainstaller.jar"/>
  <property name="pimtests.jar.filename" value="OmjPIMTests.jar"/>
  <property name="utils.jar.filename" value="javacommonutils.jar"/>
  <property name="logger.jar.filename" value="logger.jar"/>
  <property name="junit.jar.dir" location="${java.src.root}/tools/junit"/>
  <property name="junit.jar.filename" value="j2meunit1.1.1.jar"/>
  <property name="junit.omj.jar.filename" value="j2meunitomj.jar"/>

  <property name="bootclasspath.cdc" location="${java.src.root}/javaruntime/jvm/ibm/j9_23/ibmdelivery/resource/lib/jclCdc11/classes.zip"/>

  <property name="javac.source" value="1.3"/>
  <property name="javac.target" value="1.3"/>
  
  <target name="init.my.properties" depends="init.properties">
      <property name="dist" location="${vm.extension.directory}"/>
  </target>

  <target name="clean">
    <delete dir="${classes.dir}"/>
    <delete file="${dist}/${pimtests.jar.filename}"/>
    <delete file="${dist}/${junit.jar.filename}"/>
    <delete file="${dist}/${junit.omj.jar.filename}"/>
  </target>

  <target name="compile.ut" depends="init.properties">

  

    <property name="jars.dir" location="${jarfiles.collect.root}"/>
    <property name="jars.dir.cdc" location="${jarfiles.collect.cdc.root}"/>
    <mkdir dir="${classes.dir}"/>
    <javac source="${javac.source}" target="${javac.target}"
           destdir="${classes.dir}"
           bootclasspath="${bootclasspath.cdc}">
           <classpath>
               <pathelement
                 location="${jars.dir.cdc}/${installer.jar.filename}"/>
               <pathelement location="${impl.cldc.jar}"/>
               <pathelement location="${impl.cdc.jar}"/>
               <pathelement location="${public.api.jar}"/>
               <pathelement location="${platform.api.jar}"/>
               <pathelement location="${junit.jar.dir}/${junit.jar.filename}"/>
               <pathelement location="${junit.jar.dir}/${junit.omj.jar.filename}"/>
           </classpath>
      <src path="${src.dir}"/>
    </javac>
    
    <ant antfile="${java.src.root}/tools/junit/JsrTestRunner/build/build.xml">
    </ant>
    
  </target>

  <target name="jar.resources">
    		<mkdir dir="${classes.dir}/res"/>
			<copy todir="${classes.dir}/res">
			    <fileset dir="${resource_path}" />
			</copy>
	</target>

  <target name="deploy.ut" depends="compile.ut,init.my.properties,jar.resources">
      <mkdir dir="${dist}"/>
      <jar destfile="${dist}/${pimtests.jar.filename}" basedir="${classes.dir}"/>
      <copy file="${junit.jar.dir}/${junit.jar.filename}"
            tofile="${dist}/${junit.jar.filename}"/>
      <copy file="${junit.jar.dir}/${junit.omj.jar.filename}"
            tofile="${dist}/${junit.omj.jar.filename}"/>
  </target>

  <target name="main" depends="clean"/>

  <target name="cdc" >
  <antcall target="deploy.ut">
        <param name="src.dir" location="./javasrc.cdc"/> 
        <param name="classes.dir" location="${build.dir}/javabuild.cdc"/>
       </antcall>
  </target>

 </project> 
