1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<project name="jtreg" default="build" basedir="..">
<!-- ********** system-specific values ********************************* -->
<property file="build.properties"/> <!-- for user overrides -->
<property file="make/build.properties"/>
<!-- ********** general useful values ********************************** -->
<property environment="env"/>
<property name="src.bin.dir" location="src/share/bin"/>
<property name="src.classes.dir" location="src/share/classes"/>
<property name="src.doc.dir" location="src/share/doc"/>
<property name="test.dir" location="test"/>
<property name="build.dir" location="build"/>
<property name="build.checkstyle.dir" value="${build.dir}/checkstyle"/>
<property name="build.classes.dir" location="${build.dir}/classes" />
<property name="dist.dir" location="dist" />
<property name="dist.jtreg.dir" location="${dist.dir}/jtreg" />
<property name="dist.jtreg.zip" location="${dist.dir}/jtreg.zip" />
<property name="make.checkstyle.dir" value="make/checkstyle"/>
<patternset id="helpset">
<include name="*.hs"/>
<include name="default/**"/>
<include name="images/**"/>
</patternset>
<!-- ********** top level and shared targets *************************** -->
<target name="build" depends="dist-jtreg"
description="default build target: build jtreg for distribution"/>
<target name="clean" description="remove all generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- ********** init *************************************************** -->
<target name="-init">
<tstamp>
<format property="build.date" pattern="MM/dd/yyyy"/>
<format property="build.date.time" pattern="MM/dd/yyyy hh:mm aa"/>
</tstamp>
<available property="javatest.ok" file="${javatest.home}/COPYRIGHT-javatest.html"/>
<available property="jtharness.ok" file="${javatest.home}/legal/copyright.txt"/>
<available property="junit.ok" file="${junit.jar}"/>
<available property="testng.ok" file="${testng.jar}"/>
<available property="jcommander.ok" file="${jcommander.jar}"/>
<available property="asmtools.ok" file="${asmtools.jar}"/>
<condition property="jcov.ok">
<and>
<available file="${jcov.home}/lib/jcov.jar"/>
<available file="${jcov.home}/lib/jcov_network_saver.jar"/>
</and>
</condition>
</target>
<!-- ********** jtreg ************************************************** -->
<property name="src.jtreg.help" location="${src.doc.dir}/javatest/regtest/help"/>
<property name="build.jtreg.help" location="${build.classes.dir}/com/sun/javatest/regtest/help"/>
<patternset id="jtreg.packages">
<include name="com/sun/javatest/regtest/**"/>
<include name="com/sun/javatest/diff/**"/>
<include name="com/sun/javatest/diff/**"/>
<include name="java/lang/JTRegModuleHelper.*"/>
<include name="java/lang/reflect/JTRegModuleHelper.*"/>
</patternset>
<patternset id="jtreg.jdk11.files">
<include name="com/sun/javatest/regtest/agent/AppletWrapper.java"/>
<include name="com/sun/javatest/regtest/agent/GetSystemProperty.java"/>
<include name="com/sun/javatest/regtest/agent/MainWrapper.java"/>
<include name="com/sun/javatest/regtest/agent/RStatus.java"/>
<include name="com/sun/javatest/regtest/agent/StringArray.java"/>
</patternset>
<target name="dist-jtreg"
depends="import-javatest,import-junit,import-testng,import-asmtools,import-jcov,import-jtharness,jar-jtreg,-dist-jtreg.bin,-dist-jtreg.doc,-dist-jtreg.legal"
description="build jtreg for distribution">
<zip destfile="${dist.jtreg.zip}" filesOnly="true" basedir="${dist.dir}">
<include name="jtreg/"/>
</zip>
</target>
<target name="-dist-jtreg.bin" depends="jar-jtreg,-dist-jtreg.doc">
<copy file="${src.bin.dir}/jtreg.sh" tofile="${dist.jtreg.dir}/bin/jtreg"/>
<copy file="${src.bin.dir}/jtdiff.sh" tofile="${dist.jtreg.dir}/bin/jtdiff"/>
<chmod dir="${dist.jtreg.dir}" perm="+x">
<include name="bin/jtreg"/>
<include name="bin/jtdiff"/>
</chmod>
</target>
<target name="-dist-jtreg.doc" depends="-compile-jtreg.usage">
<mkdir dir="${dist.jtreg.dir}/doc/jtreg"/>
<copy todir="${dist.jtreg.dir}" file="${src.doc.dir}/javatest/regtest/README"/>
<copy todir="${dist.jtreg.dir}/doc/jtreg">
<fileset file="${src.doc.dir}/javatest/regtest/tag-spec.html"/>
<fileset file="${build.dir}/jtreg/usage.txt"/>
</copy>
</target>
<target name="-dist-jtreg.legal">
<copy todir="${dist.jtreg.dir}" file="COPYRIGHT"/>
<copy todir="${dist.jtreg.dir}" file="LICENSE"/>
</target>
<target name="jar-jtreg" depends="-init,-check-jtreg.jar" unless="jtreg.jar.ok">
<mkdir dir="${dist.jtreg.dir}/lib"/>
<jar destfile="${dist.jtreg.dir}/lib/jtreg.jar"
basedir="${build.classes.dir}" >
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="com.sun.javatest.regtest.Main"/>
<attribute name="Class-Path" value="javatest.jar jh.jar junit.jar"/>
<attribute name="jtreg-Name" value="jtreg"/>
<attribute name="jtreg-Version" value="${build.version}"/>
<attribute name="jtreg-Milestone" value="${build.milestone}"/>
<attribute name="jtreg-Build" value="${build.number}"/>
<attribute name="jtreg-BuildJavaVersion" value="${java.version}"/>
<attribute name="jtreg-BuildDate" value="${build.date.time}"/>
</manifest>
<include name="COPYRIGHT"/>
<include name="buildInfo.txt"/>
<patternset refid="jtreg.packages"/>
</jar>
</target>
<target name="-check-jtreg.jar" depends="compile-jtreg">
<dependset>
<srcfileset dir="${build.classes.dir}">
<patternset refid="jtreg.packages"/>
</srcfileset>
<targetfilelist dir="${dist.jtreg.dir}/lib" files="jtreg.jar"/>
</dependset>
<available property="jtreg.jar.ok" file="${dist.jtreg.dir}/lib/jtreg.jar"/>
</target>
<target name="compile-jtreg" depends="-compile-jtreg.classes,-compile-jtreg.resources"/>
<target name="-compile-jtreg.classes">
<mkdir dir="${build.classes.dir}"/>
<javac encoding="iso-8859-1" source="1.8" target="1.8"
debug="true" debuglevel="source,lines"
srcdir="${src.classes.dir}"
destdir="${build.classes.dir}"
classpath="${build.classes.dir}:${javatest.jar}:${junit.jar}:${testng.jar}"
includeantruntime="true">
<compilerarg line="-Xlint:all"/>
<patternset refid="jtreg.packages"/>
</javac>
</target>
<target name="-compile-jtreg.usage" depends="-compile-jtreg.classes,-ant-jct.utils">
<!-- generate the usage page from the command line help -->
<!-- have to set fork=true because otherwise output redirection gets screwed up -->
<mkdir dir="${build.dir}/jtreg"/>
<java fork="true" failonerror="true"
classname="com.sun.javatest.regtest.Main" classpath="${build.classes.dir}:${javatest.jar}:${junit.jar}:${jh.jar}"
output="${build.dir}/jtreg/usage.txt">
<jvmarg value="-Dprogram=jtreg"/>
<arg value="-help"/>
<arg value="all"/>
</java>
</target>
<target name="-compile-jtreg.resources">
<copy todir="${build.classes.dir}" file="COPYRIGHT"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.classes.dir}">
<patternset refid="jtreg.packages"/>
<include name="**/*.properties"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<!-- ********** imports ************************************************ -->
<target name="import-javatest" depends="-init,import-javahelp" if="javatest.ok">
<copy todir="${dist.jtreg.dir}/doc/javatest" file="${javatest.home}/doc/javatest/javatestGUI.pdf"/>
<copy tofile="${dist.jtreg.dir}/legal/javatest/copyright.html" file="${javatest.home}/COPYRIGHT-javatest.html"/>
<copy file="${javatest.jar}" tofile="${dist.jtreg.dir}/lib/javatest.jar"/>
</target>
<target name="import-junit" depends="-init" if="junit.ok">
<copy file="${junit.jar}" tofile="${dist.jtreg.dir}/lib/junit.jar"/>
</target>
<target name="import-testng" depends="-init,import-jcommander" if="testng.ok">
<copy file="${testng.jar}" tofile="${dist.jtreg.dir}/lib/testng.jar"/>
</target>
<target name="import-jcommander" depends="-init" if="jcommander.ok">
<copy file="${jcommander.jar}" tofile="${dist.jtreg.dir}/lib/jcommander.jar"/>
</target>
<target name="import-asmtools" depends="-init" if="asmtools.ok">
<copy file="${asmtools.jar}" tofile="${dist.jtreg.dir}/lib/asmtools.jar"/>
</target>
<target name="import-jcov" depends="-init" if="jcov.ok">
<copy file="${jcov.home}/lib/jcov.jar" tofile="${dist.jtreg.dir}/lib/jcov.jar"/>
<copy file="${jcov.home}/lib/jcov_network_saver.jar" tofile="${dist.jtreg.dir}/lib/jcov_network_saver.jar"/>
</target>
<target name="import-jtharness" depends="-init,import-javahelp" if="jtharness.ok">
<copy todir="${dist.jtreg.dir}/legal/jtharness" file="${javatest.home}/legal/copyright.txt"/>
<copy todir="${dist.jtreg.dir}/legal/jtharness" file="${javatest.home}/legal/license.txt"/>
<copy file="${javatest.jar}" tofile="${dist.jtreg.dir}/lib/javatest.jar"/>
</target>
<target name="import-javahelp" unless="javatest.includes.javahelp.ok">
<copy file="${jh.jar}" tofile="${dist.jtreg.dir}/lib/jh.jar"/>
</target>
<!-- ********** jct-utils ********************************************** -->
<target name="-ant-jct.utils" depends="-compile-jct.utils">
<taskdef name="i18ncheck" classname="com.sun.jct.utils.i18ncheck.Main$$Ant" classpath="${build.classes.dir}" />
</target>
<target name="-compile-jct.utils">
<mkdir dir="${build.classes.dir}"/>
<javac encoding="iso-8859-1" debug="true"
srcdir="${src.classes.dir}"
destdir="${build.classes.dir}"
includeantruntime="true">
<compilerarg value="-Xlint"/>
<include name="com/sun/jct/utils/i18ncheck/**"/>
</javac>
</target>
<target name="test-jtreg" depends="-test-jtreg.i18n,-test-jtreg.basic"
description="execute the main jtreg tests"/>
<target name="-test-jtreg.i18n" depends="dist-jtreg,-ant-jct.utils">
<!-- have to set fork=true because otherwise output redirection gets screwed up -->
<java fork="true" jar="${dist.jtreg.dir}/lib/jtreg.jar"
output="${build.dir}/jtreg.i18n" >
<sysproperty key="javatest.i18n.log" value="com.sun.javatest.regtest"/>
<arg value="-help"/>
</java>
<i18ncheck patternFile="make/i18n.pat">
<fileset dir="${src.classes.dir}/com/sun/javatest/regtest">
<include name="**/*.properties"/>
<include name="**/*.java"/>
</fileset>
<fileset file="${build.dir}/jtreg.i18n"/>
</i18ncheck>
</target>
<target name="-test-jtreg.basic" depends="dist-jtreg">
<delete dir="${build.dir}/basic"/>
<mkdir dir="${build.dir}/basic/classes"/>
<mkdir dir="${build.dir}/basic/report"/>
<mkdir dir="${build.dir}/basic/work/scratch"/>
<javac classpath="${dist.jtreg.dir}/lib/jtreg.jar"
srcdir="${test.dir}/basic"
destdir="${build.dir}/basic/classes"
includes="Basic.java">
<compilerarg value="-Xlint"/>
</javac>
<java classpath="${dist.jtreg.dir}/lib/jtreg.jar:${build.dir}/basic/classes" classname="Basic"
fork="true" dir="${build.dir}/basic/work/scratch" >
<sysproperty key="javatest.regtest.allowTrailingBuild" value="true"/>
<arg file="${test.dir}/share/basic"></arg>
<arg file="${build.dir}/basic/report"/>
<arg file="${build.dir}/basic/work"/>
<arg file="${java.home}/.."/>
<arg value="TESTJAVAHOME=${java.home},DISPLAY=${env.DISPLAY},HOME=${user.home}"/>
<arg value="-othervm"/>
</java>
<java fork="true" jar="${dist.jtreg.dir}/lib/jtreg.jar"
output="${build.dir}/jtreg/basic/report.out">
<arg value="-reportOnly"/>
<arg value="-automatic"/>
<arg value="-verbose"/>
<arg value="-reportDir"/>
<arg file="${build.dir}/basic/report2"/>
<arg value="-workDir"/>
<arg file="${build.dir}/basic/work"/>
<arg file="${test.dir}/share/basic"></arg>
</java>
<exec executable="grep" input="${build.dir}/jtreg/basic/report.out">
<arg value="-s"/>
<arg value="Test results: passed: 92; failed: 44; error: 87"/>
</exec>
</target>
<!-- checkstyle -->
<target name="checkstyle" depends="-def-checkstyle"
description="Generates reports for code convention violations.">
<mkdir dir="${build.checkstyle.dir}"/>
<checkstyle config="${make.checkstyle.dir}/checkstyle-jtreg.xml"
failureProperty="checkstyle.failure" failOnViolation="false">
<formatter type="xml" tofile="${build.checkstyle.dir}/checkstyle_report.xml"/>
<fileset dir="src/share/classes/" includes="**/*.java, **/*.properties"/>
</checkstyle>
<!-- transform the output to a simple html -->
<xslt in="${build.checkstyle.dir}/checkstyle_report.xml"
out="${build.checkstyle.dir}/checkstyle_report.html"
style="${checkstyle.home}/contrib/checkstyle-simple.xsl"/>
<!-- transform the output to a very simple emacs friendly text file -->
<xslt in="${build.checkstyle.dir}/checkstyle_report.xml"
out="${build.checkstyle.dir}/checkstyle_report.tmp"
style="${make.checkstyle.dir}/checkstyle-emacs.xsl"/>
<!-- beautify remove extra lines -->
<move file="${build.checkstyle.dir}/checkstyle_report.tmp"
toFile="${build.checkstyle.dir}/checkstyle_report.emacs.txt">
<filterchain>
<ignoreblank/>
<replaceregex byline="true" pattern="^File:" replace="${line.separator}File:"/>
</filterchain>
</move>
</target>
<!-- target can be invoked from an ide, the output of which can be used
to access and fix the errors directly.-->
<target name="checkstyle-ide" depends="checkstyle">
<concat>
<fileset file="${build.checkstyle.dir}/checkstyle_report.emacs.txt"/>
</concat>
</target>
<target name="-check-checkstyle.home" depends="-def-check">
<check name="checkstyle" property="checkstyle.home" marker="${checkstyle.name.version}.jar"/>
</target>
<target name="-def-checkstyle" unless="checkstyle.defined" depends="-check-checkstyle.home">
<taskdef resource="checkstyletask.properties">
<classpath>
<pathelement location="${checkstyle.home}/${checkstyle.name.version}-all.jar"/>
</classpath>
</taskdef>
<property name="checkstyle.defined" value="true"/>
</target>
<target name="-def-check">
<macrodef name="check">
<attribute name="name"/>
<attribute name="property"/>
<attribute name="marker" default=""/>
<sequential>
<fail message="Cannot locate @{name}: please set @{property} to its location">
<condition>
<not>
<isset property="@{property}"/>
</not>
</condition>
</fail>
<fail message="@{name} is not installed in ${@{property}}">
<condition>
<and>
<not>
<equals arg1="@{marker}" arg2=""/>
</not>
<not>
<available file="${@{property}}/@{marker}"/>
</not>
</and>
</condition>
</fail>
</sequential>
</macrodef>
</target>
</project>
|