don't set dependency scope to 'test' for newly added groovy library

This commit is contained in:
nik
2012-11-12 11:20:08 +04:00
parent bd244bac62
commit 7da1b1104b
2 changed files with 9 additions and 3 deletions
@@ -17,8 +17,10 @@ package com.intellij.execution.junit;
import com.intellij.openapi.roots.DependencyScope;
import com.intellij.openapi.roots.LibraryDependencyScopeSuggester;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,8 +31,9 @@ public class JUnitDependencyScopeSuggester extends LibraryDependencyScopeSuggest
@Nullable
@Override
public DependencyScope getDefaultDependencyScope(@NotNull Library library) {
if (LibraryUtil.isClassAvailableInLibrary(library, "junit.framework.TestCase")
|| LibraryUtil.isClassAvailableInLibrary(library, "org.junit.Test")) {
VirtualFile[] files = library.getFiles(OrderRootType.CLASSES);
if (files.length == 1 && (LibraryUtil.isClassAvailableInLibrary(files, "junit.framework.TestCase")
|| LibraryUtil.isClassAvailableInLibrary(library, "org.junit.Test"))) {
return DependencyScope.TEST;
}
return null;
@@ -17,8 +17,10 @@ package com.theoryinpractice.testng.configuration;
import com.intellij.openapi.roots.DependencyScope;
import com.intellij.openapi.roots.LibraryDependencyScopeSuggester;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +31,8 @@ public class TestNGDependencyScopeSuggester extends LibraryDependencyScopeSugges
@Nullable
@Override
public DependencyScope getDefaultDependencyScope(@NotNull Library library) {
if (LibraryUtil.isClassAvailableInLibrary(library, "org.testng.annotations.Test")) {
VirtualFile[] files = library.getFiles(OrderRootType.CLASSES);
if (files.length == 1 && LibraryUtil.isClassAvailableInLibrary(files, "org.testng.annotations.Test")) {
return DependencyScope.TEST;
}
return null;