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     <property name="core.jar" location="../JemmyCore/build/JemmyCore.jar"/>
  35     <target name="timestamp" unless="buildnumber">
  36         <tstamp>
  37             <format property="buildnumber" pattern="yyyyMMdd"/>
  38         </tstamp>
  39     </target>
  40     <target name="check-core">
  41         <available file="${core.jar}" property="dependencies.are.built"/>
  42     </target>
  43     <target name="build-dependencies" depends="check-core" unless="dependencies.are.built">
  44         <ant dir="../JemmyCore" target="jar"/>
  45     </target>
  46     <target name="compile" depends="timestamp,build-dependencies">
  47         <mkdir dir="${build.classes.dir}"/>
  48         <javac srcdir="${src.dir}" classpath="${core.jar}" destdir="${build.classes.dir}" debug="on" includeantruntime="false"/>
  49         <copy file="${src.dir}/org/jemmy/input/jemmy.properties" tofile="${build.classes.dir}/org/jemmy/input/jemmy.properties" filtering="on"/>
  50         <echo message="build=${buildnumber}" file="${build.classes.dir}/org/jemmy/input/jemmy.properties" append="true"/>
  51     </target>
  52     <target name="compile-test" depends="compile">
  53         <fail message="Please specify jtreg.home" unless="jtreg.home"/>
  54         <mkdir dir="${build.test.dir}"/>
  55         <javac srcdir="${test.dir}" destdir="${build.test.dir}" debug="on" includeantruntime="false"
  56                classpath="${build.classes.dir}:${core.jar}:${jtreg.home}/lib/testng.jar"/>
  57     </target>
  58     <target name="find-tests" unless="tests">
  59         <fileset id="testset" dir="${test.dir}">
  60             <include name="**/*Test.java" />
  61         </fileset>
  62         <pathconvert pathsep="${line.separator}" property="testlist" refid="testset">
  63             <globmapper from="${test.dir}/*" to="*"/>
  64         </pathconvert>
  65         <echo file="${test.list}">${testlist}</echo>
  66         <property name="tests" value="@${test.list}"/>
  67     </target>
  68     <target name="test" depends="compile-test,find-tests">
  69         <exec executable="${jtreg.home}/bin/jtreg">
  70             <arg value="-cpa:${build.classes.dir}:${core.jar}"/>
  71             <arg value="-w:${test.workdir}"/>
  72             <arg value="-r:${test.report}"/>
  73             <arg value="-conc:1"/>
  74             <arg value="-ovm"/>
  75             <arg value="-v:default"/>
  76             <arg value="-dir:test"/>
  77             <arg value="${tests}"/>
  78         </exec>
  79     </target>
  80     <target name="jar" depends="compile">
  81         <mkdir dir="${build.dir}"/>
  82         <jar jarfile="${dist.jar}" basedir="${build.classes.dir}">
  83             <manifest>
  84                 <attribute name="Main-Class"
  85                     value="org.jemmy.input.Version"/>
  86             </manifest>
  87         </jar>
  88     </target>
  89     <target name="clean">
  90         <delete dir="${build.dir}"/>
  91     </target>
  92 </project>
  93 
  94