make/build.xml

Mon, 01 Feb 2016 12:32:13 -0800

author
asaha
date
Mon, 01 Feb 2016 12:32:13 -0800
changeset 1788
addbcca78049
parent 1648
ab5cb7c26321
child 1741
a136c901f3f5
permissions
-rw-r--r--

Added tag jdk8u76-b06 for changeset 0d5cfd0fc819

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

mercurial