Exclude target/work/* expect target/work/plugins
authorSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Fri, 30 Aug 2013 10:06:10 +0000 (14:06 +0400)
committerSergey Evdokimov <sergey.evdokimov@jetbrains.com>
Fri, 30 Aug 2013 10:06:10 +0000 (14:06 +0400)
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcModuleStructureUtil.java
plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/MvcProjectStructure.java

index 7cbd538425e29285cf8563a891a2a2564c46b18e..67d1c3726a5c44158bcf82fb8f9797392c8b48bc 100644 (file)
@@ -25,9 +25,9 @@ import com.intellij.openapi.module.ModifiableModuleModel;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.module.StdModuleTypes;
-import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.impl.ModifiableModelCommitter;
 import com.intellij.openapi.roots.libraries.Library;
 import com.intellij.openapi.roots.libraries.LibraryTable;
 import com.intellij.openapi.roots.libraries.LibraryUtil;
@@ -103,13 +103,11 @@ public class MvcModuleStructureUtil {
       removeSrcFolderFromRoots(root.findFileByRelativePath(src), actions, sourceRoots);
     }
 
-    for (final String excluded : structure.getExcludedFolders()) {
-      final VirtualFile src = root.findFileByRelativePath(excluded);
-
-      if (src != null && moduleRootManager.getFileIndex().isInContent(src)) {
+    for (final VirtualFile excluded : structure.getExcludedFolders(root)) {
+      if (moduleRootManager.getFileIndex().isInContent(excluded)) {
         actions.add(new Consumer<ContentEntry>() {
           public void consume(ContentEntry contentEntry) {
-            contentEntry.addExcludeFolder(src);
+            contentEntry.addExcludeFolder(excluded);
           }
         });
       }
index 2ddcd1ae74edbe6ffcd38c6d380005e9a861bcef..112f82f3b8b4a31ec2d388ae62e27a2416a40959 100644 (file)
@@ -21,7 +21,9 @@ import com.intellij.openapi.vfs.VirtualFile;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * @author peter
@@ -58,8 +60,22 @@ public abstract class MvcProjectStructure {
   public abstract String[] getSourceFolders();
   public abstract String[] getTestFolders();
   public abstract String[] getInvalidSourceFolders();
+
   public abstract String[] getExcludedFolders();
 
+  public List<VirtualFile> getExcludedFolders(@NotNull VirtualFile root) {
+    List<VirtualFile> res = new ArrayList<VirtualFile>();
+
+    for (final String excluded : getExcludedFolders()) {
+      VirtualFile dir = root.findFileByRelativePath(excluded);
+      if (dir != null) {
+        res.add(dir);
+      }
+    }
+
+    return res;
+  }
+
   public void setupFacets(Collection<Runnable> actions, Collection<VirtualFile> roots) {
 
   }