mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DirectoryIndex: don't include roots from content to projectExcludeRoots set, update projectExcludeRoots on VFS change
This commit is contained in:
@@ -412,7 +412,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
checkInfoNull(module2Output);
|
||||
checkInfoNull(module2TestOutput);
|
||||
|
||||
assertTrue(myIndex.isProjectExcludeRoot(excluded));
|
||||
assertFalse(myIndex.isProjectExcludeRoot(excluded));
|
||||
|
||||
excluded.delete(this);
|
||||
projectOutput.delete(this);
|
||||
@@ -430,7 +430,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
};
|
||||
VirtualFileManager.getInstance().addVirtualFileListener(l, getTestRootDisposable());
|
||||
excluded = myModule1Dir.createChildDirectory(this, excluded.getName());
|
||||
//todo assertTrue(myIndex.isProjectExcludeRoot(excluded));
|
||||
assertFalse(myIndex.isProjectExcludeRoot(excluded));
|
||||
projectOutput = myModule1Dir.createChildDirectory(this, projectOutput.getName());
|
||||
module2Output = myModule1Dir.createChildDirectory(this, module2Output.getName());
|
||||
module2TestOutput = myModule2Dir.createChildDirectory(this, module2TestOutput.getName());
|
||||
@@ -442,7 +442,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
|
||||
assertEquals(created.toString(), 4, created.size());
|
||||
|
||||
assertTrue(myIndex.isProjectExcludeRoot(excluded));
|
||||
assertFalse(myIndex.isProjectExcludeRoot(excluded));
|
||||
}
|
||||
|
||||
public void testExcludesShouldBeRecognizedRightOnRefresh() throws Exception {
|
||||
@@ -521,12 +521,24 @@ public class DirectoryIndexTest extends IdeaTestCase {
|
||||
checkInfo(myExcludedLibClsDir, null, true, false, "lib.cls.exc", null, myModule3);
|
||||
}
|
||||
|
||||
|
||||
public void testExcludeCompilerOutputOutsideOfContentRoot() throws Exception {
|
||||
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
|
||||
assertTrue(fileIndex.isIgnored(myOutputDir));
|
||||
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
|
||||
assertFalse(fileIndex.isIgnored(myOutputDir.getParent()));
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
|
||||
assertFalse(myIndex.isProjectExcludeRoot(myModule1OutputDir));
|
||||
String moduleOutputUrl = myModule1OutputDir.getUrl();
|
||||
|
||||
myOutputDir.delete(this);
|
||||
|
||||
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, false);
|
||||
myOutputDir = myRootVFile.createChildDirectory(this, "out");
|
||||
myModule1OutputDir = myOutputDir.createChildDirectory(this, "module1");
|
||||
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
|
||||
assertTrue(myIndex.isProjectExcludeRoot(myModule1OutputDir));
|
||||
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
|
||||
}
|
||||
|
||||
private void checkInfo(VirtualFile dir,
|
||||
|
||||
@@ -226,14 +226,19 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
}
|
||||
}
|
||||
|
||||
if (parentInfo == null) return state;
|
||||
|
||||
Module module = parentInfo.getModule();
|
||||
|
||||
for (DirectoryIndexExcludePolicy policy : myExcludePolicies) {
|
||||
if (policy.isExcludeRoot(file)) return state;
|
||||
if (policy.isExcludeRoot(file)) {
|
||||
if (parentInfo == null || parentInfo.getContentRoot() == null) {
|
||||
if (state == originalState) state = state.copy(null);
|
||||
state.myProjectExcludeRoots.add(file.getId());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
if (parentInfo == null) return state;
|
||||
Module module = parentInfo.getModule();
|
||||
|
||||
if (state == originalState) state = state.copy(null);
|
||||
VirtualFile parentContentRoot = parentInfo.getContentRoot();
|
||||
state.fillMapWithModuleContent(file, module, (NewVirtualFile)parentContentRoot, null);
|
||||
@@ -1471,7 +1476,7 @@ public class DirectoryIndexImpl extends DirectoryIndex {
|
||||
for (VirtualFile excludeRoot : contentEntry.getExcludeFolderFiles()) {
|
||||
// Output paths should be excluded (if marked as such) regardless if they're under corresponding module's content root
|
||||
if (excludeRoot instanceof NewVirtualFile) {
|
||||
if (!FileUtil.startsWith(contentRoot.getUrl(), excludeRoot.getUrl())) {
|
||||
if (!FileUtil.startsWith(excludeRoot.getUrl(), contentRoot.getUrl())) {
|
||||
if (isExcludeRootForModule(module, excludeRoot)) {
|
||||
putForFileAndAllAncestors((NewVirtualFile)excludeRoot, excludeRoot.getUrl());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user