make/build.xml

Thu, 21 Aug 2014 20:06:48 +0530

author
sundar
date
Thu, 21 Aug 2014 20:06:48 +0530
changeset 966
620bf937f377
parent 963
e2497b11a021
child 984
dd9ea030e762
permissions
-rw-r--r--

8055762: Nashorn misses linker for netscape.javascript.JSObject instances
Reviewed-by: lagergren, jlaskey

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

mercurial