You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by sk...@apache.org on 2020/04/09 13:04:18 UTC

[netbeans] branch master updated: Use current platform for OpenJDK tests

This is an automated email from the ASF dual-hosted git repository.

skygo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f946e1  Use current platform for OpenJDK tests
     new ea387ce  Merge pull request #2069 from jlahoda/use-current-platform-for-openjdk-tests
6f946e1 is described below

commit 6f946e17ecfe0769a73e389a39bdc4fca06f6f58
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Wed Apr 8 07:58:16 2020 +0200

    Use current platform for OpenJDK tests
---
 .../openjdk/project/ClassPathProviderImpl.java     | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/ClassPathProviderImpl.java b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/ClassPathProviderImpl.java
index 2c6a943..c233277 100644
--- a/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/ClassPathProviderImpl.java
+++ b/java/java.openjdk.project/src/org/netbeans/modules/java/openjdk/project/ClassPathProviderImpl.java
@@ -29,6 +29,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.logging.Level;
@@ -40,6 +41,11 @@ import javax.swing.event.ChangeListener;
 import org.netbeans.api.java.classpath.ClassPath;
 import org.netbeans.api.java.classpath.GlobalPathRegistry;
 import org.netbeans.api.java.classpath.JavaClassPathConstants;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.source.ClasspathInfo;
+import org.netbeans.api.java.source.CompilationController;
+import org.netbeans.api.java.source.JavaSource;
+import org.netbeans.api.java.source.Task;
 import org.netbeans.api.project.libraries.Library;
 import org.netbeans.api.project.libraries.LibraryManager;
 import org.netbeans.modules.java.openjdk.project.JDKProject.Root;
@@ -70,6 +76,7 @@ public class ClassPathProviderImpl implements ClassPathProvider {
         "${outputRoot}/corba/dist/lib/classes.jar",
     };
     
+    private final AtomicBoolean initialScanDone = new AtomicBoolean();
     private final ClassPath bootCP;
     private final ClassPath moduleBootCP;
     private final ClassPath compileCP;
@@ -214,8 +221,12 @@ public class ClassPathProviderImpl implements ClassPathProvider {
         } else {
             if (file.isFolder()) return null;
 
-            if (ClassPath.BOOT.equals(type)) {
-                return ClassPath.EMPTY;
+            if (ClassPath.BOOT.equals(type) || JavaClassPathConstants.MODULE_BOOT_PATH.equals(type)) {
+                if (initialScanDone.get()) {
+                    return ClassPath.EMPTY;
+                } else {
+                    return null;
+                }
             } else if (ClassPath.COMPILE.equals(type) ||
                        JavaClassPathConstants.MODULE_COMPILE_PATH.equals(type) ||
                        JavaClassPathConstants.MODULE_CLASS_PATH.equals(type)) {
@@ -241,6 +252,13 @@ public class ClassPathProviderImpl implements ClassPathProvider {
         if (REGISTER_TESTS_AS_JAVA)
             GlobalPathRegistry.getDefault().register(ClassPath.SOURCE, new ClassPath[] {testsRegCP});
         GlobalPathRegistry.getDefault().register(TEST_SOURCE, new ClassPath[] {testsRegCP});
+        try {
+            JavaSource.create(ClasspathInfo.create(ClassPath.EMPTY, testsCompileCP, ClassPath.EMPTY))
+                      .runWhenScanFinished(cc -> initialScanDone.set(true), true);
+        } catch (IOException ex) {
+            Logger.getLogger(ClassPathProviderImpl.class.getName())
+                  .log(Level.FINE, null, ex);
+        }
     }
     
     public void unregisterClassPaths() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists