build.xml revision 1447:40f468a095c6
1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- 4 Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. 5 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 7 This code is free software; you can redistribute it and/or modify it 8 under the terms of the GNU General Public License version 2 only, as 9 published by the Free Software Foundation. 10 11 This code is distributed in the hope that it will be useful, but WITHOUT 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 version 2 for more details (a copy is included in the LICENSE file that 15 accompanied this code). 16 17 You should have received a copy of the GNU General Public License version 18 2 along with this work; if not, write to the Free Software Foundation, 19 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 21 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 or visit www.oracle.com if you need additional information or have any 23 questions. 24--> 25 26<project name="nashorn" default="test" basedir=".."> 27 <import file="build-nasgen.xml"/> 28 <import file="code_coverage.xml"/> 29 30 <target name="init-conditions"> 31 <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later --> 32 <property file="${user.home}/.nashorn.project.local.properties"/> 33 34 <loadproperties srcFile="make/project.properties"/> 35 <path id="dist.path"> 36 <pathelement location="${dist.dir}"/> 37 </path> 38 <path id="nashorn.boot.prefix.path"> 39 <pathelement location="${dist.jar}"/> 40 </path> 41 <property name="boot.class.path" value="-Xbootclasspath/p:${toString:nashorn.boot.prefix.path}"/> 42 <condition property="svn.executable" value="/usr/local/bin/svn" else="svn"> 43 <available file="/usr/local/bin/svn"/> 44 </condition> 45 <condition property="hg.executable" value="/usr/local/bin/hg" else="hg"> 46 <available file="/usr/local/bin/hg"/> 47 </condition> 48 <condition property="git.executable" value="/usr/local/bin/git" else="git"> 49 <available file="/usr/local/bin/git"/> 50 </condition> 51 <!-- check if testng.jar is avaiable, and download it if it isn't --> 52 <available property="testng.already.present" file="${file.reference.testng.jar}"/> 53 <antcall target="get-testng"/> 54 <available property="testng.available" file="${file.reference.testng.jar}"/> 55 <!-- check if Jemmy ang testng.jar are avaiable --> 56 <condition property="jemmy.jfx.testng.available" value="true"> 57 <and> 58 <available file="${file.reference.jemmyfx.jar}"/> 59 <available file="${file.reference.jemmycore.jar}"/> 60 <available file="${file.reference.jemmyawtinput.jar}"/> 61 <available file="${file.reference.jfxrt.jar}"/> 62 <isset property="testng.available"/> 63 </and> 64 </condition> 65 66 <!-- enable/disable make code coverage --> 67 <condition property="cc.enabled"> 68 <istrue value="${make.code.coverage}" /> 69 </condition> 70 71 <!-- exclude tests in exclude lists --> 72 <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt"> 73 <istrue value="${make.code.coverage}" /> 74 </condition> 75 76 <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else=""> 77 <istrue value="${jfr}"/> 78 </condition> 79 </target> 80 81 <!-- check minimum ant version required to be 1.8.4 --> 82 <target name="check-ant-version"> 83 <property name="ant.version.required" value="1.8.4"/> 84 <antversion property="ant.current.version" /> 85 <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.8.4 or above."> 86 <condition> 87 <not> 88 <antversion atleast="${ant.version.required}"/> 89 </not> 90 </condition> 91 </fail> 92 </target> 93 94 <target name="check-java-version"> 95 <!-- look for a Class that is available only in jdk1.8 or above --> 96 <!-- core/exposed API class is better than an implementation class --> 97 <available property="jdk1.8+" classname="java.util.stream.Stream"/> 98 99 <!-- need jdk1.8 or above --> 100 <fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+"> 101 </fail> 102 </target> 103 104 <target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc"> 105 <!-- extends jvm args --> 106 <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/> 107 <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/> 108 109 <echo message="run.test.jvmargs=${run.test.jvmargs}"/> 110 <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/> 111 <echo message="run.test.xms=${run.test.xms}"/> 112 <echo message="run.test.xmx=${run.test.xmx}"/> 113 114 </target> 115 116 <target name="prepare" depends="init"> 117 <mkdir dir="${build.dir}"/> 118 <mkdir dir="${build.classes.dir}"/> 119 <mkdir dir="${build.classes.dir}/META-INF/services"/> 120 <mkdir dir="${build.test.classes.dir}"/> 121 <mkdir dir="${dist.dir}"/> 122 <mkdir dir="${dist.javadoc.dir}"/> 123 </target> 124 125 <target name="clean" depends="init, clean-nasgen, init-cc-cleanup"> 126 <delete includeemptydirs="true"> 127 <fileset dir="${build.dir}" erroronmissingdir="false"/> 128 </delete> 129 <delete dir="${dist.dir}"/> 130 </target> 131 132 <target name="compile" depends="prepare" description="Compiles nashorn"> 133 <javac srcdir="${src.dir}" 134 destdir="${build.classes.dir}" 135 classpath="${javac.classpath}" 136 source="${javac.source}" 137 target="${javac.target}" 138 debug="${javac.debug}" 139 encoding="${javac.encoding}" 140 includeantruntime="false" fork="true"> 141 <compilerarg value="-Xlint:all"/> 142 <compilerarg value="-XDignore.symbol.file"/> 143 <compilerarg value="-Xdiags:verbose"/> 144 <compilerarg value="-parameters"/> 145 </javac> 146 <copy todir="${build.classes.dir}/META-INF/services"> 147 <fileset dir="${meta.inf.dir}/services/"/> 148 </copy> 149 <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources"> 150 <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/api/scripting/resources/"/> 151 </copy> 152 <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources"> 153 <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/internal/runtime/resources/"/> 154 </copy> 155 <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources"> 156 <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/tools/resources/"/> 157 </copy> 158 <copy file="${nashorn.module.src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/> 159 <copy file="${nashorn.module.src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${build.classes.dir}/jdk/nashorn/internal/codegen"/> 160 161 <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/> 162 <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo> 163 <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/> 164 </target> 165 166 <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar"> 167 <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> 168 <!-- 169 Exclude jjs classes from nashorn.jar to avoid desktop dependency. 170 We have a test to make sure basic nashorn code has only "compact1" 171 dependency - except for jjs shell code which has desktop dependency. 172 --> 173 <fileset dir="${build.classes.dir}"> 174 <exclude name="**/jdk/nashorn/tools/jjs/*"/> 175 </fileset> 176 <manifest> 177 <attribute name="Archiver-Version" value="n/a"/> 178 <attribute name="Build-Jdk" value="${java.runtime.version}"/> 179 <attribute name="Built-By" value="n/a"/> 180 <attribute name="Created-By" value="Ant jar task"/> 181 <section name="jdk/nashorn/"> 182 <attribute name="Implementation-Title" value="${nashorn.product.name}"/> 183 <attribute name="Implementation-Version" value="${nashorn.version}"/> 184 </section> 185 </manifest> 186 </jar> 187 </target> 188 189 <target name="use-promoted-nashorn" depends="init"> 190 <delete file="${dist.dir}/nashorn.jar"/> 191 <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/> 192 <property name="compile.suppress.jar" value="defined"/> 193 </target> 194 195 <target name="build-fxshell" depends="jar"> 196 <description>Builds the javafx shell.</description> 197 <mkdir dir="${fxshell.classes.dir}"/> 198 <javac srcdir="${fxshell.dir}" 199 destdir="${fxshell.classes.dir}" 200 classpath="${dist.jar}${path.separator}${javac.classpath}" 201 debug="${javac.debug}" 202 encoding="${javac.encoding}" 203 includeantruntime="false"> 204 </javac> 205 <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> 206 <fileset dir="${fxshell.classes.dir}"/> 207 <manifest> 208 <attribute name="Archiver-Version" value="n/a"/> 209 <attribute name="Build-Jdk" value="${java.runtime.version}"/> 210 <attribute name="Built-By" value="n/a"/> 211 <attribute name="Created-By" value="Ant jar task"/> 212 <section name="jdk/nashorn/"> 213 <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/> 214 <attribute name="Implementation-Version" value="${nashorn.version}"/> 215 </section> 216 </manifest> 217 </jar> 218 </target> 219 220 <!-- generate javadoc for all Nashorn and ASM classes --> 221 <target name="javadoc" depends="jar"> 222 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html" 223 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}" 224 additionalparam="-quiet" failonerror="true" useexternalfile="true"> 225 <classpath> 226 <pathelement location="${build.classes.dir}"/> 227 </classpath> 228 <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/> 229 <fileset dir="${nashorn.shell.module.src.dir}" includes="**/*.java"/> 230 <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/> 231 <link href="http://docs.oracle.com/javase/8/docs/api/"/> 232 <!-- The following tags are used only in ASM sources - just ignore these --> 233 <tag name="label" description="label tag in ASM sources" enabled="false"/> 234 <tag name="linked" description="linked tag in ASM sources" enabled="false"/> 235 <tag name="associates" description="associates tag in ASM sources" enabled="false"/> 236 </javadoc> 237 </target> 238 239 <!-- generate javadoc for Nashorn classes --> 240 <target name="javadocnh" depends="jar"> 241 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html" 242 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}" 243 additionalparam="-quiet" failonerror="true" useexternalfile="true"> 244 <classpath> 245 <pathelement location="${build.classes.dir}"/> 246 </classpath> 247 <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/> 248 <fileset dir="${nashorn.shell.module.src.dir}" includes="**/*.java"/> 249 <link href="http://docs.oracle.com/javase/8/docs/api/"/> 250 </javadoc> 251 </target> 252 253 <!-- generate javadoc only for nashorn extension api classes --> 254 <target name="javadocapi" depends="jar"> 255 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html" 256 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}" 257 additionalparam="-quiet" failonerror="true" useexternalfile="true"> 258 <classpath> 259 <pathelement location="${build.classes.dir}"/> 260 </classpath> 261 <fileset dir="${nashorn.module.src.dir}" includes="jdk/nashorn/api/**/*.java"/> 262 <link href="http://docs.oracle.com/javase/8/docs/api/"/> 263 </javadoc> 264 </target> 265 266 267 <!-- generate shell.html for shell tool documentation --> 268 <target name="shelldoc" depends="jar"> 269 <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true"> 270 <jvmarg line="${boot.class.path}"/> 271 <arg value="-scripting"/> 272 <arg value="docs/genshelldoc.js"/> 273 </java> 274 </target> 275 276 <!-- generate all docs --> 277 <target name="docs" depends="javadoc, shelldoc"/> 278 279 <!-- create .zip and .tar.gz for nashorn binaries and scripts. --> 280 <target name="dist" depends="jar"> 281 <zip destfile="${build.zip}" basedir=".." 282 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> 283 <tar destfile="${build.gzip}" basedir=".." compression="gzip" 284 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> 285 </target> 286 287 <target name="compile-test" depends="compile, run-nasgen" if="testng.available"> 288 <!-- testng task --> 289 <taskdef name="testng" classname="org.testng.TestNGAntTask" 290 classpath="${file.reference.testng.jar}"/> 291 292 <javac srcdir="${test.src.dir}" 293 destdir="${build.test.classes.dir}" 294 classpath="${javac.test.classpath}" 295 source="${javac.source}" 296 target="${javac.target}" 297 debug="${javac.debug}" 298 encoding="${javac.encoding}" 299 includeantruntime="false" fork="true"> 300 <compilerarg value="${boot.class.path}"/> 301 <compilerarg value="-Xlint:unchecked"/> 302 <compilerarg value="-Xlint:deprecation"/> 303 <compilerarg value="-Xdiags:verbose"/> 304 </javac> 305 306 <copy todir="${build.test.classes.dir}/META-INF/services"> 307 <fileset dir="${test.src.dir}/META-INF/services/"/> 308 </copy> 309 310 <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/test/resources"> 311 <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/test/resources"/> 312 </copy> 313 314 <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/test/resources"> 315 <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/test/resources"/> 316 </copy> 317 318 <!-- tests that check nashorn internals and internal API --> 319 <jar jarfile="${nashorn.internal.tests.jar}"> 320 <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/> 321 </jar> 322 323 <!-- tests that check nashorn script engine (jsr-223) API --> 324 <jar jarfile="${nashorn.api.tests.jar}"> 325 <fileset dir="${build.test.classes.dir}" includes="**/api/**"/> 326 <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/> 327 <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/> 328 </jar> 329 330 </target> 331 332 <target name="generate-policy-file" depends="prepare"> 333 <echo file="${build.dir}/nashorn.policy"> 334 335grant codeBase "file:/${toString:dist.path}/nashorn.jar" { 336 permission java.security.AllPermission; 337}; 338 339grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" { 340 permission java.security.AllPermission; 341}; 342 343grant codeBase "file:/${basedir}/${nashorn.api.tests.jar}" { 344 permission java.util.PropertyPermission "parserapitest.*", "read"; 345 permission java.util.PropertyPermission "test.*", "read"; 346 permission java.util.PropertyPermission "test262.*", "read"; 347 permission java.io.FilePermission "${basedir}/test/-","read"; 348 permission java.io.FilePermission "$${user.dir}", "read"; 349 permission java.util.PropertyPermission "user.dir", "read"; 350}; 351 352grant codeBase "file:/${basedir}/${file.reference.testng.jar}" { 353 permission java.security.AllPermission; 354}; 355//// in case of absolute path: 356grant codeBase "file:/${nashorn.internal.tests.jar}" { 357 permission java.security.AllPermission; 358}; 359 360grant codeBase "file:/${file.reference.testng.jar}" { 361 permission java.security.AllPermission; 362}; 363 364grant codeBase "file:/${basedir}/test/script/trusted/*" { 365 permission java.security.AllPermission; 366}; 367 368grant codeBase "file:/${basedir}/test/script/maptests/*" { 369 permission java.io.FilePermission "${basedir}/test/script/maptests/*","read"; 370 permission java.lang.RuntimePermission "nashorn.debugMode"; 371}; 372 373grant codeBase "file:/${basedir}/test/script/basic/*" { 374 permission java.io.FilePermission "${basedir}/test/script/-", "read"; 375 permission java.io.FilePermission "$${user.dir}", "read"; 376 permission java.util.PropertyPermission "user.dir", "read"; 377 permission java.util.PropertyPermission "nashorn.test.*", "read"; 378}; 379 380grant codeBase "file:/${basedir}/test/script/basic/parser/*" { 381 permission java.io.FilePermission "${basedir}/test/script/-", "read"; 382 permission java.io.FilePermission "$${user.dir}", "read"; 383 permission java.util.PropertyPermission "user.dir", "read"; 384 permission java.util.PropertyPermission "nashorn.test.*", "read"; 385}; 386 387grant codeBase "file:/${basedir}/test/script/basic/es6/*" { 388 permission java.io.FilePermission "${basedir}/test/script/-", "read"; 389 permission java.io.FilePermission "$${user.dir}", "read"; 390 permission java.util.PropertyPermission "user.dir", "read"; 391 permission java.util.PropertyPermission "nashorn.test.*", "read"; 392}; 393 394grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { 395 permission java.util.PropertyPermission "java.security.policy", "read"; 396}; 397 398grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { 399 permission java.lang.RuntimePermission "nashorn.JavaReflection"; 400}; 401 402grant codeBase "file:/${basedir}/test/script/markdown.js" { 403 permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read"; 404}; 405 406 </echo> 407 408 <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators --> 409 <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs --> 410 411 </target> 412 413 <target name="check-external-tests"> 414 <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/> 415 <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/> 416 <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/> 417 <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/> 418 <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/> 419 <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/> 420 <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/> 421 <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/> 422 </target> 423 424 <target name="check-testng" unless="testng.available"> 425 <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/> 426 </target> 427 428 <!-- only to be invoked as dependency of "test" target --> 429 <target name="-test-classes-all" depends="jar" unless="test.class"> 430 <fileset id="test.classes" dir="${build.test.classes.dir}"> 431 <include name="**/api/javaaccess/test/*Test.class"/> 432 <include name="**/api/scripting/test/*Test.class"/> 433 <include name="**/api/tree/test/*Test.class"/> 434 <include name="**/codegen/test/*Test.class"/> 435 <include name="**/parser/test/*Test.class"/> 436 <include name="**/runtime/test/*Test.class"/> 437 <include name="**/runtime/regexp/test/*Test.class"/> 438 <include name="**/runtime/regexp/joni/test/*Test.class"/> 439 <include name="**/framework/*Test.class"/> 440 </fileset> 441 </target> 442 443 <!-- only to be invoked as dependency of "test" target --> 444 <target name="-test-classes-single" depends="jar" if="test.class"> 445 <fileset id="test.classes" dir="${build.test.classes.dir}"> 446 <include name="${test.class}*"/> 447 </fileset> 448 </target> 449 450 <!-- only to be invoked as dependency of "test" target --> 451 <target name="-test-nosecurity" unless="test.class"> 452 <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}"> 453 <include name="**/framework/ScriptTest.class"/> 454 </fileset> 455 <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes" 456 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 457 <jvmarg line="${boot.class.path}"/> 458 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/> 459 <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/> 460 <propertyset> 461 <propertyref prefix="nashorn."/> 462 </propertyset> 463 <propertyset> 464 <propertyref prefix="test-sys-prop-no-security."/> 465 <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/> 466 </propertyset> 467 <sysproperty key="optimistic.override" value="${optimistic}"/> 468 <classpath> 469 <pathelement path="${run.test.classpath}"/> 470 </classpath> 471 </testng> 472 </target> 473 474 <!-- only to be invoked as dependency of "test" target --> 475 <target name="-test-security"> 476 <delete dir="${build.dir}/nashorn_code_cache"/> 477 <property name="debug.test.jvmargs" value=""/> 478 <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes" 479 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 480 <jvmarg line="${boot.class.path}"/> 481 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> 482 <jvmarg line="${debug.test.jvmargs}"/> 483 <propertyset> 484 <propertyref prefix="nashorn."/> 485 </propertyset> 486 <propertyset> 487 <propertyref prefix="test-sys-prop."/> 488 <mapper from="test-sys-prop.*" to="*" type="glob"/> 489 </propertyset> 490 <sysproperty key="optimistic.override" value="${optimistic}"/> 491 <sysproperty key="test.js.excludes.file" value="${exclude.list}"/> 492 <classpath> 493 <pathelement path="${run.test.classpath}"/> 494 </classpath> 495 </testng> 496 </target> 497 498 <target name="test" depends="prepare, javadocnh, test-pessimistic, test-optimistic"/> 499 500 <target name="test-optimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 501 <echo message="Running test suite in OPTIMISTIC mode..."/> 502 <antcall target="-test-nosecurity" inheritRefs="true"> 503 <param name="optimistic" value="true"/> 504 <param name="testResultsSubDir" value="optimistic"/> 505 </antcall> 506 <antcall target="-test-security" inheritRefs="true"> 507 <param name="optimistic" value="true"/> 508 <param name="testResultsSubDir" value="optimistic"/> 509 </antcall> 510 </target> 511 512 <target name="test-pessimistic" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 513 <echo message="Running test suite in PESSIMISTIC mode..."/> 514 <antcall target="-test-nosecurity" inheritRefs="true"> 515 <param name="optimistic" value="false"/> 516 <param name="testResultsSubDir" value="pessimistic"/> 517 </antcall> 518 <antcall target="-test-security" inheritRefs="true"> 519 <param name="optimistic" value="false"/> 520 <param name="testResultsSubDir" value="pessimistic"/> 521 </antcall> 522 </target> 523 524 <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available"> 525 <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy testng.jar, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar under test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/> 526 </target> 527 528 <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available"> 529 <fileset id="test.classes" dir="${build.test.classes.dir}"> 530 <include name="**/framework/*Test.class"/> 531 </fileset> 532 533 <copy file="${file.reference.jfxrt.jar}" todir="dist"/> 534 535 <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" "> 536 <not> 537 <os family="mac"/> 538 </not> 539 </condition> 540 541 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 542 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 543 <jvmarg line="${boot.class.path}"/> 544 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/> 545 <propertyset> 546 <propertyref prefix="testjfx-test-sys-prop."/> 547 <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/> 548 </propertyset> 549 <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/> 550 <classpath> 551 <pathelement path="${testjfx.run.test.classpath}"/> 552 </classpath> 553 </testng> 554 </target> 555 556 <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 557 <fileset id="test.classes" dir="${build.test.classes.dir}"> 558 <include name="**/framework/*Test.class"/> 559 </fileset> 560 561 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 562 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 563 <jvmarg line="${boot.class.path}"/> 564 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> 565 <propertyset> 566 <propertyref prefix="testmarkdown-test-sys-prop."/> 567 <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/> 568 </propertyset> 569 <classpath> 570 <pathelement path="${run.test.classpath}"/> 571 </classpath> 572 </testng> 573 </target> 574 575 <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 576 <fileset id="test.classes" dir="${build.test.classes.dir}"> 577 <include name="**/framework/*Test.class"/> 578 </fileset> 579 580 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 581 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 582 <jvmarg line="${boot.class.path}"/> 583 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> 584 <propertyset> 585 <propertyref prefix="nashorn."/> 586 </propertyset> 587 <propertyset> 588 <propertyref prefix="test262-test-sys-prop."/> 589 <mapper from="test262-test-sys-prop.*" to="*" type="glob"/> 590 </propertyset> 591 <classpath> 592 <pathelement path="${run.test.classpath}"/> 593 </classpath> 594 </testng> 595 </target> 596 597 <target name="test262parallel" depends="test262-parallel"/> 598 599 <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 600 <!-- use just build.test.classes.dir to avoid referring to TestNG --> 601 <java classname="${parallel.test.runner}" dir="${basedir}" fork="true"> 602 <jvmarg line="${boot.class.path}"/> 603 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/> 604 <!-- avoid too many typeinfo cache files. Each script is run only once anyway --> 605 <jvmarg line="-Dnashorn.typeInfo.disabled=true"/> 606 <classpath> 607 <pathelement path="${run.test.classpath}"/> 608 </classpath> 609 <syspropertyset> 610 <propertyref prefix="test262-test-sys-prop."/> 611 <mapper type="glob" from="test262-test-sys-prop.*" to="*"/> 612 </syspropertyset> 613 </java> 614 </target> 615 616 <target name="testparallel" depends="test-parallel"/> 617 618 <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 619 <!-- use just build.test.classes.dir to avoid referring to TestNG --> 620 <java classname="${parallel.test.runner}" dir="${basedir}" 621 failonerror="true" 622 fork="true"> 623 <jvmarg line="${boot.class.path}"/> 624 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 625 <classpath> 626 <pathelement path="${run.test.classpath}"/> 627 <pathelement path="${build.test.classes.dir}"/> 628 </classpath> 629 <syspropertyset> 630 <propertyref prefix="test-sys-prop."/> 631 <mapper type="glob" from="test-sys-prop.*" to="*"/> 632 </syspropertyset> 633 </java> 634 </target> 635 636 <target name="all" depends="test, docs" 637 description="Build, test and generate docs for nashorn"/> 638 639 <target name="run" depends="jar" 640 description="Run the shell with a sample script"> 641 <java classname="${nashorn.shell.tool}" fork="true" dir="samples"> 642 <jvmarg line="${boot.class.path}"/> 643 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 644 <arg value="-dump-on-error"/> 645 <arg value="test.js"/> 646 </java> 647 </target> 648 649 <target name="debug" depends="jar" 650 description="Debug the shell with a sample script"> 651 <java classname="${nashorn.shell.tool}" fork="true" dir="samples"> 652 <jvmarg line="${boot.class.path}"/> 653 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 654 <arg value="--print-code"/> 655 <arg value="--verify-code"/> 656 <arg value="--print-symbols"/> 657 <jvmarg value="-Dnashorn.codegen.debug=true"/> 658 <arg value="test.js"/> 659 </java> 660 </target> 661 662 <!-- targets to get external script tests --> 663 664 <!-- test262 test suite --> 665 <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}"> 666 <!-- clone test262 git repo --> 667 <exec executable="${git.executable}"> 668 <arg value="clone"/> 669 <arg value="--branch"/> 670 <arg value="es5-tests"/> 671 <arg value="https://github.com/tc39/test262"/> 672 <arg value="${test.external.dir}/test262"/> 673 </exec> 674 </target> 675 <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}"> 676 <!-- update test262 git repo --> 677 <exec executable="${git.executable}" dir="${test.external.dir}/test262"> 678 <arg value="pull"/> 679 </exec> 680 </target> 681 682 <!-- octane benchmark --> 683 <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}"> 684 <!-- checkout octane benchmarks --> 685 <exec executable="${svn.executable}"> 686 <arg value="--non-interactive"/> 687 <arg value="--trust-server-cert"/> 688 <arg value="checkout"/> 689 <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/> 690 <arg value="${test.external.dir}/octane"/> 691 </exec> 692 </target> 693 <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}"> 694 <!-- update octane benchmarks --> 695 <exec executable="${svn.executable}" dir="${test.external.dir}/octane"> 696 <arg value="--non-interactive"/> 697 <arg value="--trust-server-cert"/> 698 <arg value="update"/> 699 </exec> 700 </target> 701 702 <!-- sunspider benchmark --> 703 <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}"> 704 <!-- checkout sunspider --> 705 <exec executable="${svn.executable}"> 706 <arg value="--non-interactive"/> 707 <arg value="--trust-server-cert"/> 708 <arg value="checkout"/> 709 <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/> 710 <arg value="${test.external.dir}/sunspider"/> 711 </exec> 712 </target> 713 <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}"> 714 <!-- update sunspider --> 715 <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider"> 716 <arg value="--non-interactive"/> 717 <arg value="--trust-server-cert"/> 718 <arg value="update"/> 719 </exec> 720 </target> 721 722 <!-- get all external test scripts --> 723 <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider"> 724 <!-- make external test dir --> 725 <mkdir dir="${test.external.dir}"/> 726 727 <!-- jquery --> 728 <mkdir dir="${test.external.dir}/jquery"/> 729 <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/> 730 <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/> 731 732 <!-- prototype --> 733 <mkdir dir="${test.external.dir}/prototype"/> 734 <get src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0/prototype.js" dest="${test.external.dir}/prototype" usetimestamp="true" skipexisting="true" ignoreerrors="true"/> 735 736 <!-- underscorejs --> 737 <mkdir dir="${test.external.dir}/underscore"/> 738 <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/> 739 <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/> 740 741 <!-- yui --> 742 <mkdir dir="${test.external.dir}/yui"/> 743 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> 744 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> 745 746 <!-- showdown --> 747 <mkdir dir="${test.external.dir}/showdown"/> 748 <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> 749 <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> 750 751 </target> 752 753 <!-- update external test suites that are pulled from source control systems --> 754 <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/> 755 756 <!-- run all perf tests --> 757 <target name="perf" depends="externals, update-externals, sunspider, octane"/> 758 759 <!-- download and install testng.jar --> 760 <target name="get-testng" unless="testng.already.present"> 761 <get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/> 762 <unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}"> 763 <patternset> 764 <include name="testng-6.8/testng-6.8.jar"/> 765 </patternset> 766 </unzip> 767 <move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/> 768 <delete dir="${test.lib}${file.separator}testng-6.8"/> 769 </target> 770 771 <!-- run all tests --> 772 <target name="alltests" depends="externals, update-externals, test, test262parallel, testmarkdown, perf"/> 773 774 <import file="build-benchmark.xml"/> 775 776</project> 777