build.xml revision 287:704bc91a0c41
1190391Ssam<?xml version="1.0" encoding="UTF-8"?>
2190391Ssam<!--
3190391Ssam Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
4190391Ssam DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5190391Ssam
6190391Ssam This code is free software; you can redistribute it and/or modify it
7190391Ssam under the terms of the GNU General Public License version 2 only, as
8190391Ssam published by the Free Software Foundation.
9190391Ssam
10190391Ssam This code is distributed in the hope that it will be useful, but WITHOUT
11190391Ssam ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12190391Ssam FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13190391Ssam version 2 for more details (a copy is included in the LICENSE file that
14190391Ssam accompanied this code).
15190391Ssam
16190391Ssam You should have received a copy of the GNU General Public License version
17190391Ssam 2 along with this work; if not, write to the Free Software Foundation,
18190391Ssam Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19190391Ssam
20190391Ssam Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21190391Ssam or visit www.oracle.com if you need additional information or have any
22190391Ssam questions.
23190391Ssam-->
24190391Ssam<project name="nashorn" default="test" basedir="..">
25190391Ssam  <import file="build-nasgen.xml"/>
26190391Ssam  <import file="build-benchmark.xml"/>
27190391Ssam  <import file="code_coverage.xml"/>
28190391Ssam
29190391Ssam
30190391Ssam  <target name="init-conditions">
31246226Sadrian    <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later -->
32246226Sadrian    <property file="${user.home}/.nashorn.project.local.properties"/>
33190391Ssam
34190391Ssam    <loadproperties srcFile="make/project.properties"/>
35190391Ssam    <path id="nashorn.ext.path">
36190391Ssam      <pathelement location="${dist.dir}"/>
37190391Ssam    </path>
38190391Ssam    <property name="ext.class.path" value="-Djava.ext.dirs=&quot;${toString:nashorn.ext.path}&quot;"/>
39190391Ssam    <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
40190391Ssam      <available file="/usr/local/bin/svn"/>
41190391Ssam    </condition>
42190391Ssam    <condition property="hg.executable" value="/usr/local/bin/hg" else="hg">
43190391Ssam      <available file="/usr/local/bin/hg"/>
44190391Ssam    </condition>
45190391Ssam    <!-- check if JDK already has ASM classes -->
46190391Ssam    <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/>
47190391Ssam    <!-- check if testng.jar is avaiable -->
48190391Ssam    <available property="testng.available" file="${file.reference.testng.jar}"/>
49190391Ssam
50190391Ssam	<!-- enable/disable make code coverage -->
51190391Ssam	<condition property="cc.enabled">
52190455Ssam		<istrue value="${make.code.coverage}" />
53190455Ssam	</condition>
54190455Ssam  </target>
55190455Ssam
56190455Ssam  <target name="init" depends="init-conditions, init-cc">
57190455Ssam
58190455Ssam	<!-- extends jvm args -->
59190455Ssam	<property name="run.test.jvmargs" value="${run.test.jvmargs.main}  ${run.test.cc.jvmargs}"/>
60190455Ssam	<property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main}  ${run.test.cc.jvmargs}" />
61190455Ssam
62190455Ssam    <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
63190455Ssam    <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
64190455Ssam
65190455Ssam  </target>
66190455Ssam
67190455Ssam  <target name="prepare" depends="init">
68190455Ssam    <mkdir dir="${build.dir}"/>
69190455Ssam    <mkdir dir="${build.classes.dir}"/>
70190455Ssam    <mkdir dir="${build.classes.dir}/META-INF/services"/>
71190455Ssam    <mkdir dir="${build.test.classes.dir}"/>
72190455Ssam    <mkdir dir="${dist.dir}"/>
73190455Ssam    <mkdir dir="${dist.javadoc.dir}"/>
74190455Ssam  </target>
75190455Ssam
76190455Ssam  <target name="clean" depends="init, clean-nasgen, init-cc-cleanup">
77190455Ssam    <delete includeemptydirs="true">
78190455Ssam      <fileset dir="${build.dir}" erroronmissingdir="false"/>
79190455Ssam    </delete>
80190455Ssam    <delete dir="${dist.dir}"/>
81190579Ssam  </target>
82190579Ssam
83190579Ssam  <!-- do it only if ASM is not available -->
84190579Ssam  <target name="compile-asm" depends="prepare" unless="asm.available">
85190391Ssam    <javac srcdir="${jdk.asm.src.dir}"
86190391Ssam           destdir="${build.classes.dir}"
87190391Ssam           excludes="**/optimizer/* **/xml/* **/attrs/*"
88193115Ssam           source="${javac.source}"
89193115Ssam           target="${javac.target}"
90193115Ssam           debug="${javac.debug}"
91193115Ssam           encoding="${javac.encoding}"
92193115Ssam           includeantruntime="false"/>
93193115Ssam  </target>
94193115Ssam
95190579Ssam  <target name="compile" depends="compile-asm" description="Compiles nashorn">
96190391Ssam    <javac srcdir="${src.dir}"
97190391Ssam           destdir="${build.classes.dir}"
98190391Ssam           classpath="${javac.classpath}"
99191753Ssam           source="${javac.source}"
100191753Ssam           target="${javac.target}"
101191753Ssam           debug="${javac.debug}"
102191753Ssam           encoding="${javac.encoding}"
103191753Ssam           includeantruntime="false">
104191753Ssam      <compilerarg value="-Xlint:unchecked"/>
105191753Ssam      <compilerarg value="-Xlint:deprecation"/>
106191753Ssam      <compilerarg value="-XDignore.symbol.file"/>
107191753Ssam    </javac>
108191753Ssam    <copy todir="${build.classes.dir}/META-INF/services">
109191753Ssam       <fileset dir="${meta.inf.dir}/services/"/>
110191753Ssam    </copy>
111191753Ssam     <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
112190579Ssam       <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
113190391Ssam    </copy>
114190391Ssam    <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
115190391Ssam       <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
116190391Ssam    </copy>
117190391Ssam    <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
118191753Ssam       <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
119191753Ssam    </copy>
120191753Ssam    <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/>
121191753Ssam
122190391Ssam    <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
123190391Ssam    <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
124190391Ssam    <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
125190391Ssam  </target>
126190391Ssam
127191753Ssam  <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar">
128191753Ssam    <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
129191753Ssam      <fileset dir="${build.classes.dir}"/>
130191753Ssam      <manifest>
131190391Ssam        <attribute name="Archiver-Version" value="n/a"/>
132190391Ssam        <attribute name="Build-Jdk" value="${java.runtime.version}"/>
133190450Ssam        <attribute name="Built-By" value="n/a"/>
134190450Ssam        <attribute name="Created-By" value="Ant jar task"/>
135190450Ssam        <section name="jdk/nashorn/">
136190391Ssam          <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
137190391Ssam          <attribute name="Implementation-Version" value="${nashorn.version}"/>
138190391Ssam        </section>
139190391Ssam      </manifest>
140190391Ssam    </jar>
141190391Ssam  </target>
142190391Ssam  
143190391Ssam  <target name="build-fxshell" depends="jar">
144190391Ssam    <description>Builds the javafx shell.</description>
145190391Ssam    <mkdir dir="${fxshell.classes.dir}"/>
146190391Ssam    <javac srcdir="${fxshell.dir}"
147190391Ssam           destdir="${fxshell.classes.dir}"
148190391Ssam           classpath="${dist.jar}:${javac.classpath}"
149190451Ssam           debug="${javac.debug}"
150190391Ssam           encoding="${javac.encoding}"
151190391Ssam           includeantruntime="false">
152190391Ssam    </javac>
153190391Ssam    <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
154190391Ssam      <fileset dir="${fxshell.classes.dir}"/>
155190391Ssam      <manifest>
156190391Ssam        <attribute name="Archiver-Version" value="n/a"/>
157190391Ssam        <attribute name="Build-Jdk" value="${java.runtime.version}"/>
158190391Ssam        <attribute name="Built-By" value="n/a"/>
159190391Ssam        <attribute name="Created-By" value="Ant jar task"/>
160190391Ssam        <section name="jdk/nashorn/">
161190391Ssam          <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/>
162190391Ssam          <attribute name="Implementation-Version" value="${nashorn.version}"/>
163190451Ssam        </section>
164190451Ssam      </manifest>
165190451Ssam    </jar>
166190451Ssam  </target>
167190451Ssam
168190451Ssam  <target name="javadoc" depends="prepare">
169190451Ssam    <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" windowtitle="${nashorn.product.name} ${nashorn.version}" additionalparam="-quiet" failonerror="true">
170190391Ssam      <classpath>
171190391Ssam        <pathelement location="${build.classes.dir}"/>
172190391Ssam      </classpath>
173190391Ssam      <fileset dir="${src.dir}" includes="**/*.java"/>
174190451Ssam      <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
175190451Ssam      <link href="http://docs.oracle.com/javase/7/docs/api/"/>
176190451Ssam      <!-- The following tags are used only in ASM sources - just ignore these -->
177190451Ssam      <tag name="label" description="label tag in ASM sources" enabled="false"/>
178190451Ssam      <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
179190451Ssam      <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
180190451Ssam    </javadoc>
181190451Ssam  </target>
182190451Ssam
183190451Ssam  <!-- generate shell.html for shell tool documentation -->
184190451Ssam  <target name="shelldoc" depends="jar">
185190451Ssam    <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
186190391Ssam      <jvmarg line="${ext.class.path}"/>
187190391Ssam      <arg value="-scripting"/>
188190391Ssam      <arg value="docs/genshelldoc.js"/>
189190391Ssam    </java>
190190391Ssam  </target>
191190391Ssam
192190391Ssam  <!-- generate all docs -->
193190391Ssam  <target name="docs" depends="javadoc, shelldoc"/>
194190391Ssam
195190391Ssam  <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
196190391Ssam  <target name="dist" depends="jar">
197190391Ssam      <zip destfile="${build.zip}" basedir=".."
198190391Ssam          excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
199190391Ssam      <tar destfile="${build.gzip}" basedir=".." compression="gzip"
200190391Ssam          excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
201190391Ssam  </target>
202190391Ssam
203190391Ssam  <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
204190391Ssam    <!-- testng task -->
205190391Ssam    <taskdef name="testng" classname="org.testng.TestNGAntTask"
206190391Ssam        classpath="${file.reference.testng.jar}"/>
207190391Ssam
208190391Ssam    <javac srcdir="${test.src.dir}"
209190391Ssam           destdir="${build.test.classes.dir}"
210190391Ssam           classpath="${javac.test.classpath}"
211190391Ssam           source="${javac.source}"
212190391Ssam           target="${javac.target}"
213190391Ssam           debug="${javac.debug}"
214190391Ssam           encoding="${javac.encoding}"
215190391Ssam           includeantruntime="false">
216190391Ssam        <compilerarg line="-extdirs &quot;&quot;"/>
217190391Ssam    </javac>
218190391Ssam
219190391Ssam    <!-- tests that check nashorn internals and internal API -->
220190391Ssam    <jar jarfile="${nashorn.internal.tests.jar}">
221190391Ssam      <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/>
222190391Ssam    </jar>
223190391Ssam
224190391Ssam    <!-- tests that check nashorn script engine (jsr-223) API -->
225190391Ssam    <jar jarfile="${nashorn.api.tests.jar}">
226190391Ssam      <fileset dir="${build.test.classes.dir}" includes="**/api/**"/>
227190391Ssam    </jar>
228190391Ssam
229190391Ssam  </target>
230190391Ssam
231190391Ssam  <target name="generate-policy-file" depends="prepare">
232190391Ssam    <!-- Generating nashorn.policy file -->
233190391Ssam
234190391Ssam    <!-- nashorn internal tests jar requires AllPermission -->
235190391Ssam    <echo message="grant codeBase &quot;file:/${basedir}/${nashorn.internal.tests.jar}&quot; {" file="${build.dir}/nashorn.policy"/>
236190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
237190391Ssam    <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
238190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
239190391Ssam    <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
240190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
241190391Ssam    
242190391Ssam    <!-- TestNG framework jar needs AllPermission -->
243190391Ssam    <echo message="grant codeBase &quot;file:/${basedir}/${file.reference.testng.jar}&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
244190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
245190391Ssam    <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
246190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
247190391Ssam    <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
248190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
249190391Ssam
250190391Ssam    <!-- AllPermission to test/script/trusted tests -->
251190391Ssam    <echo message="grant codeBase &quot;file:/${basedir}/test/script/trusted/*&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
252190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
253190391Ssam    <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
254190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
255190391Ssam    <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
256190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
257190391Ssam
258190391Ssam    <echo message="grant codeBase &quot;file:/${basedir}/test/script/basic/*&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
259190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
260190391Ssam    <!-- test/script/basic .js scripts load other script tests -->
261190391Ssam    <echo message="    permission java.io.FilePermission &quot;${basedir}/test/script/-&quot;, &quot;read&quot;;" file="${build.dir}/nashorn.policy" append="true"/>
262190391Ssam    <echo message="    permission java.io.FilePermission &quot;user.dir&quot;, &quot;read&quot;;" file="${build.dir}/nashorn.policy" append="true"/>
263190391Ssam    <echo message="    permission java.util.PropertyPermission &quot;user.dir&quot;, &quot;read&quot;;" file="${build.dir}/nashorn.policy" append="true"/>
264190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
265190391Ssam    <!-- test/script/basic .js scripts can read nashorn.test.* properties -->
266190391Ssam    <echo message="    permission java.util.PropertyPermission &quot;nashorn.test.*&quot;, &quot;read&quot;;" file="${build.dir}/nashorn.policy" append="true"/>
267190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
268190391Ssam    <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
269190391Ssam    <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
270190391Ssam
271190391Ssam    <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
272190391Ssam    <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace>   <!--hack for Unix - to avoid leading // in URLs -->
273190391Ssam
274190391Ssam  </target>
275190391Ssam
276190391Ssam  <target name="check-external-tests">
277190391Ssam      <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
278190391Ssam      <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
279190391Ssam      <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
280190391Ssam      <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
281190391Ssam      <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
282190391Ssam      <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
283190391Ssam      <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
284190391Ssam  </target>
285190391Ssam
286190391Ssam  <target name="check-testng" unless="testng.available">
287190391Ssam    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
288190391Ssam  </target>
289190391Ssam
290190391Ssam  <target name="test" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
291190391Ssam    <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output1.log" error="${build.dir}/err.log">
292190391Ssam      <jvmarg line="${ext.class.path}"/>
293190391Ssam      <jvmarg line="-Dnashorn.fields.dual=true"/>
294190391Ssam      <arg value="NASHORN-592a.js"/>
295190391Ssam    </java>
296190391Ssam    <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output2.log" error="${build.dir}/err.log">
297190391Ssam      <jvmarg line="${ext.class.path}"/>
298190391Ssam      <arg value="NASHORN-592a.js"/>
299190391Ssam    </java>
300190391Ssam    <condition property="representation-ok">
301190391Ssam      <filesmatch file1="${build.dir}/output1.log" file2="${build.dir}/output2.log"/>
302190391Ssam    </condition>
303190391Ssam    <fail unless="representation-ok">Representation test failed - output differs!</fail>
304190391Ssam    <fileset id="test.classes" dir="${build.test.classes.dir}">
305190391Ssam      <include name="**/api/javaaccess/*Test.class"/>
306190391Ssam      <include name="**/api/scripting/*Test.class"/>
307190391Ssam      <include name="**/codegen/*Test.class"/>
308190391Ssam      <include name="**/parser/*Test.class"/>
309190391Ssam      <include name="**/runtime/*Test.class"/>
310190391Ssam      <include name="**/runtime/regexp/*Test.class"/>
311190391Ssam      <include name="**/runtime/regexp/joni/*Test.class"/>
312190391Ssam      <include name="**/framework/*Test.class"/>
313190391Ssam    </fileset>
314190391Ssam
315190391Ssam    <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
316190391Ssam       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
317190391Ssam      <jvmarg line="${ext.class.path}"/>
318190391Ssam      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
319190391Ssam      <propertyset>
320190391Ssam        <propertyref prefix="test-sys-prop."/>
321190391Ssam        <mapper from="test-sys-prop.*" to="*" type="glob"/>
322190391Ssam      </propertyset>
323190391Ssam      <classpath>
324190391Ssam          <pathelement path="${run.test.classpath}"/>
325190391Ssam      </classpath>
326190391Ssam    </testng>
327190391Ssam  </target>
328190391Ssam
329190391Ssam  <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
330190391Ssam      <!-- use just build.test.classes.dir to avoid referring to TestNG -->
331190391Ssam      <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" failonerror="true" fork="true">
332190391Ssam      <jvmarg line="${ext.class.path}"/>
333190391Ssam      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
334190391Ssam      <syspropertyset>
335190391Ssam          <propertyref prefix="test-sys-prop."/>
336190391Ssam          <mapper type="glob" from="test-sys-prop.*" to="*"/>
337190391Ssam      </syspropertyset>
338190391Ssam      </java>
339190391Ssam  </target>
340190391Ssam
341190391Ssam  <target name="test262" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
342190391Ssam    <fileset id="test.classes" dir="${build.test.classes.dir}">
343190391Ssam       <include name="**/framework/*Test.class"/>
344190391Ssam    </fileset>
345190391Ssam
346190391Ssam    <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
347190391Ssam       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
348190391Ssam      <jvmarg line="${ext.class.path}"/>
349190391Ssam      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
350190391Ssam      <propertyset>
351190391Ssam        <propertyref prefix="test262-test-sys-prop."/>
352190391Ssam        <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
353190391Ssam      </propertyset>
354190391Ssam      <classpath>
355190391Ssam          <pathelement path="${run.test.classpath}"/>
356190391Ssam      </classpath>
357243882Sglebius    </testng>
358190391Ssam  </target>
359190391Ssam
360190391Ssam  <target name="test262parallel" depends="test262-parallel"/>
361190391Ssam
362190391Ssam  <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
363190391Ssam    <!-- use just build.test.classes.dir to avoid referring to TestNG -->
364190391Ssam    <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
365190391Ssam      <jvmarg line="${ext.class.path}"/>
366190391Ssam      <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
367190391Ssam      <classpath>
368190391Ssam          <pathelement path="${run.test.classpath}"/>
369190391Ssam      </classpath>
370190391Ssam      <syspropertyset>
371190391Ssam          <propertyref prefix="test262-test-sys-prop."/>
372190391Ssam          <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
373190391Ssam      </syspropertyset>
374190391Ssam    </java>
375190391Ssam  </target>
376190391Ssam
377190391Ssam  <target name="all" depends="test, docs"
378190391Ssam      description="Build, test and generate docs for nashorn"/>
379190391Ssam
380190391Ssam  <target name="run" depends="jar"
381190391Ssam      description="Run the shell with a sample script">
382190391Ssam    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
383190391Ssam        <jvmarg line="${ext.class.path}"/>
384190391Ssam        <jvmarg line="${run.test.jvmargs}"/>
385190391Ssam        <arg value="-dump-on-error"/>
386190391Ssam        <arg value="test.js"/>
387190391Ssam    </java>
388190391Ssam  </target>
389190391Ssam
390190391Ssam  <target name="debug" depends="jar"
391190391Ssam      description="Debug the shell with a sample script">
392190391Ssam    <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
393190579Ssam        <jvmarg line="${ext.class.path}"/>
394190391Ssam        <jvmarg line="${run.test.jvmargs}"/>
395190579Ssam        <arg value="--print-code"/>
396190579Ssam        <arg value="--verify-code"/>
397190391Ssam        <arg value="--print-symbols"/>
398190391Ssam        <jvmarg value="-Dnashorn.codegen.debug=true"/>
399190391Ssam        <arg value="test.js"/>
400190391Ssam    </java>
401190391Ssam  </target>
402190391Ssam
403190391Ssam  <!-- targets to get external script tests -->
404190391Ssam
405190391Ssam  <!-- test262 test suite -->
406190391Ssam  <target name="get-test262" depends="init" unless="${test-sys-prop.external.test262}">
407190391Ssam    <!-- clone test262 mercurial repo -->
408190391Ssam    <exec executable="${hg.executable}">
409190391Ssam       <arg value="clone"/>
410190391Ssam       <arg value="http://hg.ecmascript.org/tests/test262"/>
411190391Ssam       <arg value="${test.external.dir}/test262"/>
412190391Ssam    </exec>
413190391Ssam  </target>
414190391Ssam  <target name="update-test262" depends="init" if="${test-sys-prop.external.test262}">
415190391Ssam    <!-- update test262 mercurial repo -->
416190391Ssam    <exec executable="${hg.executable}" dir="${test.external.dir}/test262">
417190391Ssam       <arg value="pull"/>
418190391Ssam       <arg value="-u"/>
419190391Ssam    </exec>
420190391Ssam  </target>
421190391Ssam
422190391Ssam  <!-- octane benchmark -->
423190391Ssam  <target name="get-octane" depends="init" unless="${test-sys-prop.external.octane}">
424190391Ssam    <!-- checkout octane benchmarks -->
425190391Ssam    <exec executable="${svn.executable}">
426190391Ssam       <arg value="--non-interactive"/>
427190391Ssam       <arg value="--trust-server-cert"/>
428190391Ssam       <arg value="checkout"/>
429190391Ssam       <arg value="http://octane-benchmark.googlecode.com/svn/trunk/"/>
430190391Ssam       <arg value="${test.external.dir}/octane"/>
431190391Ssam    </exec>
432190391Ssam  </target>
433190391Ssam  <target name="update-octane" depends="init" if="${test-sys-prop.external.octane}">
434190391Ssam    <!-- update octane benchmarks -->
435190391Ssam    <exec executable="${svn.executable}" dir="${test.external.dir}/octane">
436190391Ssam       <arg value="--non-interactive"/>
437190391Ssam       <arg value="--trust-server-cert"/>
438190391Ssam       <arg value="update"/>
439190391Ssam    </exec>
440190391Ssam  </target>
441190391Ssam
442190391Ssam  <!-- sunspider benchmark -->
443190391Ssam  <target name="get-sunspider" depends="init" unless="${test-sys-prop.external.sunspider}">
444190391Ssam    <!-- checkout sunspider -->
445190391Ssam    <exec executable="${svn.executable}">
446190391Ssam       <arg value="--non-interactive"/>
447190391Ssam       <arg value="--trust-server-cert"/>
448190391Ssam       <arg value="checkout"/>
449190391Ssam       <arg value="http://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider"/>
450190391Ssam       <arg value="${test.external.dir}/sunspider"/>
451190391Ssam    </exec>
452190391Ssam  </target>
453190391Ssam  <target name="update-sunspider" depends="init" if="${test-sys-prop.external.sunspider}">
454190391Ssam    <!-- update sunspider -->
455190391Ssam    <exec executable="${svn.executable}" dir="${test.external.dir}/sunspider">
456190391Ssam       <arg value="--non-interactive"/>
457190391Ssam       <arg value="--trust-server-cert"/>
458190391Ssam       <arg value="update"/>
459190391Ssam    </exec>
460190391Ssam  </target>
461190391Ssam
462190391Ssam  <!-- get all external test scripts -->
463190391Ssam  <target name="externals" depends="init, check-external-tests, get-test262, get-octane, get-sunspider">
464190391Ssam    <!-- make external test dir -->
465243882Sglebius    <mkdir dir="${test.external.dir}"/> 
466190391Ssam
467190391Ssam    <!-- jquery -->
468190391Ssam    <mkdir dir="${test.external.dir}/jquery"/>    
469190391Ssam    <get src="http://code.jquery.com/jquery-1.7.2.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
470190391Ssam    <get src="http://code.jquery.com/jquery-1.7.2.min.js" dest="${test.external.dir}/jquery" skipexisting="true" ignoreerrors="true"/>
471190391Ssam
472190391Ssam    <!-- prototype -->
473190391Ssam    <mkdir dir="${test.external.dir}/prototype"/>    
474243882Sglebius    <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"/>
475190391Ssam
476190391Ssam    <!-- underscorejs -->
477190391Ssam    <mkdir dir="${test.external.dir}/underscore"/> 
478190391Ssam    <get src="http://underscorejs.org/underscore.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
479190391Ssam    <get src="http://underscorejs.org/underscore-min.js" dest="${test.external.dir}/underscore" skipexisting="true" ignoreerrors="true"/>
480190391Ssam
481190391Ssam    <!-- yui -->
482190391Ssam    <mkdir dir="${test.external.dir}/yui"/> 
483190391Ssam    <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
484190391Ssam    <get src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js" dest="${test.external.dir}/yui" skipexisting="true" ignoreerrors="true"/>
485190391Ssam
486190391Ssam  </target>
487190391Ssam
488190391Ssam  <!-- update external test suites that are pulled from source control systems -->
489190391Ssam  <target name="update-externals" depends="init, check-external-tests, update-test262, update-octane, update-sunspider"/>
490190391Ssam
491190391Ssam  <!-- run all perf tests -->
492190391Ssam  <target name="perf" depends="externals, update-externals, sunspider, octane"/>
493190391Ssam
494190391Ssam  <!-- run all tests -->
495190391Ssam  <target name="exit-if-no-testng" depends="init, check-testng" unless="${testng.available}">
496190391Ssam     <fail message="Exiting.."/>
497190391Ssam  </target>
498190391Ssam
499190391Ssam  <target name="alltests" depends="exit-if-no-testng, externals, update-externals, test, test262parallel, perf"/>
500190579Ssam
501190579Ssam</project>
502190579Ssam