javauis/eswt_qt/org.eclipse.swt.qt.s60.winscw/build.xml
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 12:49:31 +0300
changeset 26 dc7c549001d5
parent 23 98ccebc37403
permissions -rw-r--r--
Revision: v2.1.26 Kit: 2010121

<?xml version="1.0" encoding="UTF-8"?>
<project name="org.eclipse.swt.qt.s60.winscw" default="build" basedir=".">

    <target name="help">
        <echo level="info">
Usage: ant [one of the following:]
build              : Build debug + release
build.jar          : Build all jars
build.debug        : Build all debug binaries
build.release      : Build all release binaries
build.lib          : Build all native libraries
build.lib.debug    : Build debug native libraries
build.lib.release  : Build release native libraries
build.tests        : Build JUnit and MT tests
clean              : Clean everything
clean.jar          : Clean all jars
clean.lib          : Clean native libraries and object files
clean.lib.debug    : Clean debug native libraries and object files
clean.lib.release  : Clean release native libraries and object files
export             : Export everything
export.jar         : Export Java classes packed as jar
export.debug       : Export all debug binaries
export.release     : Export all release binaries
export.lib         : Export native libraries
export.lib.debug   : Export debug native libraries
export.lib.release : Export release native libraries
run.tests          : Run JUnit and MT tests
make.sis           : Create OMJ SIS package
        </echo>
    </target>

    <target name="init" depends="init.env, init.export.path">
        <property file="./build.properties"></property>
        <property name="full.name" value="${fragment}_${version.suffix}"/>
        <property name="temp.dir" value="${basedir}/temp"/>
        <property name="plugin.destination" value="${basedir}"/>
        <property name="build.result.dir" value="${basedir}"/>
        <property name="download.destination" value="${basedir}"/>
        <property name="lib.path" value = "${plugin.dir}/Eclipse_SWT_PI/qt/library"/>
        <property name="lib.gfx.path" value = "${plugin.dir}/Eclipse_SWT_PI/qt/library/graphics"/>
        <property name="odc.location" value = "${plugin.dir}/Eclipse_SWT_PI/s60"/>
        <mkdir dir="${lib.path}/${generated.native.dir}"/>
        <!-- Platform Specific properties -->
        <property name="test.jar.dir" value = "${env.EPOCROOT}epoc32/release/winscw/udeb/z/resource/java/jvm/lib/common"/>
        <property name="jar.dir" value = "${env.EPOCROOT}epoc32/release/winscw/udeb/z/resource/java/jvm/lib/jrt"/>
        <property name="epoc.debug.dir" value = "${env.EPOCROOT}epoc32/release/winscw/udeb"/>
        <property name="epoc.release.dir" value = "${env.EPOCROOT}epoc32/release/winscw/urel"/>
        <property name="omj.loc.dir" value = "${env.JAVA_SRC_ROOT}/build/loc"/>
        <path id="javac.bootclasspath">
            <pathelement path="${env.EPOCROOT}epoc32/BUILD/java/javabuild/javautils/winscw/debug/classes/collection"/>
            <pathelement location="${env.JAVA_SRC_ROOT}/inc/classes.cldc.zip"/>
        </path>
    </target>
    
    <target name="init.env">
        <property environment = "env"/>
        <fail message="JAVA_SRC_ROOT system variable not defined">
            <condition>
                <not>
                    <isset property="env.JAVA_SRC_ROOT"/>
                </not>
            </condition>
        </fail>
        <fail message="JAVA_BIN_ROOT system variable not defined">
            <condition>
                <not>
                    <isset property="env.JAVA_BIN_ROOT"/>
                </not>
            </condition>
        </fail>
        <fail message="EPOCROOT system variable not defined">
            <condition>
                <not>
                    <isset property="env.EPOCROOT"/>
                </not>
            </condition>
        </fail>
    </target>

    <target name="init.export.path">
        <property name="export.jar.debug.path" value = "${env.EPOCROOT}epoc32/release/winscw/udeb/Z/resource/java/jvm/lib/jrt"/>
        <property name="export.jar.release.path" value = "${env.EPOCROOT}epoc32/release/winscw/urel/Z/resource/java/jvm/lib/jrt"/>
        <property name="export.lib.debug.path" value = "${env.EPOCROOT}epoc32/release/winscw/udeb"/>
        <property name="export.lib.release.path" value = "${env.EPOCROOT}epoc32/release/winscw/urel"/>
    </target>
        
    <target name="download" depends="init">
        <delete dir="${temp.dir}"/>
        <mkdir dir="${temp.dir}/swtdownload/"/>
        <antcall target="build.jar"/>
        <jar jarfile="${build.result.dir}/${jar.filename}" basedir="${basedir}/release/" 
                update="true" includes="eswt*.dll,libeswt*.so"/>
        <copy file="${build.result.dir}/${jar.filename}" todir="${temp.dir}/swtdownload"/>
        <antcall target="src.zip"/>
        <copy file="${build.result.dir}/src.zip" todir="${temp.dir}/swtdownload"/>
        <copy file="${plugin.dir}/build/.project" todir="${temp.dir}/swtdownload"/>
        <copy file="${plugin.dir}/build/.classpath" todir="${temp.dir}/swtdownload"/>
        <copy todir="${temp.dir}/swtdownload">
            <fileset dir="${basedir}" includes="about.html,about_files/"/>
        </copy>
        <zip zipfile="${download.destination}/eswt-${ws}-${os}-${arch}-${jsdk}.zip">
            <zipfileset dir="${temp.dir}/swtdownload/"/>
        </zip>
        <delete dir="${temp.dir}"/>
    </target>

    <target name="src.zip" depends="init">
        <mkdir dir="${build.result.dir}/"/>
        <zip zipfile="${build.result.dir}/src.zip">
            <fileset dir="${plugin.dir}/Eclipse SWT/common/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common_j2${java.edition}/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Browser/common/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Browser/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Drag and Drop/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/common_j2${java.edition}/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/library/"/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/graphics_library/"/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/s60/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/../com.nokia.swt.extensions/extensions/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/../com.nokia.swt.extensions/midp/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common_j2${java.edition}/" includes="**/*.properties" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common/" includes="**/version.txt" excludes=""/>
            <fileset dir="${basedir}" includes="about.html,about_files/" excludes=""/>
        </zip>
    </target>
        
    <target name="gather.sources" depends="init" if="destination.temp.folder">
        <mkdir dir="${destination.temp.folder}/${full.name}"/>
        <copy file="${build.result.dir}/src.zip" todir="${destination.temp.folder}/${full.name}/"/>
        <copy todir="${destination.temp.folder}/${full.name}">
            <fileset dir="${basedir}" includes="about.html,about_files/"/>
        </copy>
    </target>

    <target name="gather.individual.sources" depends="init">
        <copy todir="${destination.temp.folder}/" failonerror="true" overwrite="true">
            <fileset dir="${plugin.dir}/Eclipse SWT/common/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common_j2${java.edition}/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Browser/common/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Browser/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT Drag and Drop/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/common_j2${java.edition}/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/s60/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/library/"/>
            <fileset dir="${plugin.dir}/Eclipse_SWT_PI/qt/graphics_library/"/>
            <fileset dir="${plugin.dir}/../com.nokia.swt.extensions/extensions/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/../com.nokia.swt.extensions/midp/" includes="**/*.java" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common_j2${java.edition}/" includes="**/*.properties" excludes=""/>
            <fileset dir="${plugin.dir}/Eclipse SWT/common/" includes="**/version.txt" excludes=""/>
        </copy>
    </target>

    <target name="gather.bin.parts" depends="init" if="destination.temp.folder">
        <mkdir dir="${destination.temp.folder}/${full.name}"/>
        <copy todir="${destination.temp.folder}/${full.name}" failonerror="true">
            <fileset dir="${plugin.dir}/bin" includes="*"/>
        </copy>
        <copy todir="${destination.temp.folder}/${full.name}">
            <fileset dir="${basedir}" includes="eswt*.dll,libeswt*.so,META-INF/"/>
        </copy>
        <chmod perm="755" dir="${destination.temp.folder}/${full.name}" includes="eswt*.dll,libeswt*.so" />
        <eclipse.versionReplacer path="${destination.temp.folder}/${full.name}" version="${version.suffix}"/>
    </target>
        
    <target name="jar.plugin" depends="init">
        <delete dir="${temp.dir}"/>
        <mkdir dir="${temp.dir}"/>
        <antcall target="build.jar"/>
        <antcall target="gather.bin.parts">
            <param name="destination.temp.folder" value="${temp.dir}/"/>
        </antcall>
        <jar jarfile="${plugin.destination}/${full.name}.jar" 
                basedir="${temp.dir}/${full.name}" filesonly="true"/>
        <delete dir="${temp.dir}"/>
    </target>
        
    <target name="zip.plugin" depends="init">
        <delete dir="${temp.dir}"/>
        <mkdir dir="${temp.dir}"/>
        <antcall target="build.jar"/>
        <antcall target="src.zip"/>
        <antcall target="gather.bin.parts">
            <param name="destination.temp.folder" value="${temp.dir}/"/>
        </antcall>
        <antcall target="gather.sources">
            <param name="destination.temp.folder" value="${temp.dir}/"/>
        </antcall>
        <zip zipfile="${plugin.destination}/${full.name}.zip" 
                basedir="${temp.dir}" filesonly="true"/>
        <delete dir="${temp.dir}"/>
    </target>

    <target name="build">
        <antcall target="export.jar"/>
        <antcall target="export.lib"/>
    </target>
        
    <target name="build.jar" depends="init,localization" description="Produces eswt-qt.jar">
        <mkdir dir="${plugin.dir}/bin"/>
        <javac destdir="${plugin.dir}/bin" source="${javac.source}" target="${javac.target}"
            debug="${javac.debug}" debuglevel="lines,vars,source" verbose="true" failonerror="true">
            <src path="${plugin.dir}/Eclipse SWT/common/"/>
            <src path="${plugin.dir}/Eclipse SWT/common_j2${java.edition}/"/>
            <src path="${plugin.dir}/Eclipse SWT/qt/"/>
            <src path="${plugin.dir}/Eclipse SWT Browser/common/"/>
            <src path="${plugin.dir}/Eclipse SWT Browser/qt/"/>
            <src path="${plugin.dir}/Eclipse SWT Drag and Drop/qt/"/>
            <src path="${plugin.dir}/Eclipse_SWT_PI/common_j2${java.edition}/"/>
            <src path="${plugin.dir}/Eclipse_SWT_PI/qt/"/>
            <src path="${plugin.dir}/Eclipse_SWT_PI/s60/"/>
            <src path="${plugin.dir}/../com.nokia.swt.extensions/extensions/"/>
            <src path="${plugin.dir}/../com.nokia.swt.extensions/midp_symbian/" />
            <bootclasspath refid="javac.bootclasspath"/>
            <classpath>
                <pathelement location="${epoc.debug.dir}/java_impl_cldc.jar"/>
                <pathelement location="${plugin.dir}/../com.nokia.swt.extensions/extra_jars/cdc-compilation-support.jar"/>
            </classpath>
        </javac>
        <jar jarfile="${build.result.dir}/${jar.filename}" basedir="${plugin.dir}/bin" includes="**/*.class"/>
    </target>

    <target name="build.debug">
        <antcall target="export.jar.debug"/>
        <antcall target="export.lib.debug"/>
    </target>

    <target name="build.release">
        <antcall target="export.jar.release"/>
        <antcall target="export.lib.release"/>
    </target>

    <target name="build.lib">
        <antcall target="build.lib.debug"/>
        <antcall target="build.lib.release"/>
    </target>

    <target name="build.lib.debug" depends="init">
        <antcall target="build.lib.common">
            <param name="build.lib.common.config" value="debug"/>
        </antcall>
    </target>

    <target name="build.lib.release" depends="init">
        <antcall target="build.lib.common">
            <param name="build.lib.common.config" value="release"/>
        </antcall>
    </target>

    <target name="build.lib.common" depends="init" description="params: config">
        <javah destdir="${lib.path}/${generated.native.dir}/" classpath="${plugin.dir}/bin" verbose="yes">
            <class name="org.eclipse.swt.internal.qt.OS"/>
			<class name="org.eclipse.swt.internal.qt.graphics.OS"/>
            <class name="org.eclipse.swt.internal.qt.s60.OS"/>
            <class name="org.eclipse.swt.internal.extension.OS"/>
        </javah>
 
        <!-- check  if symexports needs to be called  by checking if the either os.h and gfxos.h is never than jni_lookup-cpp  -->
        <uptodate property="symexports.notRequired" targetfile="${lib.path}/${generated.native.dir}/jni_lookup.cpp" 
			srcfile="${lib.path}/${generated.native.dir}/org_eclipse_swt_internal_qt_OS.h" />
        <antcall target="symexports" />
                
        <antcall target="qmake">
            <param name="qmake.dir" value="${lib.path}"/>
            <param name="qmake.target" value="${build.lib.common.config}"/>
            <param name="qmake.spec" value="${lib.spec}"/>
            <param name="qmake.file" value="${lib.makefile}"/>
        </antcall>
        <exec executable="cmd" dir="${lib.path}" failonerror="true">
            <arg value="/c"/>
            <arg value="bldmake bldfiles"/>
        </exec>
        <antcall target="abld">
            <param name="abld.dir" value="${lib.path}"/>
            <param name="abld.command" value="build"/>
            <param name="abld.platform" value="winscw"/>
            <param name="abld.config" value="${build.lib.common.config}"/>
        </antcall>
        <mkdir dir="${build.result.dir}/${build.lib.common.config}/"/>
        <!-- On S60 the libs are generated directly into the export path -->
        <condition property="build.lib.common.export.path" value="${export.lib.debug.path}" else="${export.lib.release.path}">
            <equals arg1="${build.lib.common.config}" arg2="debug"/>
        </condition>
        <copy file="${build.lib.common.export.path}/${lib.filename}" 
            tofile="${build.result.dir}/${build.lib.common.config}/${lib.filename}" overwrite="true" verbose="true"/>
    </target>
        
    <target name="symexports" unless="symexports.notRequired">
        <echo message="Calling symexports to generate jni_lookup.cpp"></echo>
        <exec executable="/epoc32/tools/symexports" dir="${lib.path}/${generated.native.dir}" failonerror="true">
                <arg line="-h:./org_eclipse_swt_internal_qt_OS.h" />
                <arg line="-h:./org_eclipse_swt_internal_qt_graphics_OS.h" />
                <arg line="-h:./org_eclipse_swt_internal_qt_s60_OS.h" />
            <arg value="-out:./jni_lookup.cpp"/>
        </exec>
    </target>
        
    <target name="clean">
        <antcall target="clean.jar"/>
        <antcall target="clean.lib"/>
    </target>
        
    <target name="clean.jar" depends="init" description="">
        <delete dir="${plugin.dir}/bin"/>
        <delete file="${build.result.dir}/${jar.filename}" verbose="true"/>
        <delete file="${export.jar.debug.path}/${jar.filename}" verbose="true"/>
        <delete file="${export.jar.release.path}/${jar.filename}" verbose="true"/>
    </target>

    <target name="clean.lib">
        <antcall target="clean.lib.debug"/>
        <antcall target="clean.lib.release"/>
    </target>

    <target name="clean.lib.debug" depends="init">
        <antcall target="clean.lib.common">
            <param name="clean.lib.common.config" value="debug"/>
        </antcall>
    </target>

    <target name="clean.lib.release" depends="init">
        <antcall target="clean.lib.common">
            <param name="clean.lib.common.config" value="release"/>
        </antcall>
    </target>

    <target name="clean.lib.common" depends="init" description="params: config">
        <antcall target="qmake">
            <param name="qmake.dir" value="${lib.path}"/>
            <param name="qmake.target" value="${clean.lib.common.config}"/>
            <param name="qmake.spec" value="${lib.spec}"/>
            <param name="qmake.file" value="${lib.makefile}"/>
        </antcall>
        <exec executable="cmd" dir="${lib.path}" failonerror="true">
            <arg value="/c"/>
            <arg value="bldmake bldfiles"/>
        </exec>
        <antcall target="abld">
            <param name="abld.dir" value="${lib.path}"/>
            <param name="abld.command" value="reallyclean"/>
            <param name="abld.platform" value="winscw"/>
            <param name="abld.config" value="${clean.lib.common.config}"/>
        </antcall>
        <delete dir="${lib.path}/${generated.native.dir}" verbose="true"/>
        <delete file="${build.result.dir}/${clean.lib.common.config}/${lib.filename}" verbose="true"/>
        <condition property="clean.lib.common.export.path" value="${export.lib.debug.path}" else="${export.lib.release.path}">
            <equals arg1="${clean.lib.common.config}" arg2="debug"/>
        </condition>
        <delete file="${clean.lib.common.export.path}/${lib.filename}" verbose="true"/>
        <delete dir="${lib.path}/${clean.lib.common.config}" verbose="true"/>
    </target>

    <target name="export">
        <antcall target="export.jar"/>
        <antcall target="export.lib"/>
    </target>

    <target name="export.debug">
        <antcall target="export.jar.debug"/>
        <antcall target="export.lib.debug"/>
    </target>

    <target name="export.release">
        <antcall target="export.jar.release"/>
        <antcall target="export.lib.release"/>
    </target>

    <target name="export.jar">
        <antcall target="export.jar.debug"/>
        <antcall target="export.jar.release"/>
    </target>

    <target name="export.jar.debug" depends="build.jar" if="export.jar.debug.path">
        <mkdir dir="${export.jar.debug.path}"/>
        <copy file="${build.result.dir}/${jar.filename}" 
            tofile="${export.jar.debug.path}/${jar.filename}" overwrite="true" verbose="true"/>
        <copy file="${odc.location}/eswt.odc" 
            tofile="${export.jar.debug.path}/eswt.odc" overwrite="true" verbose="true"/>
    </target>

    <target name="export.jar.release" depends="build.jar" if="export.jar.release.path">
        <mkdir dir="${export.jar.release.path}"/>
        <copy file="${build.result.dir}/${jar.filename}"
            tofile="${export.jar.release.path}/${jar.filename}" overwrite="true" verbose="true"/>
        <copy file="${odc.location}/eswt.odc" 
            tofile="${export.jar.release.path}/eswt.odc" overwrite="true" verbose="true"/>        
    </target>

    <target name="export.lib">
        <antcall target="export.lib.debug"/>
        <antcall target="export.lib.release"/>
    </target>

    <target name="export.lib.debug" depends="build.lib.debug" if="export.lib.debug.path">
        <!-- Nothing to do. On S60 libs are exported automatically -->
    </target>

    <target name="export.lib.release" depends="build.lib.release" if="export.lib.release.path">
        <!-- Nothing to do. On S60 libs are exported automatically -->
    </target>

    <target name="make" description="params: dir, file, target">
        <exec executable="make" dir="${make.dir}" failonerror="true">
            <arg line="-f ${make.file} ${make.target}"/>
        </exec>
    </target>

    <target name="qmake" description="params: dir, spec, target">
        <exec executable="qmake" dir="${qmake.dir}" failonerror="true">
            <arg line="-spec ${qmake.spec} -o ${qmake.file}"/>
            <arg value="CONFIG+=${qmake.target}"/>
            <arg value="DESTDIR=${qmake.target}"/>
            <arg value="OBJECTS_DIR=${qmake.target}/${qmake.spec}/build"/>
        </exec>
    </target>

    <target name="abld" description="params: dir, command, platform, config">
        <condition property="abld.actual.config" value="udeb" else="urel">
            <equals arg1="${abld.config}" arg2="debug"/>
        </condition>
        <exec executable="cmd" dir="${abld.dir}" failonerror="true">
            <arg line="/c abld ${abld.command} ${abld.platform} ${abld.actual.config}"/>
        </exec>

    </target>

    <target name="build.tests" depends="init"> 
        <mkdir dir="${tests.utils.dir}/java/bin"/>
        <mkdir dir="${tests.junit.dir}/bin"/>
        <mkdir dir="${tests.mt.dir}/bin"/>
        
        <!-- build s60uitestutils -->
        <javac destdir="${tests.utils.dir}/java/bin" source="${javac.source}" target="${javac.target}" 
                debug="${javac.debug}" debuglevel="lines,vars,source" verbose="true" failonerror="true">
                <src path="${tests.utils.dir}/java/src/"/>
            <classpath>
                <pathelement location="${epoc.debug.dir}/java_impl_cldc.jar"/>
            </classpath>
        </javac>
        <jar jarfile="${build.result.dir}/s60uitestutils.jar">
            <fileset dir="${tests.utils.dir}/java/bin"/>
        </jar>
        <copy file="${build.result.dir}/s60uitestutils.jar" todir="${test.jar.dir}"/>
        
       
       <javah outputfile="../s60utils/native/s60utils.h" classpath="${tests.utils.dir}/java/bin" verbose="yes">
          	<class name="com.nokia.mj.impl.uitestutils.S60Utils"/>
        </javah>
        
        <exec executable="python" failonerror="true">
      		<arg value="${env.JAVA_SRC_ROOT}/build/buildutils/generates60lookup.py"/>
      		<arg value="--nojxe"/>
      		<arg value="${tests.utils.dir}/native/s60utils.h"/>
      		<arg value="${tests.utils.dir}/native/jni_lookup.cpp"/>
    	</exec>
			
        <exec executable="${qmake.dir}/qmake" dir="${tests.utils.dir}/native" failonerror="true" >
            <arg line="-spec symbian-sbsv2"/>
        </exec>
 
        <exec executable="${make.dir}/make" dir="${tests.utils.dir}/native" failonerror="true"/>
        
        <!-- build JUnit tests -->
        <javac destdir="${tests.junit.dir}/bin" source="${javac.source}" target="${javac.target}" 
                debug="${javac.debug}" debuglevel="lines,vars,source" verbose="true" failonerror="true">
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.core.tests/src/"/>
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.expanded.tests/src/"/>
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.mobile.tests.tck/src/"/>
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.core.tests.qt/src/"/>
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.mobile.tests.qt/src/"/>
            <src path="${tests.junit.dir}/org.eclipse.ercp.swt.expanded.tests.qt/src/"/>
            <exclude name="**/Test_com_ibm_ugl_UGLCompatibility.java"/>
            <classpath>
                <pathelement location="${tests.mt.dir}/junit-3.8.1.1.jar"/>
                <pathelement location="${epoc.debug.dir}/java_impl_cldc.jar"/>
            </classpath>
        </javac>
        
        <!-- build MT tests -->
        <javac destdir="${tests.mt.dir}/bin" source="${javac.source}" target="${javac.target}" 
                debug="${javac.debug}" debuglevel="lines,vars,source" verbose="true" failonerror="true">
                <src path="${tests.mt.dir}/src/"/>
                <src path="${tests.mt.dir}/src_j2me/"/>
                <src path="${tests.mt.dir}/../CgfxTestRunner/src/"/>
            <classpath>
                <pathelement location="${tests.mt.dir}/junit-3.8.1.1.jar"/>
                <pathelement location="${epoc.debug.dir}/java_impl_cldc.jar"/>
                <pathelement path="${tests.junit.dir}/bin/"/>
                <pathelement path="${tests.utils.dir}/java/bin/"/>
                <pathelement location="${epoc.debug.dir}/java_impl_cldc.jar"/>
                <pathelement location="${env.JAVA_SRC_ROOT}/inc/classes.cldc.zip"/>
            </classpath>
        </javac>
        
        <jar jarfile="${build.result.dir}/eswt-qt-tests.jar">
                <fileset dir="${tests.junit.dir}/bin"/>
                
                <!-- JUnit test resources are in the source folders -->
                <fileset dir="${tests.junit.dir}/org.eclipse.ercp.swt.core.tests/src" excludes="**/*.java"/> 
                <fileset dir="${tests.junit.dir}/org.eclipse.ercp.swt.core.tests.qt/src" excludes="**/*.java"/> 
                <fileset dir="${tests.junit.dir}/org.eclipse.ercp.swt.expanded.tests/src" excludes="**/*.java"/> 
                <fileset dir="${tests.junit.dir}/org.eclipse.ercp.swt.mobile.tests.qt/src" excludes="**/*.java"/> 
                <fileset dir="${tests.junit.dir}/org.eclipse.ercp.swt.mobile.tests.tck/src" excludes="**/*.java"/> 
                
                <fileset dir="${tests.mt.dir}/bin"/>
                <fileset dir="${tests.mt.dir}/res"/>
        </jar>
        <copy file="${tests.mt.dir}/junit-3.8.1.1.jar" todir="${test.jar.dir}"/>
        <copy file="${build.result.dir}/eswt-qt-tests.jar" todir="${test.jar.dir}"/>
        <antcall target="rename"/>
    </target>
        
    <target name="clean.tests" depends="init">
        <exec executable="make" dir="${tests.utils.dir}/native" failonerror="true">
            <arg line="clean"/>
        </exec>
        <delete dir="${tests.utils.dir}/java/bin"/>
        <delete dir="${tests.utils.dir}/native/release"/>
        <delete dir="${tests.utils.dir}/native/debug"/>
        <delete dir="${tests.junit.dir}/bin"/>
        <delete dir="${tests.mt.dir}/bin"/>
        <delete file="${build.result.dir}/eswt-qt-tests.jar" verbose="true"/>
        <delete file="${build.result.dir}/s60uitestutils.jar" verbose="true"/>
        <delete file="${build.result.dir}/release/libxlibevents.so" verbose="true"/>
        <delete file="${build.result.dir}/debug/libxlibevents.so" verbose="true"/>
        <delete file="${epoc.release.dir}/s60uitestutils.dll" verbose="true"/>
        <delete file="${epoc.release.dir}/s60uitestutils.lib" verbose="true"/>
        <delete file="${epoc.debug.dir}/s60uitestutils.dll" verbose="true"/>
        <delete file="${epoc.debug.dir}/s60uitestutils.lib" verbose="true"/>
    </target>
    
    <target name="run.tests" depends="init,build.tests">
        <mkdir dir="${build.result.dir}/testresults"/>
        <junit printsummary="yes" fork="yes">
                <test name="com.nokia.eswt.mt.AllTests"/>
                <formatter type="xml" usefile="yes"/>
            <classpath>
                <pathelement location="${tests.mt.dir}/junit-3.8.1.1.jar"/>
                <pathelement location="${build.result.dir}/eswt-qt.jar"/>
                <pathelement location="${build.result.dir}/eswt-qt-tests.jar"/>
                <pathelement path="${java.class.path}"/>
            </classpath>
            <sysproperty key="java.library.path" value="${build.result.dir}/release"/>
        </junit>
        <junitreport todir="${build.result.dir}/testresults">
                <fileset dir="${build.result.dir}">
                        <include name="TEST-*.xml" />
                </fileset>
                <report todir="${build.result.dir}/testresults"/>
        </junitreport>
    </target>

    <target name="make.sis" depends="init">
        <exec executable="make" dir="${java.src.root}/build/sis" failonerror="false">
            <arg line="UI=QT"/>
        </exec>
    </target>

	<!-- Localization process -->
	<target name="localization" depends="init">
 			<zip destfile="${omj.loc.dir}/${loc.qt.jar}" update="true" filesonly="true">
      		<zipfileset dir="../loc" prefix="resources/com/nokia/mj/impl"
                 includes="eswtcore.loc,eswtmobile.loc" />
    	</zip>
			<copy file="${omj.loc.dir}/${loc.qt.jar}"  tofile="${jar.dir}/${loc.jar}" />
	</target>    			
	
	<!-- Dll rename for tests run -->
	<target name="rename" >
		<!-- Renames only when tests are compiling very first time or 
		tests compiling very first time after omj recompiled -->
		<condition property="isjavajvmargsmodifierfile">
			<available file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll"/>
   		</condition>
  		<antcall target="rename_dll"/>
	</target>  
	
	<target name="rename_dll" if="isjavajvmargsmodifierfile">
   		<condition property="isjavajvmargsmodifierdefault">
    			<available file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierdefault.dll"/>
   		</condition>
   		<antcall target="rename_omjrecompiled"/>
   		<antcall target="rename_firsttime"/>
  	</target>  
  
 	 <target name="rename_omjrecompiled" if="isjavajvmargsmodifierdefault">
  		<delete file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierdefault.dll" />
		<move file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier.dll"  tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierdefault.dll" failonerror="false"/>
		<move file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll"  tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier.dll" failonerror="false"/>
  	</target>  
  	
 	<target name="rename_firsttime" unless="isjavajvmargsmodifierdefault">
 		<copy file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier.dll" tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier_org.dll"/>  
 		<copy file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll" tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierfile_org.dll"/>
 		<move file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier.dll"  tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierdefault.dll" failonerror="false"/>
		<move file="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifierfile.dll"  tofile="${env.EPOCROOT}epoc32/release/winscw/udeb/javajvmargsmodifier.dll" failonerror="false"/>
 	</target>  
 	
</project>