make/build.xml

Thu, 12 Oct 2017 19:52:15 +0800

author
aoqi
date
Thu, 12 Oct 2017 19:52:15 +0800
changeset 1205
4112748288bb
parent 1091
628304057fce
parent 952
6d5471a497fb
child 1490
d85f981c8cf8
permissions
-rw-r--r--

merge

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

mercurial