Search in sources :

Example 1 with ExcludeEntryDescription

use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.

the class ExcludeFromStubGenerationAction method doExcludeFromStubGeneration.

public static void doExcludeFromStubGeneration(PsiFile file) {
    final VirtualFile virtualFile = file.getVirtualFile();
    assert virtualFile != null;
    final Project project = file.getProject();
    final GroovyCompilerConfigurable configurable = new GroovyCompilerConfigurable(project);
    ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> configurable.getExcludes().addEntry(new ExcludeEntryDescription(virtualFile, false, true, project)));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ExcludeEntryDescription(com.intellij.openapi.compiler.options.ExcludeEntryDescription)

Example 2 with ExcludeEntryDescription

use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.

the class ResourceCopyingTest method testCopingNonMavenResources.

public void testCopingNonMavenResources() throws Exception {
    if (ignore())
        return;
    createProjectSubFile("src/resources/a.txt", "a");
    VirtualFile configDir = createProjectSubDir("src/config");
    createProjectSubFile("src/config/b.txt", "b");
    createProjectSubFile("src/config/JavaClass.java", "class JavaClass {}");
    // *.xxx is excluded from resource coping, see setUpInWriteAction()
    createProjectSubFile("src/config/xxx.xxx", "xxx");
    final VirtualFile excludedDir = createProjectSubDir("src/excluded");
    createProjectSubFile("src/excluded/c.txt", "c");
    importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>");
    Module module = ModuleManager.getInstance(myProject).findModuleByName("project");
    PsiTestUtil.addSourceRoot(module, configDir);
    PsiTestUtil.addSourceRoot(module, excludedDir);
    new WriteCommandAction.Simple(myProject) {

        @Override
        protected void run() throws Throwable {
            CompilerConfiguration.getInstance(myProject).getExcludedEntriesConfiguration().addExcludeEntryDescription(new ExcludeEntryDescription(excludedDir, true, false, getTestRootDisposable()));
            setModulesOutput(myProjectRoot.createChildDirectory(this, "output"), "project", "m1", "m2");
        }
    }.execute().throwException();
    compileModules("project");
    assertCopied("output/a.txt");
    assertCopied("output/b.txt");
    assertNotCopied("output/JavaClass.java");
    assertNotCopied("output/xxx.xxx");
    assertNotCopied("output/c.txt");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExcludeEntryDescription(com.intellij.openapi.compiler.options.ExcludeEntryDescription) Module(com.intellij.openapi.module.Module)

Example 3 with ExcludeEntryDescription

use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.

the class ExcludeFromValidationAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    final Pair<ExcludesConfiguration, VirtualFile> pair = getExcludedConfigurationAndFile(e, project);
    if (pair == null)
        return;
    final ExcludeEntryDescription description = new ExcludeEntryDescription(pair.getSecond(), false, true, project);
    pair.getFirst().addExcludeEntryDescription(description);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) ExcludesConfiguration(com.intellij.openapi.compiler.options.ExcludesConfiguration) ExcludeEntryDescription(com.intellij.openapi.compiler.options.ExcludeEntryDescription)

Example 4 with ExcludeEntryDescription

use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.

the class CompilerReferencesFindUsagesTest method testFindUsagesWithExcludedFromCompilationDirectory.

public void testFindUsagesWithExcludedFromCompilationDirectory() {
    doTestRunnableFindUsagesWithExcludesConfiguration(configuration -> {
        final VirtualFile dirToExclude = findClass("A").getContainingFile().getVirtualFile().getParent();
        configuration.addExcludeEntryDescription(new ExcludeEntryDescription(dirToExclude, false, false, myProject));
    }, 3, "Foo.java", "excluded/A.java", "excluded/child/ShouldFindHere.java");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExcludeEntryDescription(com.intellij.openapi.compiler.options.ExcludeEntryDescription)

Example 5 with ExcludeEntryDescription

use of com.intellij.openapi.compiler.options.ExcludeEntryDescription in project intellij-community by JetBrains.

the class CompilerReferencesFindUsagesTest method testFindUsagesWithRecursivelyExcludedFromCompilationDirectory.

public void testFindUsagesWithRecursivelyExcludedFromCompilationDirectory() {
    doTestRunnableFindUsagesWithExcludesConfiguration(configuration -> {
        final VirtualFile dirToExclude = findClass("ShouldFindHere").getContainingFile().getVirtualFile().getParent().getParent();
        configuration.addExcludeEntryDescription(new ExcludeEntryDescription(dirToExclude, true, false, myProject));
    }, 2, "Foo.java", "excluded/child/ShouldFindHere.java");
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ExcludeEntryDescription(com.intellij.openapi.compiler.options.ExcludeEntryDescription)

Aggregations

ExcludeEntryDescription (com.intellij.openapi.compiler.options.ExcludeEntryDescription)17 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 ExcludesConfiguration (com.intellij.openapi.compiler.options.ExcludesConfiguration)6 Project (com.intellij.openapi.project.Project)6 CompilerConfigurationImpl (com.intellij.compiler.CompilerConfigurationImpl)2 Module (com.intellij.openapi.module.Module)2 HashSet (com.intellij.util.containers.hash.HashSet)2 NotNull (org.jetbrains.annotations.NotNull)2 CompilerConfiguration (com.intellij.compiler.CompilerConfiguration)1 ExcludedEntriesConfiguration (com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration)1 ExcludedEntriesListener (com.intellij.openapi.compiler.options.ExcludedEntriesListener)1 FileType (com.intellij.openapi.fileTypes.FileType)1 ProjectFileIndex (com.intellij.openapi.roots.ProjectFileIndex)1 VfsUtilCore (com.intellij.openapi.vfs.VfsUtilCore)1 ManagingFS (com.intellij.openapi.vfs.newvfs.ManagingFS)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 Collection (java.util.Collection)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1