1 <?xml version="1.0" encoding="UTF-8"?>
   2 <!--
   3  Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 
   6  This code is free software; you can redistribute it and/or modify it
   7  under the terms of the GNU General Public License version 2 only, as
   8  published by the Free Software Foundation.
   9 
  10  This code is distributed in the hope that it will be useful, but WITHOUT
  11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  version 2 for more details (a copy is included in the LICENSE file that
  14  accompanied this code).
  15 
  16  You should have received a copy of the GNU General Public License version
  17  2 along with this work; if not, write to the Free Software Foundation,
  18  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 
  20  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  or visit www.oracle.com if you need additional information or have any
  22  questions.
  23  -->
  24 <project name="jemmy" default="compile" basedir=".">
  25     <property name="src.dir" location="src"/>
  26     <property name="test.dir" location="test"/>
  27     <property name="build.dir" location="build"/>
  28     <property name="build.classes.dir" location="${build.dir}/classes"/>
  29     <property name="build.test.dir" location="${build.dir}/test"/>
  30     <property name="dist.jar" location="${build.dir}/JemmyCore.jar"/>
  31     <property name="test.list" location="${build.dir}/testlist"/>
  32     <property name="test.workdir" location="${build.dir}/test_wd"/>
  33     <property name="test.report" location="${build.dir}/test_report"/>
  34     <target name="timestamp" unless="buildnumber">
  35         <tstamp>
  36             <format property="buildnumber" pattern="yyyyMMdd"/>
  37         </tstamp>
  38     </target>
  39     <target name="compile" depends="timestamp">
  40         <mkdir dir="${build.classes.dir}"/>
  41         <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on" includeantruntime="false"/>
  42         <copy file="${src.dir}/org/jemmy/jemmy.properties" tofile="${build.classes.dir}/org/jemmy/jemmy.properties" filtering="on"/>
  43         <echo message="build=${buildnumber}" file="${build.classes.dir}/org/jemmy/jemmy.properties" append="true"/>
  44     </target>
  45     <target name="compile-test" depends="compile">
  46         <fail message="Please specify jtreg.home" unless="jtreg.home"/>
  47         <mkdir dir="${build.test.dir}"/>
  48         <javac srcdir="${test.dir}" destdir="${build.test.dir}" debug="on" includeantruntime="false"
  49                classpath="${build.classes.dir}:${jtreg.home}/lib/testng.jar"/>
  50     </target>
  51     <target name="find-tests" unless="tests">
  52         <fileset id="testset" dir="${test.dir}">
  53             <include name="**/*Test.java" />
  54         </fileset>
  55         <pathconvert pathsep="${line.separator}" property="testlist" refid="testset">
  56             <globmapper from="${test.dir}/*" to="*"/>
  57         </pathconvert>
  58         <echo file="${test.list}">${testlist}</echo>
  59         <property name="tests" value="@${test.list}"/>
  60     </target>
  61     <target name="test" depends="compile-test,find-tests">
  62         <exec executable="${jtreg.home}/bin/jtreg">
  63             <arg value="-cpa:${build.classes.dir}"/>
  64             <arg value="-w:${test.workdir}"/>
  65             <arg value="-r:${test.report}"/>
  66             <arg value="-conc:1"/>
  67             <arg value="-ovm"/>
  68             <arg value="-v:default"/>
  69             <arg value="-dir:test"/>
  70             <arg value="${tests}"/>
  71         </exec>
  72     </target>
  73     <target name="jar" depends="compile">
  74         <mkdir dir="${build.dir}"/>
  75         <jar jarfile="${dist.jar}" basedir="${build.classes.dir}">
  76             <manifest>
  77                 <attribute name="Main-Class"
  78                     value="org.jemmy.Version"/>
  79             </manifest>
  80         </jar>
  81     </target>
  82     <target name="clean">
  83         <delete dir="${build.dir}"/>
  84     </target>
  85 </project>
  86 
  87