build.xml revision 1850:ace1d994bca7
1121982Sjhb<?xml version="1.0" encoding="UTF-8"?>
2121982Sjhb
3121982Sjhb<!--
4121982Sjhb Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
5121982Sjhb DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6121982Sjhb
7121982Sjhb This code is free software; you can redistribute it and/or modify it
8121982Sjhb under the terms of the GNU General Public License version 2 only, as
9121982Sjhb published by the Free Software Foundation.
10121982Sjhb
11121982Sjhb This code is distributed in the hope that it will be useful, but WITHOUT
12121982Sjhb ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13121982Sjhb FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14121982Sjhb version 2 for more details (a copy is included in the LICENSE file that
15121982Sjhb accompanied this code).
16121982Sjhb
17121982Sjhb You should have received a copy of the GNU General Public License version
18121982Sjhb 2 along with this work; if not, write to the Free Software Foundation,
19121982Sjhb Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20121982Sjhb
21121982Sjhb Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22121982Sjhb or visit www.oracle.com if you need additional information or have any
23121982Sjhb questions.
24121982Sjhb-->
25121982Sjhb
26121982Sjhb<project name="nashorn" default="test" basedir="..">
27121982Sjhb  <import file="build-nasgen.xml"/>
28121982Sjhb  <import file="code_coverage.xml"/>
29121982Sjhb
30232747Sjhb  <target name="load-properties">
31121982Sjhb    <!-- set default values to run.test.jvmargs.external property -->
32121982Sjhb    <condition property="run.test.jvmargs.external" value="">
33121982Sjhb     <not><isset property="run.test.jvmargs.external"/></not>
34121982Sjhb    </condition>     
35121982Sjhb    <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later -->
36121982Sjhb    <property file="${user.home}/.nashorn.project.local.properties"/>
37232744Sjhb
38121982Sjhb    <loadproperties srcFile="make/project.properties"/>
39121982Sjhb  </target>
40121982Sjhb
41121982Sjhb  <target name="init-conditions" depends="load-properties">
42121982Sjhb    <path id="nashorn.jar.path">
43121982Sjhb         <pathelement location="${nashorn.jar}"/>
44121982Sjhb    </path>
45169391Sjhb    <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
46121982Sjhb      <available file="/usr/local/bin/svn"/>
47121982Sjhb    </condition>
48177160Sjhb    <condition property="hg.executable" value="/usr/local/bin/hg" else="hg">
49307244Ssephe      <available file="/usr/local/bin/hg"/>
50121982Sjhb    </condition>
51121982Sjhb    <condition property="git.executable" value="/usr/local/bin/git" else="git">
52122572Sjhb      <available file="/usr/local/bin/git"/>
53121982Sjhb    </condition>
54167273Sjhb    <!-- check if TestNG and dependencies are available, and download them if they aren't -->
55121982Sjhb    <antcall target="get-testng"/>
56121982Sjhb    <condition property="testng.available" value="true">
57121982Sjhb      <and>
58121982Sjhb        <available file="${file.reference.testng.jar}"/>
59232744Sjhb        <available file="${file.reference.jcommander.jar}"/>
60232744Sjhb        <available file="${file.reference.bsh.jar}"/>
61232744Sjhb        <available file="${file.reference.snakeyaml.jar}"/>
62232744Sjhb      </and>
63232744Sjhb    </condition>
64233031Snyan
65233031Snyan    <!-- check if asmtools-6.0.jar is available, and download it if it isn't -->
66233031Snyan    <!--
67232744Sjhb    <available property="asmtools.already.present" file="${file.reference.asmtools.jar}"/>
68232744Sjhb    <antcall target="get-asmtools"/>
69233031Snyan    <available property="asmtools.available" file="${file.reference.asmtools.jar}"/>
70232744Sjhb    -->
71121982Sjhb
72121982Sjhb    <!-- check if Jemmy ang TestNG are avaiable -->
73151658Sjhb    <condition property="jemmy.jfx.testng.available" value="true">
74121982Sjhb      <and>
75121982Sjhb        <available file="${file.reference.jemmyfx.jar}"/>
76121982Sjhb        <available file="${file.reference.jemmycore.jar}"/>
77307244Ssephe        <available file="${file.reference.jemmyawtinput.jar}"/>
78307244Ssephe        <available file="${file.reference.jfxrt.jar}"/>
79169391Sjhb        <isset property="testng.available"/>
80246247Savg      </and>
81121982Sjhb    </condition>
82156124Sjhb
83156124Sjhb    <!-- enable/disable make code coverage -->
84156124Sjhb    <condition property="cc.enabled">
85156124Sjhb        <istrue value="${make.code.coverage}" />
86224187Sattilio    </condition>
87224187Sattilio
88224187Sattilio    <!-- exclude tests in exclude lists -->
89224187Sattilio    <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt">
90224187Sattilio      <istrue value="${make.code.coverage}" />
91177181Sjhb    </condition>
92177325Sjhb
93121982Sjhb    <condition property="jfr.options" value="${run.test.jvmargs.jfr}" else="">
94163219Sjhb      <istrue value="${jfr}"/>
95121982Sjhb    </condition>
96121982Sjhb
97121982Sjhb    <condition property="test-sys-prop-no-security.os.not.windows">
98121982Sjhb      <not>
99163219Sjhb        <os family="windows"/>
100163219Sjhb      </not>
101163219Sjhb    </condition>
102163219Sjhb
103163219Sjhb    <!--set windows cygwin/cmd specific properties-->
104246247Savg    <property environment="env"/>
105163219Sjhb    <condition property="test-sys-prop-no-security.os.not.windows.cmd">
106163219Sjhb     <not>
107163219Sjhb      <and>
108163219Sjhb        <os family="windows"/>
109163219Sjhb        <not>
110163219Sjhb          <isset property="env.SHELL"/>
111121982Sjhb        </not>
112163219Sjhb      </and>
113163219Sjhb     </not>
114163219Sjhb    </condition>
115163219Sjhb   </target>
116163219Sjhb  
117163219Sjhb
118163219Sjhb  <!-- check minimum ant version required to be 1.8.4 -->
119163219Sjhb  <target name="check-ant-version">
120163219Sjhb    <property name="ant.version.required" value="1.8.4"/>
121163219Sjhb    <antversion property="ant.current.version" />
122307244Ssephe    <fail message="The current ant version, ${ant.current.version}, is too old. Please use 1.8.4 or above.">
123163219Sjhb        <condition>
124163219Sjhb            <not>
125163219Sjhb                <antversion atleast="${ant.version.required}"/>
126246247Savg            </not>
127163219Sjhb        </condition>
128163219Sjhb    </fail>
129307244Ssephe  </target>
130163219Sjhb
131163219Sjhb  <target name="check-java-version">
132163219Sjhb    <!-- look for a Class that is available only in jdk1.8 or above -->
133163219Sjhb    <!-- core/exposed API class is better than an implementation class -->
134121982Sjhb    <available property="jdk1.8+" classname="java.util.stream.Stream"/>
135121982Sjhb
136121982Sjhb    <!-- need jdk1.8 or above -->
137121982Sjhb    <fail message="Unsupported Java version: ${ant.java.version}. Please use Java version 1.8 or greater." unless="jdk1.8+">
138121982Sjhb    </fail>
139121982Sjhb  </target>
140121982Sjhb
141121982Sjhb  <target name="init" depends="check-ant-version, check-java-version, init-conditions, init-cc">
142121982Sjhb    <!-- extends jvm args -->
143163219Sjhb    <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
144121982Sjhb    <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs} ${jfr.options}"/>
145121982Sjhb
146121982Sjhb    <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
147178092Sjeff    <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
148177325Sjhb    <echo message="run.test.xms=${run.test.xms}"/>
149177325Sjhb    <echo message="run.test.xmx=${run.test.xmx}"/>
150177181Sjhb
151121982Sjhb  </target>
152121982Sjhb
153307244Ssephe  <target name="prepare" depends="init">
154121982Sjhb    <mkdir dir="${build.dir}"/>
155307244Ssephe    <mkdir dir="${build.classes.dir}"/>
156151658Sjhb    <mkdir dir="${nashorn.module.classes.dir}"/>
157121982Sjhb    <mkdir dir="${dynalink.module.classes.dir}"/>
158121982Sjhb    <mkdir dir="${nashorn.shell.module.classes.dir}"/>
159121982Sjhb    <mkdir dir="${nashorn.module.classes.dir}/META-INF/services"/>
160121982Sjhb    <mkdir dir="${build.test.classes.dir}"/>
161169391Sjhb    <mkdir dir="${dist.dir}"/>
162307244Ssephe    <mkdir dir="${dist.javadoc.dir}"/>
163121982Sjhb  </target>
164121982Sjhb
165121982Sjhb  <target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
166121982Sjhb    <delete includeemptydirs="true">
167121982Sjhb      <fileset dir="${build.dir}" erroronmissingdir="false"/>
168121982Sjhb    </delete>
169121982Sjhb    <delete dir="${dist.dir}"/>
170121982Sjhb  </target>
171121982Sjhb
172121982Sjhb  <target name="compile" depends="prepare" description="Compiles nashorn">
173121982Sjhb    <javac srcdir="${dynalink.module.src.dir}"
174166901Spiso           destdir="${dynalink.module.classes.dir}"
175166901Spiso           source="${javac.source}"
176121982Sjhb           target="${javac.target}"
177121982Sjhb           debug="${javac.debug}"
178121982Sjhb           encoding="${javac.encoding}"
179121982Sjhb           includeantruntime="false" fork="true">
180121982Sjhb      <compilerarg value="-Xlint:all"/>
181121982Sjhb      <compilerarg value="-XDignore.symbol.file"/>
182121982Sjhb      <compilerarg value="-Xdiags:verbose"/>
183166901Spiso      <compilerarg value="-parameters"/>
184169320Spiso    </javac>
185121982Sjhb    <!-- patch-module does not like module-info.class files! -->
186307244Ssephe    <delete>
187121982Sjhb      <fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
188169391Sjhb    </delete>
189169391Sjhb    <javac srcdir="${nashorn.module.src.dir}"
190156124Sjhb           destdir="${nashorn.module.classes.dir}"
191169391Sjhb           source="${javac.source}"
192169391Sjhb           target="${javac.target}"
193307244Ssephe           debug="${javac.debug}"
194121982Sjhb           encoding="${javac.encoding}"
195121982Sjhb           includeantruntime="false" fork="true">
196121982Sjhb      <compilerarg value="-Xlint:all"/>
197121982Sjhb      <compilerarg value="-XDignore.symbol.file"/>
198121982Sjhb      <compilerarg value="-Xdiags:verbose"/>
199121982Sjhb      <compilerarg value="-parameters"/>
200121982Sjhb      <compilerarg line="${nashorn.override.option}"/>
201165125Sjhb    </javac>
202307213Sroyger    <!-- patch-module does not like module-info.class files! -->
203121982Sjhb    <delete>
204165125Sjhb      <fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
205151658Sjhb    </delete>
206169391Sjhb    <javac srcdir="${nashorn.shell.module.src.dir}"
207307244Ssephe           destdir="${nashorn.shell.module.classes.dir}"
208169391Sjhb           source="${javac.source}"
209169391Sjhb           target="${javac.target}"
210169391Sjhb           debug="${javac.debug}"
211169391Sjhb           encoding="${javac.encoding}"
212169391Sjhb           includeantruntime="false" fork="true">
213165125Sjhb      <compilerarg value="-Xlint:all"/>
214307244Ssephe      <compilerarg value="-XDignore.symbol.file"/>
215169391Sjhb      <compilerarg value="-Xdiags:verbose"/>
216121982Sjhb      <compilerarg value="-parameters"/>
217121982Sjhb      <compilerarg line="${nashorn.override.option}"/>
218121982Sjhb    </javac>
219128931Sjhb    <!-- patch-module does not like module-info.class files! -->
220128931Sjhb    <delete>
221128931Sjhb      <fileset dir="${build.classes.dir}" includes="**/module-info.class"/>
222128931Sjhb    </delete>
223128931Sjhb     <copy todir="${nashorn.module.classes.dir}/jdk/nashorn/api/scripting/resources">
224128931Sjhb       <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/api/scripting/resources/"/>
225128931Sjhb    </copy>
226128931Sjhb    <copy todir="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources">
227128931Sjhb       <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/internal/runtime/resources/"/>
228128931Sjhb    </copy>
229128931Sjhb    <copy todir="${nashorn.module.classes.dir}/jdk/nashorn/tools/resources">
230177325Sjhb       <fileset dir="${nashorn.module.src.dir}/jdk/nashorn/tools/resources/"/>
231177325Sjhb    </copy>
232177325Sjhb    <copy file="${dynalink.module.src.dir}/jdk/dynalink/support/messages.properties" todir="${dynalink.module.classes.dir}/jdk/dynalink/support"/>
233177325Sjhb    <copy file="${nashorn.module.src.dir}/jdk/nashorn/internal/codegen/anchor.properties" todir="${nashorn.module.classes.dir}/jdk/nashorn/internal/codegen"/>
234177325Sjhb
235177325Sjhb    <echo message="version_string=${nashorn.fullversion}" file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
236177325Sjhb    <echo file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
237177325Sjhb    <echo message="version_short=${nashorn.version}" file="${nashorn.module.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
238177325Sjhb  </target>
239121982Sjhb
240153146Sjhb  <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar">
241121982Sjhb    <jar jarfile="${dynalink.jar}">
242177940Sjhb      <fileset dir="${dynalink.module.classes.dir}"/>
243169320Spiso    </jar>
244169320Spiso    <jar jarfile="${nashorn.jar}" index="true" filesetmanifest="merge">
245169320Spiso      <fileset dir="${nashorn.module.classes.dir}"/>
246169320Spiso      <manifest>
247169320Spiso        <attribute name="Archiver-Version" value="n/a"/>
248169320Spiso        <attribute name="Build-Jdk" value="${java.runtime.version}"/>
249169320Spiso        <attribute name="Built-By" value="n/a"/>
250169320Spiso        <attribute name="Created-By" value="Ant jar task"/>
251169320Spiso        <section name="jdk/nashorn/">
252170291Sattilio          <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
253169320Spiso          <attribute name="Implementation-Version" value="${nashorn.version}"/>
254169320Spiso        </section>
255169320Spiso      </manifest>
256169320Spiso    </jar>
257169320Spiso    <jar jarfile="${jjs.jar}">
258169320Spiso      <fileset dir="${nashorn.shell.module.classes.dir}"/>
259169320Spiso    </jar>
260169320Spiso  </target>
261169320Spiso
262169320Spiso  <target name="use-promoted-nashorn" depends="init">
263169320Spiso    <delete file="${dist.dir}/nashorn.jar"/>
264169320Spiso    <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/>
265169320Spiso    <property name="compile.suppress.jar" value="defined"/>
266169320Spiso  </target>
267169320Spiso
268177940Sjhb  <!-- generate javadoc for Nashorn classes -->
269133017Sscottl  <target name="javadoc" depends="jar">
270137165Sscottl    <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html"
271121982Sjhb        windowtitle="${nashorn.product.name} ${nashorn.version}"
272121982Sjhb        additionalparam="-quiet" failonerror="true" useexternalfile="true">
273121982Sjhb      <arg value="--module-source-path"/>
274121982Sjhb      <arg value="${basedir}/src/*/share/classes"/>
275121982Sjhb      <arg value="${javadoc.option}"/>
276121982Sjhb      <classpath>
277121982Sjhb        <pathelement location="${build.classes.dir}"/>
278121982Sjhb      </classpath>
279121982Sjhb      <fileset dir="${dynalink.module.src.dir}" includes="**/*.java"/>
280121982Sjhb      <fileset dir="${nashorn.module.src.dir}" includes="**/*.java"/>
281255726Sgibbs      <link href="http://docs.oracle.com/javase/8/docs/api/"/>
282121982Sjhb    </javadoc>
283163219Sjhb  </target>
284121982Sjhb
285232744Sjhb  <!-- generate javadoc only for nashorn extension api classes -->
286232744Sjhb  <target name="nashornapi" depends="jar">
287232744Sjhb    <mkdir dir="${dist.nashornapi.javadoc.dir}"/>
288307244Ssephe    <javadoc destdir="${dist.nashornapi.javadoc.dir}" use="yes" overview="${nashorn.module.src.dir}/overview.html"
289246247Savg        extdirs="${nashorn.ext.path}" windowtitle="${nashorn.product.name} ${nashorn.version}"
290163219Sjhb        additionalparam="-quiet" failonerror="true" useexternalfile="true">
291255726Sgibbs      <arg value="--module-source-path"/>
292163219Sjhb      <arg value="${basedir}/src/*/share/classes"/>
293307244Ssephe      <arg value="${javadoc.option}"/>
294121982Sjhb      <classpath>
295121982Sjhb        <pathelement location="${build.classes.dir}"/>
296121982Sjhb      </classpath>
297121982Sjhb      <fileset dir="${nashorn.module.src.dir}" includes="jdk/nashorn/api/**/*.java"/>
298121982Sjhb      <link href="http://docs.oracle.com/javase/8/docs/api/"/>
299163219Sjhb    </javadoc>
300121982Sjhb  </target>
301307244Ssephe
302246247Savg  <!-- generate javadoc only for Dynalink API classes -->
303163219Sjhb  <target name="dynalinkapi" depends="jar">
304163219Sjhb    <mkdir dir="${dist.dynalinkapi.javadoc.dir}"/>
305163219Sjhb    <javadoc destdir="${dist.dynalinkapi.javadoc.dir}" use="yes"
306307244Ssephe        windowtitle="Dynalink"
307121982Sjhb        additionalparam="-quiet" failonerror="true" useexternalfile="true">
308121982Sjhb      <arg value="--module-source-path"/>
309177181Sjhb      <arg value="${basedir}/src/*/share/classes"/>
310177181Sjhb      <arg value="${javadoc.option}"/>
311177181Sjhb      <classpath>
312177181Sjhb        <pathelement location="${build.classes.dir}"/>
313195249Sjhb      </classpath>
314195249Sjhb      <fileset dir="${dynalink.module.src.dir}" includes="**/*.java" excludes="jdk/dynalink/internal/*.java"/>
315177181Sjhb      <link href="http://docs.oracle.com/javase/8/docs/api/"/>
316177181Sjhb    </javadoc>
317177181Sjhb  </target>
318177181Sjhb
319177181Sjhb  <target name="javadocapi" depends="nashornapi, dynalinkapi"/>
320177181Sjhb
321177181Sjhb  <!-- generate shell.html for shell tool documentation -->
322307244Ssephe  <target name="shelldoc" depends="jar">
323195249Sjhb    <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
324307244Ssephe      <jvmarg line="${nashorn.override.option}"/>
325195249Sjhb      <arg value="-scripting"/>
326195249Sjhb      <arg value="docs/genshelldoc.js"/>
327195249Sjhb    </java>
328177181Sjhb  </target>
329177181Sjhb
330177181Sjhb  <!-- generate all docs -->
331177181Sjhb  <target name="docs" depends="javadoc, shelldoc"/>
332177181Sjhb
333121982Sjhb  <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
334121982Sjhb  <target name="dist" depends="jar">
335121982Sjhb      <zip destfile="${build.zip}" basedir=".."
336121982Sjhb          excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
337121982Sjhb      <tar destfile="${build.gzip}" basedir=".." compression="gzip"
338121982Sjhb          excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
339121982Sjhb  </target>
340121982Sjhb
341121982Sjhb  <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
342121982Sjhb    <!-- testng task -->
343121982Sjhb    <taskdef name="testng" classname="org.testng.TestNGAntTask"
344121982Sjhb        classpath="${testng.ant.classpath}"/>
345151658Sjhb
346121982Sjhb    <javac srcdir="${test.src.dir}"
347121982Sjhb           destdir="${build.test.classes.dir}"
348121982Sjhb           classpath="${javac.test.classpath}"
349121982Sjhb           source="${javac.source}"
350121982Sjhb           target="${javac.target}"
351121982Sjhb           debug="${javac.debug}"
352121982Sjhb           encoding="${javac.encoding}"
353151658Sjhb           includeantruntime="false" fork="true">
354169391Sjhb        <compilerarg line="${nashorn.override.option}"/>
355121982Sjhb        <compilerarg value="-Xlint:unchecked"/>
356121982Sjhb        <compilerarg value="-Xlint:deprecation"/>
357209649Smav        <compilerarg value="-Xdiags:verbose"/>
358209649Smav        <compilerarg line="${test.module.imports}"/>
359121982Sjhb    </javac>
360121982Sjhb
361121982Sjhb    <copy todir="${build.test.classes.dir}/META-INF/services">
362121982Sjhb       <fileset dir="${test.src.dir}/META-INF/services/"/>
363169391Sjhb    </copy>
364121982Sjhb
365121982Sjhb    <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/test/resources">
366139242Sjhb       <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/test/resources"/>
367139242Sjhb    </copy>
368139242Sjhb
369139242Sjhb    <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/doubleconv/test/resources">
370169391Sjhb      <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/doubleconv/test/resources"/>
371139242Sjhb    </copy>
372139242Sjhb
373139242Sjhb    <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/test/resources">
374169391Sjhb       <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/test/resources"/>
375139242Sjhb    </copy>
376139242Sjhb
377121982Sjhb    <!-- tests that check nashorn internals and internal API -->
378121982Sjhb    <jar jarfile="${nashorn.internal.tests.jar}">
379121982Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/internal/**"/>
380121982Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/test/tools/**"/>
381121982Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/models/**"/>
382121982Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/jdk/dynalink/test/Trusted**"/>
383246247Savg      <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
384307244Ssephe    </jar>
385307244Ssephe
386169391Sjhb    <!-- tests that check nashorn script engine (jsr-223) API and dynalink API -->
387121982Sjhb    <jar jarfile="${nashorn.api.tests.jar}">
388177253Srwatson      <fileset dir="${build.test.classes.dir}" includes="**/jdk/dynalink/**" excludes="**/jdk/dynalink/test/Trusted**"/>
389121982Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
390232744Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/>
391232744Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/>
392232744Sjhb      <fileset dir="${build.test.classes.dir}" includes="**/UnnamedPackage**"/>
393232744Sjhb    </jar>
394232744Sjhb
395232744Sjhb  </target>
396232744Sjhb
397232744Sjhb  <target name="generate-policy-file" depends="prepare">
398233031Snyan    <echo file="${build.dir}/nashorn.policy">
399233031Snyan
400232744Sjhbgrant codeBase "file:/${basedir}/${dynalink.module.classes.dir}" {
401232744Sjhb    permission java.security.AllPermission;
402232744Sjhb};
403232744Sjhb
404232744Sjhbgrant codeBase "file:/${basedir}/${nashorn.module.classes.dir}" {
405233031Snyan    permission java.security.AllPermission;
406233031Snyan};
407232744Sjhb
408232744Sjhbgrant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" {
409232744Sjhb    permission java.security.AllPermission;
410232744Sjhb};
411232744Sjhb
412198170Skibgrant codeBase "file:/${basedir}/${nashorn.api.tests.jar}" {
413198170Skib    permission java.util.PropertyPermission "parserapitest.*", "read";
414198170Skib    permission java.util.PropertyPermission "test.*", "read";
415198170Skib    permission java.util.PropertyPermission "test262.*", "read";
416198170Skib    permission java.io.FilePermission "${basedir}/test/-","read";
417198170Skib    permission java.io.FilePermission "$${user.dir}", "read";
418198170Skib    permission java.util.PropertyPermission "user.dir", "read";
419198170Skib};
420198170Skib
421198170Skibgrant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
422198170Skib    permission java.security.AllPermission;
423198170Skib};
424198170Skibgrant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
425198170Skib    permission java.security.AllPermission;
426198170Skib};
427198170Skibgrant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
428198170Skib    permission java.security.AllPermission;
429121982Sjhb};
430121982Sjhbgrant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
431121982Sjhb    permission java.security.AllPermission;
432121982Sjhb};
433121982Sjhb//// in case of absolute path:
434121982Sjhbgrant codeBase "file:/${nashorn.internal.tests.jar}" {
435121982Sjhb    permission java.security.AllPermission;
436160312Sjhb};
437121982Sjhb
438121982Sjhbgrant codeBase "file:/${file.reference.testng.jar}" {
439121982Sjhb    permission java.security.AllPermission;
440121982Sjhb};
441121982Sjhbgrant codeBase "file:/${file.reference.jcommander.jar}" {
442121982Sjhb    permission java.security.AllPermission;
443160312Sjhb};
444121982Sjhbgrant codeBase "file:/${file.reference.bsh.jar}" {
445151658Sjhb    permission java.security.AllPermission;
446121982Sjhb};
447121982Sjhbgrant codeBase "file:/${file.reference.snakeyaml.jar}" {
448156124Sjhb    permission java.security.AllPermission;
449156124Sjhb};
450156124Sjhb
451156124Sjhb
452156124Sjhbgrant codeBase "file:/${basedir}/test/script/trusted/*" {
453156124Sjhb    permission java.security.AllPermission;
454156124Sjhb};
455241371Sattilio
456177160Sjhbgrant codeBase "file:/${basedir}/test/script/maptests/*" {
457156124Sjhb    permission java.io.FilePermission "${basedir}/test/script/maptests/*","read";
458194985Sjhb    permission java.lang.RuntimePermission "nashorn.debugMode";
459194985Sjhb};
460194985Sjhb
461194985Sjhbgrant codeBase "file:/${basedir}/test/script/basic/*" {
462194985Sjhb    permission java.io.FilePermission "${basedir}/test/script/-", "read";
463194985Sjhb    permission java.io.FilePermission "$${user.dir}", "read";
464156124Sjhb    permission java.util.PropertyPermission "user.dir", "read";
465194985Sjhb    permission java.util.PropertyPermission "nashorn.test.*", "read";
466156124Sjhb};
467194985Sjhb
468194985Sjhbgrant codeBase "file:/${basedir}/test/script/basic/apply_to_call/*" {
469214448Sjhb    permission java.io.FilePermission "${basedir}/test/script/-", "read";
470194985Sjhb    permission java.io.FilePermission "$${user.dir}", "read";
471195249Sjhb    permission java.util.PropertyPermission "user.dir", "read";
472194985Sjhb    permission java.util.PropertyPermission "nashorn.test.*", "read";
473167273Sjhb};
474167273Sjhb
475177160Sjhbgrant codeBase "file:/${basedir}/test/script/basic/parser/*" {
476167273Sjhb    permission java.io.FilePermission "${basedir}/test/script/-", "read";
477222813Sattilio    permission java.io.FilePermission "$${user.dir}", "read";
478195249Sjhb    permission java.util.PropertyPermission "user.dir", "read";
479194985Sjhb    permission java.util.PropertyPermission "nashorn.test.*", "read";
480156124Sjhb};
481156124Sjhb
482177181Sjhbgrant codeBase "file:/${basedir}/test/script/basic/es6/*" {
483177181Sjhb    permission java.io.FilePermission "${basedir}/test/script/-", "read";
484177181Sjhb    permission java.io.FilePermission "$${user.dir}", "read";
485177181Sjhb    permission java.util.PropertyPermission "user.dir", "read";
486177181Sjhb    permission java.util.PropertyPermission "nashorn.test.*", "read";
487177181Sjhb};
488177181Sjhb
489177181Sjhbgrant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
490177181Sjhb    permission java.util.PropertyPermission "java.security.policy", "read";
491177181Sjhb};
492177181Sjhb
493177181Sjhbgrant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
494156124Sjhb    permission java.lang.RuntimePermission "nashorn.JavaReflection";
495167273Sjhb};
496167273Sjhb
497156124Sjhbgrant codeBase "file:/${basedir}/test/script/markdown.js" {
498156124Sjhb    permission java.io.FilePermission "${basedir}/test/script/external/showdown/-", "read";
499167273Sjhb};
500156124Sjhb
501156124Sjhbgrant codeBase "file:/${basedir}/test/script/basic/JDK-8158467.js" {
502167273Sjhb    permission java.lang.RuntimePermission "nashorn.setConfig";
503167273Sjhb};
504156124Sjhb
505167273Sjhb    </echo>
506167273Sjhb
507167273Sjhb    <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
508222813Sattilio    <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace>   <!--hack for Unix - to avoid leading // in URLs -->
509156124Sjhb
510156124Sjhb  </target>
511156124Sjhb
512156124Sjhb  <target name="check-external-tests">
513156124Sjhb      <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
514156124Sjhb      <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
515156124Sjhb      <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
516156124Sjhb      <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
517156124Sjhb      <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
518156124Sjhb      <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
519156124Sjhb      <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
520156124Sjhb      <available file="${test.external.dir}/showdown" property="test-sys-prop.external.markdown"/>
521183133Skmacy  </target>
522183133Skmacy
523183133Skmacy  <target name="check-testng" unless="testng.available">
524183133Skmacy    <echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
525183133Skmacy  </target>
526195249Sjhb
527195249Sjhb  <!-- only to be invoked as dependency of "test" target -->
528156124Sjhb  <target name="-test-classes-all" depends="jar" unless="test.class">
529177160Sjhb      <fileset id="test.classes" dir="${build.test.classes.dir}">
530156124Sjhb          <include name="**/dynalink/beans/test/*Test.class"/>
531156124Sjhb          <include name="**/dynalink/linker/support/test/*Test.class"/>
532164358Sjhb          <include name="**/dynalink/support/test/*Test.class"/>
533307244Ssephe          <include name="**/dynalink/test/*Test.class"/>
534156124Sjhb          <include name="**/api/javaaccess/test/*Test.class"/>
535156124Sjhb          <include name="**/api/scripting/test/*Test.class"/>
536156124Sjhb          <include name="**/api/tree/test/*Test.class"/>
537177181Sjhb          <include name="**/codegen/test/*Test.class"/>
538177181Sjhb          <include name="**/parser/test/*Test.class"/>
539177181Sjhb          <include name="**/runtime/test/*Test.class"/>
540177181Sjhb          <include name="**/runtime/doubleconv/test/*Test.class"/>
541195249Sjhb          <include name="**/runtime/regexp/test/*Test.class"/>
542195249Sjhb          <include name="**/runtime/regexp/joni/test/*Test.class"/>
543195249Sjhb          <include name="**/framework/*Test.class"/>
544177181Sjhb     </fileset>
545177181Sjhb  </target>
546195249Sjhb
547209155Smav  <!-- only to be invoked as dependency of "test" target -->
548195249Sjhb  <target name="-test-classes-single" depends="jar" if="test.class">
549195249Sjhb     <fileset id="test.classes" dir="${build.test.classes.dir}">
550195249Sjhb         <include name="${test.class}*"/>
551195249Sjhb     </fileset>
552177181Sjhb  </target>
553156124Sjhb
554307244Ssephe  <!-- only to be invoked as dependency of "test" target -->
555156124Sjhb  <target name="-test-nosecurity" unless="test.class">
556177253Srwatson    <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
557177253Srwatson      <include name="**/framework/ScriptTest.class"/>
558195002Sjhb      <include name="**/runtime/linker/test/*Test.class"/>
559195002Sjhb    </fileset>
560195002Sjhb    <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
561195002Sjhb       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
562195002Sjhb      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
563195002Sjhb      <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
564195002Sjhb      <propertyset>
565195002Sjhb        <propertyref prefix="nashorn."/>
566195002Sjhb      </propertyset>
567195002Sjhb      <propertyset>
568156124Sjhb        <propertyref prefix="test-sys-prop-no-security."/>
569        <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
570      </propertyset>
571      <sysproperty key="optimistic.override" value="${optimistic}"/>
572      <classpath>
573          <pathelement path="${run.test.classpath}"/>
574      </classpath>
575    </testng>
576  </target>
577
578  <!-- only to be invoked as dependency of "test" target -->
579  <target name="-test-security">
580    <delete dir="${build.dir}/nashorn_code_cache"/>
581    <property name="debug.test.jvmargs" value=""/>
582    <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
583            verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
584      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
585      <jvmarg line="${debug.test.jvmargs}"/>
586      <propertyset>
587        <propertyref prefix="nashorn."/>
588      </propertyset>
589      <propertyset>
590        <propertyref prefix="test-sys-prop."/>
591        <mapper from="test-sys-prop.*" to="*" type="glob"/>
592      </propertyset>
593      <sysproperty key="optimistic.override" value="${optimistic}"/>
594      <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
595      <classpath>
596          <pathelement path="${run.test.classpath}"/>
597      </classpath>
598    </testng>
599  </target>
600
601  <target name="test" depends="prepare, javadoc, test-pessimistic, test-optimistic"/>
602
603  <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">
604    <echo message="Running test suite in OPTIMISTIC mode..."/>
605    <antcall target="-test-nosecurity" inheritRefs="true">
606      <param name="optimistic" value="true"/>
607      <param name="testResultsSubDir" value="optimistic"/>
608    </antcall>
609    <antcall target="-test-security" inheritRefs="true">
610      <param name="optimistic" value="true"/>
611      <param name="testResultsSubDir" value="optimistic"/>
612    </antcall>
613  </target>
614
615  <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">
616    <echo message="Running test suite in PESSIMISTIC mode..."/>
617    <antcall target="-test-nosecurity" inheritRefs="true">
618      <param name="optimistic" value="false"/>
619      <param name="testResultsSubDir" value="pessimistic"/>
620    </antcall>
621    <antcall target="-test-security" inheritRefs="true">
622      <param name="optimistic" value="false"/>
623      <param name="testResultsSubDir" value="pessimistic"/>
624    </antcall>
625  </target>
626
627  <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
628    <echo message="WARNING: Jemmy or JavaFX or TestNG not available, will not run tests. Please copy TestNG and dependency JARs, JemmyCore.jar, JemmyFX.jar, JemmyAWTInput.jar to the test${file.separator}lib directory. And make sure you have jfxrt.jar in ${java.home}${file.separator}lib${file.separator}ext dir."/>
629  </target>
630
631  <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
632    <fileset id="test.classes" dir="${build.test.classes.dir}">
633       <include name="**/framework/*Test.class"/>
634    </fileset>
635
636    <copy file="${file.reference.jfxrt.jar}" todir="dist"/>
637
638    <condition property="jfx.prism.order" value="-Dprism.order=j2d" else=" ">
639        <not>
640            <os family="mac"/>
641        </not>
642    </condition>
643
644    <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
645       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
646      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
647      <propertyset>
648        <propertyref prefix="testjfx-test-sys-prop."/>
649        <mapper from="testjfx-test-sys-prop.*" to="*" type="glob"/>
650      </propertyset>
651      <sysproperty key="test.fork.jvm.options" value="${testjfx-test-sys-prop.test.fork.jvm.options} ${jfx.prism.order}"/>
652      <classpath>
653          <pathelement path="${testjfx.run.test.classpath}"/>
654      </classpath>
655    </testng>
656  </target>
657
658  <target name="testmarkdown" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
659    <fileset id="test.classes" dir="${build.test.classes.dir}">
660       <include name="**/framework/*Test.class"/>
661    </fileset>
662
663    <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
664       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
665      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
666      <propertyset>
667        <propertyref prefix="testmarkdown-test-sys-prop."/>
668        <mapper from="testmarkdown-test-sys-prop.*" to="*" type="glob"/>
669      </propertyset>
670      <classpath>
671          <pathelement path="${run.test.classpath}"/>
672      </classpath>
673    </testng>
674  </target>
675
676  <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
677    <fileset id="test.classes" dir="${build.test.classes.dir}">
678       <include name="**/framework/*Test.class"/>
679    </fileset>
680
681    <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
682       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
683      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
684      <propertyset>
685        <propertyref prefix="nashorn."/>
686      </propertyset>
687      <propertyset>
688        <propertyref prefix="test262-test-sys-prop."/>
689        <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
690      </propertyset>
691      <classpath>
692          <pathelement path="${run.test.classpath}"/>
693      </classpath>
694    </testng>
695  </target>
696
697  <target name="test262parallel" depends="test262-parallel"/>
698
699  <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
700    <!-- use just build.test.classes.dir to avoid referring to TestNG -->
701    <java classname="${parallel.test.runner}" dir="${basedir}" fork="true" failonerror="true">
702      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
703      <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
704      <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
705      <classpath>
706          <pathelement path="${run.test.classpath}"/>
707      </classpath>
708      <syspropertyset>
709          <propertyref prefix="test262-test-sys-prop."/>
710          <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
711      </syspropertyset>
712    </java>
713  </target>
714
715  <target name="testparallel" depends="test-parallel"/>
716
717  <target name="test-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
718      <!-- use just build.test.classes.dir to avoid referring to TestNG -->
719      <java classname="${parallel.test.runner}" dir="${basedir}"
720        failonerror="true"
721        fork="true">
722      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
723      <classpath>
724          <pathelement path="${run.test.classpath}"/>
725      <pathelement path="${build.test.classes.dir}"/>
726      </classpath>
727      <syspropertyset>
728          <propertyref prefix="test-sys-prop."/>
729          <mapper type="glob" from="test-sys-prop.*" to="*"/>
730      </syspropertyset>
731      </java>
732  </target>
733
734  <target name="all" depends="test, docs"
735      description="Build, test and generate docs for nashorn"/>
736
737  <target name="run" depends="jar"
738      description="Run the shell with a sample script">
739    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
740        <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
741        <arg value="-dump-on-error"/>
742        <arg value="test.js"/>
743    </java>
744  </target>
745
746  <target name="debug" depends="jar"
747      description="Debug the shell with a sample script">
748    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
749        <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
750        <arg value="--print-code"/>
751        <arg value="--verify-code"/>
752        <arg value="--print-symbols"/>
753        <jvmarg value="-Dnashorn.codegen.debug=true"/>
754        <arg value="test.js"/>
755    </java>
756  </target>
757
758  <!-- targets to get external script tests -->
759
760  <!-- test262 test suite -->
761  <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
762    <!-- clone test262 git repo -->
763    <exec executable="${git.executable}">
764       <arg value="clone"/>
765       <arg value="--branch"/>
766       <arg value="es5-tests"/>
767       <arg value="https://github.com/tc39/test262"/>
768       <arg value="${test.external.dir}/test262"/>
769    </exec>
770  </target>
771  <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
772    <!-- update test262 git repo -->
773    <exec executable="${git.executable}" dir="${test.external.dir}/test262">
774       <arg value="pull"/>
775    </exec>
776  </target>
777
778  <!-- octane benchmark -->
779  <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
780    <!-- checkout octane benchmarks -->
781    <exec executable="${git.executable}">
782       <arg value="clone"/>
783       <arg value="https://github.com/chromium/octane"/>
784       <arg value="${test.external.dir}/octane"/>
785    </exec>
786  </target>
787  <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
788    <!-- update octane benchmarks -->
789    <exec executable="${git.executable}" dir="${test.external.dir}/octane">
790       <arg value="pull"/>
791    </exec>
792  </target>
793
794  <!-- sunspider benchmark -->
795  <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
796    <!-- checkout sunspider -->
797    <exec executable="${svn.executable}">
798       <arg value="--non-interactive"/>
799       <arg value="--trust-server-cert"/>
800       <arg value="checkout"/>
801       <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
802       <arg value="${test.external.dir}/sunspider"/>
803    </exec>
804  </target>
805  <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
806    <!-- update sunspider -->
807    <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
808       <arg value="--non-interactive"/>
809       <arg value="--trust-server-cert"/>
810       <arg value="update"/>
811    </exec>
812  </target>
813
814  <!-- get all external test scripts -->
815  <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
816    <!-- make external test dir -->
817    <mkdir dir="${test.external.dir}"/>
818
819    <!-- jquery -->
820    <mkdir dir="${test.external.dir}/jquery"/>
821    <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
822    <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
823
824    <!-- prototype -->
825    <mkdir dir="${test.external.dir}/prototype"/>
826    <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"/>
827
828    <!-- underscorejs -->
829    <mkdir dir="${test.external.dir}/underscore"/>
830    <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
831    <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
832
833    <!-- yui -->
834    <mkdir dir="${test.external.dir}/yui"/>
835    <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
836    <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
837
838    <!-- showdown -->
839    <mkdir dir="${test.external.dir}/showdown"/>
840    <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/showdown.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
841    <get src="https://raw.githubusercontent.com/showdownjs/showdown/0.5.4/src/extensions/table.js" dest="${test.external.dir}/showdown" skipexisting="true" ignoreerrors="true"/>
842
843  </target>
844
845  <!-- update external test suites that are pulled from source control systems -->
846  <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
847
848  <!-- run all perf tests -->
849  <target name="perf" depends="externals, update-externals, sunspider, octane"/>
850
851  <!-- download and install testng.jar -->
852  <target name="get-testng">
853    <get dest="${test.lib}" skipexisting="true">
854      <url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
855      <url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
856      <url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
857      <url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
858    </get>
859  </target>
860
861  <!-- download and install asmtools.jar -->
862  <target name="get-asmtools" unless="asmtools.already.present">
863    <get src="https://adopt-openjdk.ci.cloudbees.com/view/OpenJDK/job/asmtools/lastSuccessfulBuild/artifact/asmtools-6.0.tar.gz" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
864    <untar src="${test.lib}${file.separator}asmtools-6.0.tar.gz" dest="${test.lib}" compression="gzip"/>
865    <!-- they are tar.gz'ing a .zip file! -->
866    <unzip src="${test.lib}${file.separator}asmtools-6.0.zip" dest="${test.lib}">
867      <patternset>
868        <include name="asmtools-6.0/lib/asmtools.jar"/>
869      </patternset>
870    </unzip>
871    <move file="${test.lib}${file.separator}asmtools-6.0${file.separator}lib${file.separator}asmtools.jar" tofile="${test.lib}${file.separator}asmtools.jar"/>
872    <delete dir="${test.lib}${file.separator}asmtools-6.0"/>
873  </target>
874
875  <!-- run all tests -->
876  <target name="alltests" depends="externals, update-externals, test, test262parallel, testmarkdown, perf"/>
877
878  <import file="build-benchmark.xml"/>
879
880</project>
881