make/build.xml

Thu, 04 Sep 2014 18:47:18 +0200

author
hannesw
date
Thu, 04 Sep 2014 18:47:18 +0200
changeset 991
b7a2db4de254
parent 984
dd9ea030e762
child 1036
8a99ee1fb375
permissions
-rw-r--r--

8051889: Implement block scoping in symbol assignment and scope computation
Reviewed-by: attila, lagergren

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

mercurial