some people add directory to module classpath by making it a library instead of a source root, let the module scope accept that (http://devnet.jetbrains.net/message/5291160#5291160)

This commit is contained in:
peter
2011-03-02 16:47:45 +01:00
parent d426fa86df
commit ff95f310af
2 changed files with 15 additions and 1 deletions
@@ -201,4 +201,15 @@ public class ModuleScopesTest extends ModuleTestCase {
return libraryRoot;
}
public void testLibUnderModuleContent() throws IOException {
VirtualFile lib = myFixture.findOrCreateDir("lib");
ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
model.addContentEntry(lib);
model.commit();
VirtualFile file = lib.createChildData(this, "a.txt");
addLibrary(myModule, DependencyScope.COMPILE);
assertTrue(myModule.getModuleWithDependenciesAndLibrariesScope(false).contains(file));
}
}
@@ -118,7 +118,10 @@ public class ModuleWithDependenciesScope extends GlobalSearchScope {
@Override
public boolean contains(VirtualFile file) {
return myRoots.contains(getFileRoot(file));
if (myProjectFileIndex.isInContent(file) && myRoots.contains(myProjectFileIndex.getSourceRootForFile(file))) {
return true;
}
return myRoots.contains(myProjectFileIndex.getClassRootForFile(file));
}
@Override