1 <!--
  2  Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
  3 
  4  Redistribution and use in source and binary forms, with or without
  5  modification, are permitted provided that the following conditions
  6  are met:
  7 
  8    - Redistributions of source code must retain the above copyright
  9      notice, this list of conditions and the following disclaimer.
 10 
 11    - Redistributions in binary form must reproduce the above copyright
 12      notice, this list of conditions and the following disclaimer in the
 13      documentation and/or other materials provided with the distribution.
 14 
 15    - Neither the name of Oracle nor the names of its
 16      contributors may be used to endorse or promote products derived
 17      from this software without specific prior written permission.
 18 
 19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 20  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 21  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 22  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 23  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 24  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 25  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 26  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 27  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 28  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 29  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 -->
 31 
 32 <project name="J2DBench" default="dist" basedir=".">
 33     <description>
 34         simple example build file
 35     </description>
 36   <!-- set global properties for this build -->
 37   <property name="src" location="src"/>
 38   <property name="build" location="build"/>
 39   <property name="dist"  location="dist"/>
 40   <property name="resources"  location="resources"/>
 41 
 42   <condition property="source" value="7">
 43      <not>
 44         <isset property="source"/>
 45      </not>
 46   </condition>
 47   <condition property="target" value="7">
 48      <not>
 49         <isset property="target"/>
 50      </not>
 51   </condition>
 52   <condition property="java" value="java">
 53      <not>
 54         <isset property="java"/>
 55      </not>
 56   </condition>
 57   <condition property="javac" value="javac">
 58      <not>
 59         <isset property="javac"/>
 60      </not>
 61   </condition>
 62 
 63   <target name="init">
 64     <!-- Create the time stamp -->
 65     <tstamp/>
 66     <!-- Create the build directory structure used by compile -->
 67     <mkdir dir="${build}"/>
 68   </target>
 69 
 70   <target name="compile" depends="init"
 71         description="compile the source " >
 72     <!-- Compile the java code from ${src} into ${build} -->
 73     <javac debug="off" source="${source}" target="${target}" srcdir="${src}" destdir="${build}" fork="true" executable="${javac}"/>
 74   </target>
 75 
 76   <target name="run" depends="dist"
 77     description="run J2DBench" >
 78     <java jar="${dist}/J2DBench.jar"
 79        fork="true"
 80        jvm="${java}"
 81     >
 82     </java>
 83   </target>
 84 
 85   <target name="analyze" depends="dist"
 86     description="run J2DAnalyzer" >
 87     <java jar="${dist}/J2DAnalyzer.jar"
 88        fork="true"
 89        jvm="${java}"
 90     >
 91     </java>
 92   </target>
 93 
 94   <target name="resources" depends="init"
 95         description="copy resources into build dir" >
 96     <!-- Copy the resource files from ${resources} into ${build}/ -->
 97     <mkdir dir="${dist}"/>
 98     <mkdir dir="${build}/j2dbench/tests/text/textdata"/>
 99     <copy todir="${build}/j2dbench/tests/text/textdata">
100       <fileset dir="${resources}/textdata" />
101     </copy>
102     <mkdir dir="${build}/j2dbench/tests/iio/images"/>
103     <copy todir="${build}/j2dbench/tests/iio/images">
104       <fileset dir="${resources}/images" />
105     </copy>
106     <mkdir dir="${build}/j2dbench/tests/cmm/images"/>
107     <copy todir="${build}/j2dbench/tests/cmm/images">
108       <fileset dir="${resources}/cmm_images" />
109     </copy>
110   </target>
111 
112   <target name="dist" depends="compile, resources"
113         description="generate the distribution" >
114     <!-- Create the distribution directory -->
115     <mkdir dir="${dist}"/>
116 
117     <!-- Put everything in ${build} into the J2DBench.jar file -->
118     <jar jarfile="${dist}/J2DBench.jar" basedir="${build}"
119         excludes="j2dbench/report/**" >
120       <manifest>
121         <attribute name="Built-By" value="${user.name}"/>
122 	<attribute name="Main-Class" value="j2dbench.J2DBench"/>
123       </manifest>
124     </jar>
125     <jar jarfile="${dist}/J2DAnalyzer.jar" basedir="${build}"
126         includes="j2dbench/report/**" >
127       <manifest>
128         <attribute name="Built-By" value="${user.name}"/>
129 	<attribute name="Main-Class" value="j2dbench.report.J2DAnalyzer"/>
130       </manifest>
131     </jar>
132   </target>
133 
134   <target name="clean"
135         description="clean up" >
136     <!-- Delete the ${build} and ${dist} directory trees -->
137     <delete dir="${build}"/>
138     <delete dir="${dist}"/>
139   </target>
140 </project>