build.xml revision 935:d154edd416d4
1<?xml version="1.0" encoding="UTF-8"?> 2 3<!-- 4 Copyright (c) 2010, 2013, 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="nashorn.ext.path"> 36 <pathelement location="${dist.dir}"/> 37 </path> 38 <property name="ext.class.path" value="-Djava.ext.dirs="${toString:nashorn.ext.path}""/> 39 <condition property="svn.executable" value="/usr/local/bin/svn" else="svn"> 40 <available file="/usr/local/bin/svn"/> 41 </condition> 42 <condition property="hg.executable" value="/usr/local/bin/hg" else="hg"> 43 <available file="/usr/local/bin/hg"/> 44 </condition> 45 <condition property="git.executable" value="/usr/local/bin/git" else="git"> 46 <available file="/usr/local/bin/git"/> 47 </condition> 48 <!-- check if JDK already has ASM classes --> 49 <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/> 50 <!-- check if testng.jar is avaiable --> 51 <available property="testng.available" file="${file.reference.testng.jar}"/> 52 <!-- check if Jemmy ang testng.jar are avaiable --> 53 <condition property="jemmy.jfx.testng.available" value="true"> 54 <and> 55 <available file="${file.reference.jemmyfx.jar}"/> 56 <available file="${file.reference.jemmycore.jar}"/> 57 <available file="${file.reference.jemmyawtinput.jar}"/> 58 <available file="${file.reference.jfxrt.jar}"/> 59 <isset property="testng.available"/> 60 </and> 61 </condition> 62 63 <!-- enable/disable make code coverage --> 64 <condition property="cc.enabled"> 65 <istrue value="${make.code.coverage}" /> 66 </condition> 67 68 <!-- exclude tests in exclude lists --> 69 <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt"> 70 <istrue value="${make.code.coverage}" /> 71 </condition> 72 73 <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else=""> 74 <istrue value="${jfr}"/> 75 </condition> 76 </target> 77 78 <target name="init" depends="init-conditions, init-cc"> 79 <!-- extends jvm args --> 80 <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/> 81 <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/> 82 83 <echo message="run.test.jvmargs=${run.test.jvmargs}"/> 84 <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/> 85 <echo message="run.test.xms=${run.test.xms}"/> 86 <echo message="run.test.xmx=${run.test.xmx}"/> 87 88 </target> 89 90 <target name="prepare" depends="init"> 91 <mkdir dir="${build.dir}"/> 92 <mkdir dir="${build.classes.dir}"/> 93 <mkdir dir="${build.classes.dir}/META-INF/services"/> 94 <mkdir dir="${build.test.classes.dir}"/> 95 <mkdir dir="${dist.dir}"/> 96 <mkdir dir="${dist.javadoc.dir}"/> 97 </target> 98 99 <target name="clean" depends="init, clean-nasgen, init-cc-cleanup"> 100 <delete includeemptydirs="true"> 101 <fileset dir="${build.dir}" erroronmissingdir="false"/> 102 </delete> 103 <delete dir="${dist.dir}"/> 104 </target> 105 106 <!-- do it only if ASM is not available --> 107 <target name="compile-asm" depends="prepare" unless="asm.available"> 108 <javac srcdir="${jdk.asm.src.dir}" 109 destdir="${build.classes.dir}" 110 excludes="**/optimizer/* **/xml/* **/attrs/*" 111 source="${javac.source}" 112 target="${javac.target}" 113 debug="${javac.debug}" 114 encoding="${javac.encoding}" 115 includeantruntime="false"/> 116 </target> 117 118 <target name="compile" depends="compile-asm" description="Compiles nashorn"> 119 <javac srcdir="${src.dir}" 120 destdir="${build.classes.dir}" 121 classpath="${javac.classpath}" 122 source="${javac.source}" 123 target="${javac.target}" 124 debug="${javac.debug}" 125 encoding="${javac.encoding}" 126 includeantruntime="false" fork="true"> 127 <compilerarg value="-J-Djava.ext.dirs="/> 128 <compilerarg value="-Xlint:all"/> 129 <compilerarg value="-XDignore.symbol.file"/> 130 <compilerarg value="-Xdiags:verbose"/> 131 </javac> 132 <copy todir="${build.classes.dir}/META-INF/services"> 133 <fileset dir="${meta.inf.dir}/services/"/> 134 </copy> 135 <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources"> 136 <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/> 137 </copy> 138 <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources"> 139 <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/> 140 </copy> 141 <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources"> 142 <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/> 143 </copy> 144 <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/> 145 146 <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/> 147 <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo> 148 <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/> 149 </target> 150 151 <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar"> 152 <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> 153 <fileset dir="${build.classes.dir}"/> 154 <manifest> 155 <attribute name="Archiver-Version" value="n/a"/> 156 <attribute name="Build-Jdk" value="${java.runtime.version}"/> 157 <attribute name="Built-By" value="n/a"/> 158 <attribute name="Created-By" value="Ant jar task"/> 159 <section name="jdk/nashorn/"> 160 <attribute name="Implementation-Title" value="${nashorn.product.name}"/> 161 <attribute name="Implementation-Version" value="${nashorn.version}"/> 162 </section> 163 </manifest> 164 </jar> 165 </target> 166 167 <target name="use-promoted-nashorn" depends="init"> 168 <delete file="${dist.dir}/nashorn.jar"/> 169 <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/> 170 <property name="compile.suppress.jar" value="defined"/> 171 </target> 172 173 <target name="build-fxshell" depends="jar"> 174 <description>Builds the javafx shell.</description> 175 <mkdir dir="${fxshell.classes.dir}"/> 176 <javac srcdir="${fxshell.dir}" 177 destdir="${fxshell.classes.dir}" 178 classpath="${dist.jar}:${javac.classpath}" 179 debug="${javac.debug}" 180 encoding="${javac.encoding}" 181 includeantruntime="false"> 182 </javac> 183 <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> 184 <fileset dir="${fxshell.classes.dir}"/> 185 <manifest> 186 <attribute name="Archiver-Version" value="n/a"/> 187 <attribute name="Build-Jdk" value="${java.runtime.version}"/> 188 <attribute name="Built-By" value="n/a"/> 189 <attribute name="Created-By" value="Ant jar task"/> 190 <section name="jdk/nashorn/"> 191 <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/> 192 <attribute name="Implementation-Version" value="${nashorn.version}"/> 193 </section> 194 </manifest> 195 </jar> 196 </target> 197 198 <target name="javadoc" depends="jar"> 199 <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" 200 extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}" 201 additionalparam="-quiet" failonerror="true"> 202 <classpath> 203 <pathelement location="${build.classes.dir}"/> 204 </classpath> 205 <fileset dir="${src.dir}" includes="**/*.java"/> 206 <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/> 207 <link href="http://docs.oracle.com/javase/8/docs/api/"/> 208 <!-- The following tags are used only in ASM sources - just ignore these --> 209 <tag name="label" description="label tag in ASM sources" enabled="false"/> 210 <tag name="linked" description="linked tag in ASM sources" enabled="false"/> 211 <tag name="associates" description="associates tag in ASM sources" enabled="false"/> 212 </javadoc> 213 </target> 214 215 <!-- generate javadoc only for nashorn extension api classes --> 216 <target name="javadocapi" depends="jar"> 217 <javadoc destdir="${dist.javadoc.dir}" use="yes" extdirs="${nashorn.ext.path}" 218 windowtitle="${nashorn.product.name}" additionalparam="-quiet" failonerror="true"> 219 <classpath> 220 <pathelement location="${build.classes.dir}"/> 221 </classpath> 222 <fileset dir="${src.dir}" includes="jdk/nashorn/api/**/*.java"/> 223 <link href="http://docs.oracle.com/javase/8/docs/api/"/> 224 </javadoc> 225 </target> 226 227 228 <!-- generate shell.html for shell tool documentation --> 229 <target name="shelldoc" depends="jar"> 230 <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true"> 231 <jvmarg line="${ext.class.path}"/> 232 <arg value="-scripting"/> 233 <arg value="docs/genshelldoc.js"/> 234 </java> 235 </target> 236 237 <!-- generate all docs --> 238 <target name="docs" depends="javadoc, shelldoc"/> 239 240 <!-- create .zip and .tar.gz for nashorn binaries and scripts. --> 241 <target name="dist" depends="jar"> 242 <zip destfile="${build.zip}" basedir=".." 243 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> 244 <tar destfile="${build.gzip}" basedir=".." compression="gzip" 245 excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> 246 </target> 247 248 <target name="compile-test" depends="compile, run-nasgen" if="testng.available"> 249 <!-- testng task --> 250 <taskdef name="testng" classname="org.testng.TestNGAntTask" 251 classpath="${file.reference.testng.jar}"/> 252 253 <javac srcdir="${test.src.dir}" 254 destdir="${build.test.classes.dir}" 255 classpath="${javac.test.classpath}" 256 source="${javac.source}" 257 target="${javac.target}" 258 debug="${javac.debug}" 259 encoding="${javac.encoding}" 260 includeantruntime="false" fork="true"> 261 <compilerarg value="-J-Djava.ext.dirs="/> 262 <compilerarg value="-Xlint:unchecked"/> 263 <compilerarg value="-Xlint:deprecation"/> 264 <compilerarg value="-Xdiags:verbose"/> 265 </javac> 266 267 <copy todir="${build.test.classes.dir}/META-INF/services"> 268 <fileset dir="${test.src.dir}/META-INF/services/"/> 269 </copy> 270 271 <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources"> 272 <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/> 273 </copy> 274 275 <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources"> 276 <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/> 277 </copy> 278 279 <!-- tests that check nashorn internals and internal API --> 280 <jar jarfile="${nashorn.internal.tests.jar}"> 281 <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/> 282 </jar> 283 284 <!-- tests that check nashorn script engine (jsr-223) API --> 285 <jar jarfile="${nashorn.api.tests.jar}"> 286 <fileset dir="${build.test.classes.dir}" includes="**/api/**"/> 287 <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/> 288 <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/> 289 </jar> 290 291 </target> 292 293 <target name="generate-policy-file" depends="prepare"> 294 <echo file="${build.dir}/nashorn.policy"> 295 296grant codeBase "file:/${toString:nashorn.ext.path}/nashorn.jar" { 297 permission java.security.AllPermission; 298}; 299 300grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" { 301 permission java.security.AllPermission; 302}; 303 304grant codeBase "file:/${basedir}/${file.reference.testng.jar}" { 305 permission java.security.AllPermission; 306}; 307 308grant codeBase "file:/${basedir}/test/script/trusted/*" { 309 permission java.security.AllPermission; 310}; 311 312grant codeBase "file:/${basedir}/test/script/maptests/*" { 313 permission java.io.FilePermission "${basedir}/test/script/maptests/*","read"; 314 permission java.lang.RuntimePermission "nashorn.debugMode"; 315}; 316 317grant codeBase "file:/${basedir}/test/script/basic/*" { 318 permission java.io.FilePermission "${basedir}/test/script/-", "read"; 319 permission java.io.FilePermission "$${user.dir}", "read"; 320 permission java.util.PropertyPermission "user.dir", "read"; 321 permission java.util.PropertyPermission "nashorn.test.*", "read"; 322}; 323 324grant codeBase "file:/${basedir}/test/script/basic/parser/*" { 325 permission java.io.FilePermission "${basedir}/test/script/-", "read"; 326 permission java.io.FilePermission "$${user.dir}", "read"; 327 permission java.util.PropertyPermission "user.dir", "read"; 328 permission java.util.PropertyPermission "nashorn.test.*", "read"; 329}; 330 331grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { 332 permission java.util.PropertyPermission "java.security.policy", "read"; 333}; 334 335grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { 336 permission java.lang.RuntimePermission "nashorn.JavaReflection"; 337}; 338 339grant codeBase "file:/${basedir}/test/script/markdown.js" { 340 permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read"; 341}; 342 343 </echo> 344 345 <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Windows - to make URLs with normal path separators --> 346 <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace> <!--hack for Unix - to avoid leading // in URLs --> 347 348 </target> 349 350 <target name="check-external-tests"> 351 <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/> 352 <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/> 353 <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/> 354 <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/> 355 <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/> 356 <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/> 357 <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/> 358 <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/> 359 </target> 360 361 <target name="check-testng" unless="testng.available"> 362 <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/> 363 </target> 364 365 <!-- only to be invoked as dependency of "test" target --> 366 <target name="-test-classes-all" depends="jar" unless="test.class"> 367 <fileset id="test.classes" dir="${build.test.classes.dir}"> 368 <include name="**/api/javaaccess/*Test.class"/> 369 <include name="**/api/scripting/*Test.class"/> 370 <include name="**/codegen/*Test.class"/> 371 <include name="**/parser/*Test.class"/> 372 <include name="**/runtime/*Test.class"/> 373 <include name="**/runtime/regexp/*Test.class"/> 374 <include name="**/runtime/regexp/joni/*Test.class"/> 375 <include name="**/framework/*Test.class"/> 376 </fileset> 377 </target> 378 379 <!-- only to be invoked as dependency of "test" target --> 380 <target name="-test-classes-single" depends="jar" if="test.class"> 381 <fileset id="test.classes" dir="${build.test.classes.dir}"> 382 <include name="${test.class}*"/> 383 </fileset> 384 </target> 385 386 <!-- only to be invoked as dependency of "test" target --> 387 <target name="-test-nosecurity" unless="test.class"> 388 <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}"> 389 <include name="**/framework/ScriptTest.class"/> 390 </fileset> 391 <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes" 392 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 393 <jvmarg line="${ext.class.path}"/> 394 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 395 <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/> 396 <propertyset> 397 <propertyref prefix="nashorn."/> 398 </propertyset> 399 <propertyset> 400 <propertyref prefix="test-sys-prop-no-security."/> 401 <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/> 402 </propertyset> 403 <classpath> 404 <pathelement path="${run.test.classpath}"/> 405 </classpath> 406 </testng> 407 </target> 408 409 <!-- only to be invoked as dependency of "test" target --> 410 <target name="-test-security"> 411 <delete dir="${build.dir}/nashorn_code_cache"/> 412 <property name="debug.test.jvmargs" value=""/> 413 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 414 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 415 <jvmarg line="${ext.class.path}"/> 416 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 417 <jvmarg line="${debug.test.jvmargs}"/> 418 <propertyset> 419 <propertyref prefix="nashorn."/> 420 </propertyset> 421 <propertyset> 422 <propertyref prefix="test-sys-prop."/> 423 <mapper from="test-sys-prop.*" to="*" type="glob"/> 424 </propertyset> 425 <sysproperty key="test.js.excludes.file" value="${exclude.list}"/> 426 <classpath> 427 <pathelement path="${run.test.classpath}"/> 428 </classpath> 429 </testng> 430 </target> 431 432 <target name="test" depends="jar, -test-classes-all,-test-classes-single, check-testng, check-external-tests, compile-test, generate-policy-file, -test-security, -test-nosecurity" if="testng.available"/> 433 434 <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available"> 435 <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."/> 436 </target> 437 438 <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available"> 439 <fileset id="test.classes" dir="${build.test.classes.dir}"> 440 <include name="**/framework/*Test.class"/> 441 </fileset> 442 443 <copy file="${file.reference.jfxrt.jar}" todir="dist"/> 444 445 <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" "> 446 <not> 447 <os family="mac"/> 448 </not> 449 </condition> 450 451 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 452 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 453 <jvmarg line="${ext.class.path}"/> 454 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 455 <propertyset> 456 <propertyref prefix="testjfx-test-sys-prop."/> 457 <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/> 458 </propertyset> 459 <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/> 460 <classpath> 461 <pathelement path="${testjfx.run.test.classpath}"/> 462 </classpath> 463 </testng> 464 </target> 465 466 <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 467 <fileset id="test.classes" dir="${build.test.classes.dir}"> 468 <include name="**/framework/*Test.class"/> 469 </fileset> 470 471 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 472 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 473 <jvmarg line="${ext.class.path}"/> 474 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 475 <propertyset> 476 <propertyref prefix="testmarkdown-test-sys-prop."/> 477 <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/> 478 </propertyset> 479 <classpath> 480 <pathelement path="${run.test.classpath}"/> 481 </classpath> 482 </testng> 483 </target> 484 485 <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 486 <fileset id="test.classes" dir="${build.test.classes.dir}"> 487 <include name="**/framework/*Test.class"/> 488 </fileset> 489 490 <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes" 491 verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}"> 492 <jvmarg line="${ext.class.path}"/> 493 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 494 <propertyset> 495 <propertyref prefix="nashorn."/> 496 </propertyset> 497 <propertyset> 498 <propertyref prefix="test262-test-sys-prop."/> 499 <mapper from="test262-test-sys-prop.*" to="*" type="glob"/> 500 </propertyset> 501 <classpath> 502 <pathelement path="${run.test.classpath}"/> 503 </classpath> 504 </testng> 505 </target> 506 507 <target name="test262parallel" depends="test262-parallel"/> 508 509 <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 510 <!-- use just build.test.classes.dir to avoid referring to TestNG --> 511 <java classname="${parallel.test.runner}" dir="${basedir}" fork="true"> 512 <jvmarg line="${ext.class.path}"/> 513 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 514 <classpath> 515 <pathelement path="${run.test.classpath}"/> 516 </classpath> 517 <syspropertyset> 518 <propertyref prefix="test262-test-sys-prop."/> 519 <mapper type="glob" from="test262-test-sys-prop.*" to="*"/> 520 </syspropertyset> 521 </java> 522 </target> 523 524 <target name="testparallel" depends="test-parallel"/> 525 526 <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available"> 527 <!-- use just build.test.classes.dir to avoid referring to TestNG --> 528 <java classname="${parallel.test.runner}" dir="${basedir}" 529 failonerror="true" 530 fork="true"> 531 <jvmarg line="${ext.class.path}"/> 532 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/> 533 <classpath> 534 <pathelement path="${run.test.classpath}"/> 535 <pathelement path="${build.test.classes.dir}"/> 536 </classpath> 537 <syspropertyset> 538 <propertyref prefix="test-sys-prop."/> 539 <mapper type="glob" from="test-sys-prop.*" to="*"/> 540 </syspropertyset> 541 </java> 542 </target> 543 544 <target name="all" depends="test, docs" 545 description="Build, test and generate docs for nashorn"/> 546 547 <target name="run" depends="jar" 548 description="Run the shell with a sample script"> 549 <java classname="${nashorn.shell.tool}" fork="true" dir="samples"> 550 <jvmarg line="${ext.class.path}"/> 551 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 552 <arg value="-dump-on-error"/> 553 <arg value="test.js"/> 554 </java> 555 </target> 556 557 <target name="debug" depends="jar" 558 description="Debug the shell with a sample script"> 559 <java classname="${nashorn.shell.tool}" fork="true" dir="samples"> 560 <jvmarg line="${ext.class.path}"/> 561 <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/> 562 <arg value="--print-code"/> 563 <arg value="--verify-code"/> 564 <arg value="--print-symbols"/> 565 <jvmarg value="-Dnashorn.codegen.debug=true"/> 566 <arg value="test.js"/> 567 </java> 568 </target> 569 570 <!-- targets to get external script tests --> 571 572 <!-- test262 test suite --> 573 <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}"> 574 <!-- clone test262 git repo --> 575 <exec executable="${git.executable}"> 576 <arg value="clone"/> 577 <arg value="https://github.com/tc39/test262"/> 578 <arg value="${test.external.dir}/test262"/> 579 </exec> 580 </target> 581 <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}"> 582 <!-- update test262 git repo --> 583 <exec executable="${git.executable}" dir="${test.external.dir}/test262"> 584 <arg value="pull"/> 585 </exec> 586 </target> 587 588 <!-- octane benchmark --> 589 <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}"> 590 <!-- checkout octane benchmarks --> 591 <exec executable="${svn.executable}"> 592 <arg value="--non-interactive"/> 593 <arg value="--trust-server-cert"/> 594 <arg value="checkout"/> 595 <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/> 596 <arg value="${test.external.dir}/octane"/> 597 </exec> 598 </target> 599 <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}"> 600 <!-- update octane benchmarks --> 601 <exec executable="${svn.executable}" dir="${test.external.dir}/octane"> 602 <arg value="--non-interactive"/> 603 <arg value="--trust-server-cert"/> 604 <arg value="update"/> 605 </exec> 606 </target> 607 608 <!-- sunspider benchmark --> 609 <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}"> 610 <!-- checkout sunspider --> 611 <exec executable="${svn.executable}"> 612 <arg value="--non-interactive"/> 613 <arg value="--trust-server-cert"/> 614 <arg value="checkout"/> 615 <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/> 616 <arg value="${test.external.dir}/sunspider"/> 617 </exec> 618 </target> 619 <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}"> 620 <!-- update sunspider --> 621 <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider"> 622 <arg value="--non-interactive"/> 623 <arg value="--trust-server-cert"/> 624 <arg value="update"/> 625 </exec> 626 </target> 627 628 <!-- get all external test scripts --> 629 <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider"> 630 <!-- make external test dir --> 631 <mkdir dir="${test.external.dir}"/> 632 633 <!-- jquery --> 634 <mkdir dir="${test.external.dir}/jquery"/> 635 <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/> 636 <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/> 637 638 <!-- prototype --> 639 <mkdir dir="${test.external.dir}/prototype"/> 640 <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"/> 641 642 <!-- underscorejs --> 643 <mkdir dir="${test.external.dir}/underscore"/> 644 <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/> 645 <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/> 646 647 <!-- yui --> 648 <mkdir dir="${test.external.dir}/yui"/> 649 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> 650 <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/> 651 652 <!-- showdown --> 653 <mkdir dir="${test.external.dir}/showdown"/> 654 <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> 655 <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/> 656 657 </target> 658 659 <!-- update external test suites that are pulled from source control systems --> 660 <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/> 661 662 <!-- run all perf tests --> 663 <target name="perf" depends="externals, update-externals, sunspider, octane"/> 664 665 <!-- run all tests --> 666 <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}"> 667 <fail message="Exiting.."/> 668 </target> 669 670 <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/> 671 672 <import file="build-benchmark.xml"/> 673 674</project> 675