You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2017/10/08 13:28:09 UTC

incubator-netbeans git commit: Adding ability to run tests using javac from the underlying JDK.

Repository: incubator-netbeans
Updated Branches:
  refs/heads/jdk-javac b2d52217a -> 8ae80dcd9


Adding ability to run tests using javac from the underlying JDK.


Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/commit/8ae80dcd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/tree/8ae80dcd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/diff/8ae80dcd

Branch: refs/heads/jdk-javac
Commit: 8ae80dcd92e8a6e79999c53f1a8f5f731cb6ab6b
Parents: b2d5221
Author: Jan Lahoda <jl...@netbeans.org>
Authored: Sun Oct 8 15:26:55 2017 +0200
Committer: Jan Lahoda <jl...@netbeans.org>
Committed: Sun Oct 8 15:26:55 2017 +0200

----------------------------------------------------------------------
 nbbuild/jdk.xml                   | 10 ++++++++++
 nbbuild/templates/common.xml      | 27 ++++++++++++++++-----------
 nbbuild/templates/projectized.xml | 26 +++++++++++++++-----------
 3 files changed, 41 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/8ae80dcd/nbbuild/jdk.xml
----------------------------------------------------------------------
diff --git a/nbbuild/jdk.xml b/nbbuild/jdk.xml
index 5f3935a..76f76f0 100644
--- a/nbbuild/jdk.xml
+++ b/nbbuild/jdk.xml
@@ -217,6 +217,16 @@
         <!-- Will be bogus on Mac OS X, but doesn't matter - Classes/classes.jar should have this anyway -->
         <property name="tools.jar" location="${nbjdk.home}/lib/tools.jar"/>
         <!--<echo level="info">Using JDK: ${nbjdk.home}</echo>-->
+        <condition property=".exe" value=".exe">
+            <os family="windows"/> <!-- #72467 -->
+        </condition>
+        <property name=".exe" value=""/>
+        <condition property="test.nbjdk.java" value="${test.nbjdk.home}/bin/java${.exe}" else="${nbjdk.home}/bin/java3{.exe}">
+            <and>
+                <isset property="test.nbjdk.home" />
+                <available file="${test.nbjdk.home}/bin/java${.exe}" type="file"/>
+            </and>
+        </condition>
     </target>
     
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/8ae80dcd/nbbuild/templates/common.xml
----------------------------------------------------------------------
diff --git a/nbbuild/templates/common.xml b/nbbuild/templates/common.xml
index 6265067..2872ddb 100644
--- a/nbbuild/templates/common.xml
+++ b/nbbuild/templates/common.xml
@@ -709,7 +709,7 @@
             <attribute name="test.type"/>
             <attribute name="disable.apple.ui" default="false"/>
             <sequential>
-                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}">
+                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}" jvm="${test.nbjdk.java}">
                     <batchtest todir="${build.test.@{test.type}.results.dir}">
                         <fileset dir="${build.test.@{test.type}.classes.dir}" includes="${test.includes}" excludes="${test.excludes}"/>
                     </batchtest>
@@ -739,7 +739,8 @@
                         outputdir="${build.test.@{test.type}.results.dir}"
                         workingDir="${build.test.@{test.type}.results.dir}"
                         suitename="${code.name.base}"
-			listener="org.testng.reporters.VerboseReporter"
+                        listener="org.testng.reporters.VerboseReporter"
+                        jvm="${test.nbjdk.java}"
                 >
                     <classfileset dir="${build.test.@{test.type}.classes.dir}" excludes="${test.excludes}" includes="${test.includes}"/>
                     <propertyset refid="test.@{test.type}.properties"/>
@@ -808,7 +809,7 @@
         <macrodef name="junit-impl">
             <attribute name="test.type"/>
             <sequential>
-                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}">
+                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}" jvm="${test.nbjdk.java}">
                     <batchtest todir="${build.test.@{test.type}.results.dir}">
                         <fileset dir="${test.@{test.type}.src.dir}" includes="${test.includes}"/>
                     </batchtest>
@@ -839,7 +840,8 @@
                          outputdir="${build.test.@{test.type}.results.dir}"
                          workingDir="${build.test.@{test.type}.results.dir}"
                          suitename="${code.name.base}"
-			 listener="org.testng.reporters.VerboseReporter"
+                         listener="org.testng.reporters.VerboseReporter"
+                         jvm="${test.nbjdk.java}"
                 >
                     <propertyset refid="test.@{test.type}.properties"/>
                     <classpath refid="test.@{test.type}.run.cp"/>
@@ -866,7 +868,8 @@
                          outputdir="${build.test.@{test.type}.results.dir}"
                          workingDir="${build.test.@{test.type}.results.dir}"
                          suitename="${code.name.base}"
-			 listener="org.testng.reporters.VerboseReporter"
+                         listener="org.testng.reporters.VerboseReporter"
+                         jvm="${test.nbjdk.java}"
                 >
                     <propertyset refid="test.@{test.type}.properties"/>
                     <classpath refid="test.@{test.type}.run.cp"/>
@@ -912,7 +915,7 @@
                 <condition property="test.methods.line" value="methods=${test.methods}" else="">
                     <isset property="test.methods"/>
                 </condition>
-                <java fork="true" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner">
+                <java fork="true" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" jvm="${test.nbjdk.java}">
                     <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
                     <jvmarg line="${test.run.args}"/>
                     <classpath>
@@ -946,7 +949,7 @@
                 <!-- TestNG is running in forkMode="once"                  -->
                 <!-- therefore results while debugging single class/method -->
                 <!-- can be different from running all tests at once       -->
-                <java classname="org.testng.TestNG" fork="true">
+                <java classname="org.testng.TestNG" fork="true" jvm="${test.nbjdk.java}">
                     <jvmarg value="-agentlib:jdwp=transport=dt_socket,address=${jpda.address}"/>
                     <jvmarg line="${test.run.args}"/>
                     <jvmarg value="${test.bootclasspath.prepend.args}"/>
@@ -988,7 +991,8 @@
                          outputdir="${build.test.@{test.type}.results.dir}"
                          workingDir="${build.test.@{test.type}.results.dir}"
                          suitename="${code.name.base}"
-			 listener="org.testng.reporters.VerboseReporter"
+                         listener="org.testng.reporters.VerboseReporter"
+                         jvm="${test.nbjdk.java}"
                 >
                     <propertyset refid="test.@{test.type}.properties"/>
                     <classpath refid="test.@{test.type}.run.cp"/>
@@ -1050,7 +1054,7 @@
         <macrodef name="junit-impl">
             <attribute name="test.type"/>
             <sequential>
-                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}">
+                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" timeout="${test.timeout}" jvm="${test.nbjdk.java}">
                     <test name="${test.class}" methods="${test.methods}" todir="${build.test.@{test.type}.results.dir}"/>
                     <classpath refid="test.@{test.type}.run.cp"/>
                     <syspropertyset refid="test.@{test.type}.properties"/>
@@ -1077,7 +1081,8 @@
                         outputdir="${build.test.@{test.type}.results.dir}"
                         workingDir="${build.test.@{test.type}.results.dir}"
                         suitename="${code.name.base}"
-			listener="org.testng.reporters.VerboseReporter"
+                        listener="org.testng.reporters.VerboseReporter"
+                        jvm="${test.nbjdk.java}"
                 >
                     <propertyset refid="test.@{test.type}.properties"/>
                     <classpath refid="test.@{test.type}.run.cp"/>
@@ -1197,7 +1202,7 @@
                 >
                     <classpath refid="test.@{test.type}.run.cp"/>
                 </nbprofiledirect>
-                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}">
+                <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.@{test.type}.results.dir}" jvm="${test.nbjdk.java}">
                     <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
                     <jvmarg value="${profiler.info.jvmargs.agent}"/>
                     <jvmarg line="${profiler.info.jvmargs}"/>

http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/8ae80dcd/nbbuild/templates/projectized.xml
----------------------------------------------------------------------
diff --git a/nbbuild/templates/projectized.xml b/nbbuild/templates/projectized.xml
index 1d8885f..08d1f17 100644
--- a/nbbuild/templates/projectized.xml
+++ b/nbbuild/templates/projectized.xml
@@ -172,34 +172,38 @@ If you are sure you want to build with JDK 9+ anyway, use: -Dpermit.jdk9.builds=
         <property name="locmakenbm.brands" value="${brandings}"/>
         <!-- When requires.nb.javac property is true, prepend javac-api and javac-impl on bootclasspath to allow override the default annotation
              processing API located in rt.jar. -->
-        <property name="bootclasspath.prepend.vanilla" value="${nb_all}/nbbuild/external/vanilla-javac-api.jar:${nb_all}/nbbuild/external/vanilla-javac-impl.jar" />
         <property name="bootclasspath.prepend.nb" value="${nb_all}/nbbuild/external/vanilla-javac-api.jar:${nb_all}/nbbuild/external/nb-javac-impl.jar" />
+        <property name="bootclasspath.prepend.vanilla" value="${nb_all}/nbbuild/external/vanilla-javac-api.jar:${nb_all}/nbbuild/external/vanilla-javac-impl.jar" />
         <condition property="bootclasspath.prepend" value="${bootclasspath.prepend.nb}">
             <istrue value="${requires.nb.javac.impl}"/>
         </condition>
         <condition property="bootclasspath.prepend" value="${bootclasspath.prepend.vanilla}">
             <istrue value="${requires.nb.javac}"/>
         </condition>
-        <condition property="run.bootclasspath.prepend" value="${bootclasspath.prepend.vanilla}">
-            <and>
-                <istrue value="${requires.nb.javac}"/>
-                <istrue value="${test.use.vanilla.javac}"/>
-            </and>
-        </condition>
         <condition property="run.bootclasspath.prepend" value="${bootclasspath.prepend.nb}">
-            <istrue value="${requires.nb.javac}"/>
+            <istrue value="${requires.nb.javac.impl}"/>
         </condition>
         <condition property="run.bootclasspath.prepend" value="${bootclasspath.prepend.nb}">
-            <istrue value="${requires.nb.javac.impl}"/>
+            <and>
+                <istrue value="${requires.nb.javac}"/>
+                <not>
+                    <istrue value="${test.use.jdk.javac}"/>
+                </not>
+            </and>
         </condition>
         <condition property="run.bootclasspath.prepend" value="${bootclasspath.prepend}">
-            <isset property="bootclasspath.prepend"/>
+            <and>
+                <isset property="bootclasspath.prepend"/>
+                <not>
+                    <istrue value="${test.use.jdk.javac}"/>
+                </not>
+            </and>
         </condition>
         <condition property="test.extra.nb.javac.deps" value="${java.source.nbjavac.dir}/modules/org-netbeans-modules-java-source-nbjavac.jar">
             <and>
                 <istrue value="${requires.nb.javac}"/>
                 <not>
-                    <istrue value="${test.use.vanilla.javac}"/>
+                    <istrue value="${test.use.jdk.javac}"/>
                 </not>
             </and>
         </condition>