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     </javac>
 129     <copy todir="${build.classes.dir}/META-INF/services">
 130        <fileset dir="${meta.inf.dir}/services/"/>
 131     </copy>
 132      <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
 133        <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
 134     </copy>
 135     <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
 136        <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
 137     </copy>
 138     <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
 139        <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
 140     </copy>
 141     <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
 142 
 143     <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
 144     <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
 145     <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
 146   </target>
 147 
 148   <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
 149     <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
 150       <fileset dir="${build.classes.dir}"/>
 151       <manifest>
 152         <attribute name="Archiver-Version" value="n/a"/>
 153         <attribute name="Build-Jdk" value="${java.runtime.version}"/>
 154         <attribute name="Built-By" value="n/a"/>
 155         <attribute name="Created-By" value="Ant jar task"/>
 156         <section name="jdk/nashorn/">
 157           <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
 158           <attribute name="Implementation-Version" value="${nashorn.version}"/>
 159         </section>
 160       </manifest>
 161     </jar>
 162   </target>
 163 
 164   <target name="use-promoted-nashorn" depends="init">
 165     <delete file="${dist.dir}/nashorn.jar"/>
 166     <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
 167     <property name="compile.suppress.jar" value="defined"/>
 168   </target>
 169 
 170   <target name="build-fxshell" depends="jar">
 171     <description>Builds the javafx shell.</description>
 172     <mkdir dir="${fxshell.classes.dir}"/>
 173     <javac srcdir="${fxshell.dir}"
 174            destdir="${fxshell.classes.dir}"
 175            classpath="${dist.jar}:${javac.classpath}"
 176            debug="${javac.debug}"
 177            encoding="${javac.encoding}"
 178            includeantruntime="false">
 179     </javac>
 180     <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
 181       <fileset dir="${fxshell.classes.dir}"/>
 182       <manifest>
 183         <attribute name="Archiver-Version" value="n/a"/>
 184         <attribute name="Build-Jdk" value="${java.runtime.version}"/>
 185         <attribute name="Built-By" value="n/a"/>
 186         <attribute name="Created-By" value="Ant jar task"/>
 187         <section name="jdk/nashorn/">
 188           <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/>
 189           <attribute name="Implementation-Version" value="${nashorn.version}"/>
 190         </section>
 191       </manifest>
 192     </jar>
 193   </target>
 194 
 195   <target name="javadoc" depends="prepare">
 196     <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" windowtitle="${nashorn.product.name} ${nashorn.version}" additionalparam="-quiet" failonerror="true">
 197       <classpath>
 198         <pathelement location="${build.classes.dir}"/>
 199       </classpath>
 200       <fileset dir="${src.dir}" includes="**/*.java"/>
 201       <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
 202       <link href="http://docs.oracle.com/javase/7/docs/api/"/>
 203       <!-- The following tags are used only in ASM sources - just ignore these -->
 204       <tag name="label" description="label tag in ASM sources" enabled="false"/>
 205       <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
 206       <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
 207     </javadoc>
 208   </target>
 209 
 210   <!-- generate shell.html for shell tool documentation -->
 211   <target name="shelldoc" depends="jar">
 212     <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
 213       <jvmarg line="${ext.class.path}"/>
 214       <arg value="-scripting"/>
 215       <arg value="docs/genshelldoc.js"/>
 216     </java>
 217   </target>
 218 
 219   <!-- generate all docs -->
 220   <target name="docs" depends="javadoc, shelldoc"/>
 221 
 222   <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
 223   <target name="dist" depends="jar">
 224       <zip destfile="${build.zip}" basedir=".."
 225           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
 226       <tar destfile="${build.gzip}" basedir=".." compression="gzip"
 227           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
 228   </target>
 229 
 230   <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
 231     <!-- testng task -->
 232     <taskdef name="testng" classname="org.testng.TestNGAntTask"
 233         classpath="${file.reference.testng.jar}"/>
 234 
 235     <javac srcdir="${test.src.dir}"
 236            destdir="${build.test.classes.dir}"
 237            classpath="${javac.test.classpath}"
 238            source="${javac.source}"
 239            target="${javac.target}"
 240            debug="${javac.debug}"
 241            encoding="${javac.encoding}"
 242            includeantruntime="false" fork="true">
 243         <compilerarg value="-J-Djava.ext.dirs="/>
 244         <compilerarg value="-Xlint:unchecked"/>
 245         <compilerarg value="-Xlint:deprecation"/>
 246     </javac>
 247 
 248     <copy todir="${build.test.classes.dir}/META-INF/services">
 249        <fileset dir="${test.src.dir}/META-INF/services/"/>
 250     </copy>
 251 
 252     <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources">
 253        <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/>
 254     </copy>
 255 
 256     <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources">
 257        <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/>
 258     </copy>
 259 
 260     <!-- tests that check nashorn internals and internal API -->
 261     <jar jarfile="${nashorn.internal.tests.jar}">
 262       <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
 263     </jar>
 264 
 265     <!-- tests that check nashorn script engine (jsr-223) API -->
 266     <jar jarfile="${nashorn.api.tests.jar}">
 267       <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
 268       <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
 269       <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
 270     </jar>
 271 
 272   </target>
 273 
 274   <target name="generate-policy-file" depends="prepare">
 275     <echo file="${build.dir}/nashorn.policy">
 276 
 277 grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
 278     permission java.security.AllPermission;
 279 };
 280 
 281 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
 282     permission java.security.AllPermission;
 283 };
 284 
 285 grant codeBase "file:/${basedir}/test/script/trusted/*" {
 286     permission java.security.AllPermission;
 287 };
 288 
 289 grant codeBase "file:/${basedir}/test/script/maptests/*" {
 290     permission java.io.FilePermission "${basedir}/test/script/maptests/*","read";
 291     permission java.lang.RuntimePermission "nashorn.debugMode";
 292 };
 293 
 294 grant codeBase "file:/${basedir}/test/script/basic/*" {
 295     permission java.io.FilePermission "${basedir}/test/script/-", "read";
 296     permission java.io.FilePermission "$${user.dir}", "read";
 297     permission java.util.PropertyPermission "user.dir", "read";
 298     permission java.util.PropertyPermission "nashorn.test.*", "read";
 299 };
 300 
 301 grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
 302     permission java.io.FilePermission "${basedir}/test/script/-", "read";
 303     permission java.io.FilePermission "$${user.dir}", "read";
 304     permission java.util.PropertyPermission "user.dir", "read";
 305     permission java.util.PropertyPermission "nashorn.test.*", "read";
 306 };
 307 
 308 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
 309     permission java.util.PropertyPermission "java.security.policy", "read";
 310 };
 311 
 312 grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
 313     permission java.lang.RuntimePermission "nashorn.JavaReflection";
 314 };
 315 
 316 grant codeBase "file:/${basedir}/test/script/markdown.js" {
 317     permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
 318 };
 319 
 320     </echo>
 321 
 322     <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
 323     <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace>   <!--hack for Unix - to avoid leading // in URLs -->
 324 
 325   </target>
 326 
 327   <target name="check-external-tests">
 328       <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
 329       <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
 330       <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
 331       <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
 332       <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
 333       <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
 334       <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
 335       <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
 336   </target>
 337 
 338   <target name="check-testng" unless="testng.available">
 339     <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
 340   </target>
 341 
 342   <target name="test" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
 343     <fileset id="test.classes" dir="${build.test.classes.dir}">
 344       <include name="**/api/javaaccess/*Test.class"/>
 345       <include name="**/api/scripting/*Test.class"/>
 346       <include name="**/codegen/*Test.class"/>
 347       <include name="**/parser/*Test.class"/>
 348       <include name="**/runtime/*Test.class"/>
 349       <include name="**/runtime/regexp/*Test.class"/>
 350       <include name="**/runtime/regexp/joni/*Test.class"/>
 351       <include name="**/framework/*Test.class"/>
 352     </fileset>
 353 
 354     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
 355        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
 356       <jvmarg line="${ext.class.path}"/>
 357       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
 358       <propertyset>
 359         <propertyref prefix="nashorn."/>
 360       </propertyset>
 361       <propertyset>
 362         <propertyref prefix="test-sys-prop."/>
 363         <mapper from="test-sys-prop.*" to="*" type="glob"/>
 364       </propertyset>
 365       <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
 366       <classpath>
 367           <pathelement path="${run.test.classpath}"/>
 368       </classpath>
 369     </testng>
 370   </target>
 371 
 372   <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
 373       <!-- use just build.test.classes.dir to avoid referring to TestNG -->
 374       <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" failonerror="true" fork="true">
 375       <jvmarg line="${ext.class.path}"/>
 376       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
 377       <syspropertyset>
 378           <propertyref prefix="test-sys-prop."/>
 379           <mapper type="glob" from="test-sys-prop.*" to="*"/>
 380       </syspropertyset>
 381       </java>
 382   </target>
 383 
 384   <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
 385     <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."/>
 386   </target>
 387 
 388   <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
 389     <fileset id="test.classes" dir="${build.test.classes.dir}">
 390        <include name="**/framework/*Test.class"/>
 391     </fileset>
 392     
 393     <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
 394     
 395     <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
 396                 <not>
 397             <os family="mac"/>
 398         </not>
 399         </condition>
 400     
 401     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
 402        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
 403       <jvmarg line="${ext.class.path}"/>
 404       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
 405       <propertyset>
 406         <propertyref prefix="testjfx-test-sys-prop."/>
 407         <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
 408       </propertyset>
 409       <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
 410       <classpath>
 411           <pathelement path="${testjfx.run.test.classpath}"/>
 412       </classpath>
 413     </testng>
 414   </target>
 415   
 416   <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
 417     <fileset id="test.classes" dir="${build.test.classes.dir}">
 418        <include name="**/framework/*Test.class"/>
 419     </fileset>
 420 
 421     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
 422        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
 423       <jvmarg line="${ext.class.path}"/>
 424       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
 425       <propertyset>
 426         <propertyref prefix="testmarkdown-test-sys-prop."/>
 427         <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
 428       </propertyset>
 429       <classpath>
 430           <pathelement path="${run.test.classpath}"/>
 431       </classpath>
 432     </testng>
 433   </target>
 434   
 435   <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
 436     <fileset id="test.classes" dir="${build.test.classes.dir}">
 437        <include name="**/framework/*Test.class"/>
 438     </fileset>
 439 
 440     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
 441        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
 442       <jvmarg line="${ext.class.path}"/>
 443       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
 444       <propertyset>
 445         <propertyref prefix="nashorn."/>
 446       </propertyset>
 447       <propertyset>
 448         <propertyref prefix="test262-test-sys-prop."/>
 449         <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
 450       </propertyset>
 451       <classpath>
 452           <pathelement path="${run.test.classpath}"/>
 453       </classpath>
 454     </testng>
 455   </target>
 456 
 457   <target name="test262parallel" depends="test262-parallel"/>
 458 
 459   <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
 460     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
 461     <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
 462       <jvmarg line="${ext.class.path}"/>
 463       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
 464       <classpath>
 465           <pathelement path="${run.test.classpath}"/>
 466       </classpath>
 467       <syspropertyset>
 468           <propertyref prefix="test262-test-sys-prop."/>
 469           <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
 470       </syspropertyset>
 471     </java>
 472   </target>
 473 
 474   <target name="all" depends="test, docs"
 475       description="Build, test and generate docs for nashorn"/>
 476 
 477   <target name="run" depends="jar"
 478       description="Run the shell with a sample script">
 479     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
 480         <jvmarg line="${ext.class.path}"/>
 481         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
 482         <arg value="-dump-on-error"/>
 483         <arg value="test.js"/>
 484     </java>
 485   </target>
 486 
 487   <target name="debug" depends="jar"
 488       description="Debug the shell with a sample script">
 489     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
 490         <jvmarg line="${ext.class.path}"/>
 491         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
 492         <arg value="--print-code"/>
 493         <arg value="--verify-code"/>
 494         <arg value="--print-symbols"/>
 495         <jvmarg value="-Dnashorn.codegen.debug=true"/>
 496         <arg value="test.js"/>
 497     </java>
 498   </target>
 499 
 500   <!-- targets to get external script tests -->
 501 
 502   <!-- test262 test suite -->
 503   <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
 504     <!-- clone test262 mercurial repo -->
 505     <exec executable="${hg.executable}">
 506        <arg value="clone"/>
 507        <arg value="http://hg.ecmascript.org/tests/test262"/>
 508        <arg value="${test.external.dir}/test262"/>
 509     </exec>
 510   </target>
 511   <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
 512     <!-- update test262 mercurial repo -->
 513     <exec executable="${hg.executable}" dir="${test.external.dir}/test262">
 514        <arg value="pull"/>
 515        <arg value="-u"/>
 516     </exec>
 517   </target>
 518 
 519   <!-- octane benchmark -->
 520   <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
 521     <!-- checkout octane benchmarks -->
 522     <exec executable="${svn.executable}">
 523        <arg value="--non-interactive"/>
 524        <arg value="--trust-server-cert"/>
 525        <arg value="checkout"/>
 526        <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
 527        <arg value="${test.external.dir}/octane"/>
 528     </exec>
 529   </target>
 530   <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
 531     <!-- update octane benchmarks -->
 532     <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
 533        <arg value="--non-interactive"/>
 534        <arg value="--trust-server-cert"/>
 535        <arg value="update"/>
 536     </exec>
 537   </target>
 538 
 539   <!-- sunspider benchmark -->
 540   <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
 541     <!-- checkout sunspider -->
 542     <exec executable="${svn.executable}">
 543        <arg value="--non-interactive"/>
 544        <arg value="--trust-server-cert"/>
 545        <arg value="checkout"/>
 546        <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
 547        <arg value="${test.external.dir}/sunspider"/>
 548     </exec>
 549   </target>
 550   <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
 551     <!-- update sunspider -->
 552     <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
 553        <arg value="--non-interactive"/>
 554        <arg value="--trust-server-cert"/>
 555        <arg value="update"/>
 556     </exec>
 557   </target>
 558 
 559   <!-- get all external test scripts -->
 560   <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
 561     <!-- make external test dir -->
 562     <mkdir dir="${test.external.dir}"/>
 563 
 564     <!-- jquery -->
 565     <mkdir dir="${test.external.dir}/jquery"/>
 566     <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
 567     <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
 568 
 569     <!-- prototype -->
 570     <mkdir dir="${test.external.dir}/prototype"/>
 571     <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"/>
 572 
 573     <!-- underscorejs -->
 574     <mkdir dir="${test.external.dir}/underscore"/>
 575     <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
 576     <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
 577 
 578     <!-- yui -->
 579     <mkdir dir="${test.external.dir}/yui"/>
 580     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
 581     <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
 582     
 583     <!-- showdown -->
 584     <mkdir dir="${test.external.dir}/showdown"/>
 585     <get src="https://raw.github.com/coreyti/showdown/master/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
 586     <get src="https://raw.github.com/coreyti/showdown/master/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
 587 
 588   </target>
 589 
 590   <!-- update external test suites that are pulled from source control systems -->
 591   <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
 592 
 593   <!-- run all perf tests -->
 594   <target name="perf" depends="externals, update-externals, sunspider, octane"/>
 595 
 596   <!-- run all tests -->
 597   <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
 598      <fail message="Exiting.."/>
 599   </target>
 600 
 601   <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
 602 
 603 </project>