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