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