Search in sources :

Example 1 with ClassPathEntry

use of com.intellij.rt.coverage.util.classFinder.ClassPathEntry in project intellij-community by JetBrains.

the class IdeaClassFinder method getClassPathEntries.

@Override
protected Collection getClassPathEntries() {
    final Collection entries = super.getClassPathEntries();
    final Module[] modules = ModuleManager.getInstance(myProject).getModules();
    for (Module module : modules) {
        final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
        if (extension != null) {
            final VirtualFile outputFile = extension.getCompilerOutputPath();
            try {
                if (outputFile != null) {
                    final URL outputURL = VfsUtilCore.virtualToIoFile(outputFile).toURI().toURL();
                    entries.add(new ClassPathEntry(outputFile.getPath(), UrlClassLoader.build().urls(outputURL).get()));
                }
                if (myCurrentSuite.isTrackTestFolders()) {
                    final VirtualFile testOutput = extension.getCompilerOutputPathForTests();
                    if (testOutput != null) {
                        final URL testOutputURL = VfsUtilCore.virtualToIoFile(testOutput).toURI().toURL();
                        entries.add(new ClassPathEntry(testOutput.getPath(), UrlClassLoader.build().urls(testOutputURL).get()));
                    }
                }
            } catch (MalformedURLException e1) {
                LOG.error(e1);
            }
        }
    }
    return entries;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) MalformedURLException(java.net.MalformedURLException) Collection(java.util.Collection) Module(com.intellij.openapi.module.Module) CompilerModuleExtension(com.intellij.openapi.roots.CompilerModuleExtension) URL(java.net.URL) ClassPathEntry(com.intellij.rt.coverage.util.classFinder.ClassPathEntry)

Aggregations

Module (com.intellij.openapi.module.Module)1 CompilerModuleExtension (com.intellij.openapi.roots.CompilerModuleExtension)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ClassPathEntry (com.intellij.rt.coverage.util.classFinder.ClassPathEntry)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Collection (java.util.Collection)1