changeset 1624:cfb316745693 jdk-9+106

8149744: fix testng.jar delivery in Nashorn build.xml Reviewed-by: hannesw, sundar
author mhaupt
date Fri, 12 Feb 2016 17:00:54 +0100
parents f2288ee085ac
children d99fa86747ee d321fd016476
files .hgignore make/build.xml make/project.properties
diffstat 3 files changed, 61 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Feb 11 16:05:22 2016 -0800
+++ b/.hgignore	Fri Feb 12 17:00:54 2016 +0100
@@ -23,8 +23,7 @@
 CC/*
 jcov2/*
 .idea/*
-test/lib/testng*.zip
-test/lib/testng.jar
+test/lib/*.jar
 test/script/external/*
 .project
 .externalToolBuilders/*
--- a/make/build.xml	Thu Feb 11 16:05:22 2016 -0800
+++ b/make/build.xml	Fri Feb 12 17:00:54 2016 +0100
@@ -48,10 +48,16 @@
     <condition property="git.executable" value="/usr/local/bin/git" else="git">
       <available file="/usr/local/bin/git"/>
     </condition>
-    <!-- check if testng.jar is available, and download it if it isn't -->
-    <available property="testng.already.present" file="${file.reference.testng.jar}"/>
+    <!-- check if TestNG and dependencies are available, and download them if they aren't -->
     <antcall target="get-testng"/>
-    <available property="testng.available" file="${file.reference.testng.jar}"/>
+    <condition property="testng.available" value="true">
+      <and>
+        <available file="${file.reference.testng.jar}"/>
+        <available file="${file.reference.jcommander.jar}"/>
+        <available file="${file.reference.bsh.jar}"/>
+        <available file="${file.reference.snakeyaml.jar}"/>
+      </and>
+    </condition>
 
     <!-- check if asmtools-6.0.jar is available, and download it if it isn't -->
     <!--
@@ -60,7 +66,7 @@
     <available property="asmtools.available" file="${file.reference.asmtools.jar}"/>
     -->
 
-    <!-- check if Jemmy ang testng.jar are avaiable -->
+    <!-- check if Jemmy ang TestNG are avaiable -->
     <condition property="jemmy.jfx.testng.available" value="true">
       <and>
         <available file="${file.reference.jemmyfx.jar}"/>
@@ -314,7 +320,7 @@
   <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
     <!-- testng task -->
     <taskdef name="testng" classname="org.testng.TestNGAntTask"
-        classpath="${file.reference.testng.jar}"/>
+        classpath="${testng.ant.classpath}"/>
 
     <javac srcdir="${test.src.dir}"
            destdir="${build.test.classes.dir}"
@@ -389,6 +395,15 @@
 grant codeBase "file:/${basedir}/${file.reference.testng.jar}" {
     permission java.security.AllPermission;
 };
+grant codeBase "file:/${basedir}/${file.reference.jcommander.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${basedir}/${file.reference.bsh.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${basedir}/${file.reference.snakeyaml.jar}" {
+    permission java.security.AllPermission;
+};
 //// in case of absolute path:
 grant codeBase "file:/${nashorn.internal.tests.jar}" {
     permission java.security.AllPermission;
@@ -397,6 +412,16 @@
 grant codeBase "file:/${file.reference.testng.jar}" {
     permission java.security.AllPermission;
 };
+grant codeBase "file:/${file.reference.jcommander.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${file.reference.bsh.jar}" {
+    permission java.security.AllPermission;
+};
+grant codeBase "file:/${file.reference.snakeyaml.jar}" {
+    permission java.security.AllPermission;
+};
+
 
 grant codeBase "file:/${basedir}/test/script/trusted/*" {
     permission java.security.AllPermission;
@@ -466,7 +491,7 @@
   </target>
 
   <target name="check-testng" unless="testng.available">
-    <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under ${test.lib} directory."/>
+    <echo message="WARNING: TestNG not available, will not run tests. Please copy TestNG and dependency JARs to the ${test.lib} directory."/>
   </target>
 
   <!-- only to be invoked as dependency of "test" target -->
@@ -569,7 +594,7 @@
   </target>
 
   <target name="check-jemmy.jfx.testng" unless="jemmy.jfx.testng.available">
-    <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."/>
+    <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."/>
   </target>
 
   <target name="testjfx" depends="jar, check-jemmy.jfx.testng, compile-test" if="jemmy.jfx.testng.available">
@@ -804,15 +829,13 @@
   <target name="perf" depends="externals, update-externals, sunspider, octane"/>
 
   <!-- download and install testng.jar -->
-  <target name="get-testng" unless="testng.already.present">
-    <get src="http://testng.org/testng-6.8.zip" dest="${test.lib}" skipexisting="true" ignoreerrors="true"/>
-    <unzip src="${test.lib}${file.separator}testng-6.8.zip" dest="${test.lib}">
-      <patternset>
-        <include name="testng-6.8/testng-6.8.jar"/>
-      </patternset>
-    </unzip>
-    <move file="${test.lib}${file.separator}testng-6.8${file.separator}testng-6.8.jar" tofile="${test.lib}${file.separator}testng.jar"/>
-    <delete dir="${test.lib}${file.separator}testng-6.8"/>
+  <target name="get-testng">
+    <get dest="${test.lib}" skipexisting="true">
+      <url url="http://central.maven.org/maven2/org/testng/testng/6.8/testng-6.8.jar"/>
+      <url url="http://central.maven.org/maven2/com/beust/jcommander/1.27/jcommander-1.27.jar"/>
+      <url url="http://central.maven.org/maven2/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
+      <url url="http://central.maven.org/maven2/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar"/>
+    </get>
   </target>
 
   <!-- download and install asmtools.jar -->
--- a/make/project.properties	Thu Feb 11 16:05:22 2016 -0800
+++ b/make/project.properties	Fri Feb 12 17:00:54 2016 +0100
@@ -84,9 +84,19 @@
 test.lib=${basedir}${file.separator}test${file.separator}lib
 
 # jars refererred
-file.reference.testng.jar=${test.lib}${file.separator}testng.jar
+file.reference.testng.jar=${test.lib}${file.separator}testng-6.8.jar
+file.reference.jcommander.jar=${test.lib}${file.separator}jcommander-1.27.jar
+file.reference.bsh.jar=${test.lib}${file.separator}bsh-2.0b4.jar
+file.reference.snakeyaml.jar=${test.lib}${file.separator}snakeyaml-1.6.jar
 file.reference.asmtools.jar=${test.lib}${file.separator}asmtools-60.jar
 
+# TestNG ant task classpath
+testng.ant.classpath=\
+    ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}
+
 # Set testng verbose level
 # From TestNG docs: "the verbosity level (0 to 10 where 10 is most detailed)
 # Actually, this is a lie: you can specify -1 and this will put TestNG in
@@ -114,7 +124,10 @@
 javac.test.classpath=\
     ${build.classes.dir}${path.separator}\
     ${build.test.classes.dir}${path.separator}\
-    ${file.reference.testng.jar}
+    ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}
 
 meta.inf.dir=${nashorn.module.src.dir}/META-INF
 
@@ -265,6 +278,9 @@
     ${file.reference.jemmycore.jar}${path.separator}\
     ${file.reference.jemmyawtinput.jar}${path.separator}\
     ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}\
     ${nashorn.internal.tests.jar}${path.separator}\
     ${nashorn.api.tests.jar}
 
@@ -273,6 +289,9 @@
 
 run.test.classpath=\
     ${file.reference.testng.jar}${path.separator}\
+    ${file.reference.jcommander.jar}${path.separator}\
+    ${file.reference.bsh.jar}${path.separator}\
+    ${file.reference.snakeyaml.jar}${path.separator}\
     ${nashorn.internal.tests.jar}${path.separator}\
     ${nashorn.api.tests.jar}