mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't add annotation processor output directory to compiler exclude.
This commit is contained in:
+2
-58
@@ -17,8 +17,6 @@ package org.jetbrains.idea.maven.importing;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
|
||||
import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -38,13 +36,9 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomUtil;
|
||||
import org.jetbrains.idea.maven.dom.MavenPropertyResolver;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
|
||||
import org.jetbrains.idea.maven.model.MavenArtifact;
|
||||
import org.jetbrains.idea.maven.model.MavenConstants;
|
||||
import org.jetbrains.idea.maven.project.*;
|
||||
import org.jetbrains.idea.maven.utils.MavenJDOMUtil;
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil;
|
||||
import org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile;
|
||||
import org.jetbrains.jps.model.java.impl.compiler.ProcessorConfigProfileImpl;
|
||||
@@ -53,8 +47,6 @@ import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -306,22 +298,17 @@ public class MavenModuleImporter {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldAnnotationProcessorDirectory = currentProfile.getGeneratedSourcesDirectoryName(false);
|
||||
String oldTestAnnotationProcessorDirectory = currentProfile.getGeneratedSourcesDirectoryName(true);
|
||||
String annotationProcessorDirectory = null;
|
||||
String testAnnotationProcessorDirectory = null;
|
||||
|
||||
ProcessorConfigProfile moduleProfile = compilerConfiguration.findModuleProcessorProfile(moduleProfileName);
|
||||
|
||||
ProcessorConfigProfile defaultMavenProfile = compilerConfiguration.findModuleProcessorProfile(MAVEN_DEFAULT_ANNOTATION_PROFILE);
|
||||
|
||||
if (shouldEnableAnnotationProcessors()) {
|
||||
annotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(false);
|
||||
String annotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(false);
|
||||
if (annotationProcessorDirectory == null) {
|
||||
annotationProcessorDirectory = DEFAULT_ANNOTATION_PATH_OUTPUT;
|
||||
}
|
||||
|
||||
testAnnotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(true);
|
||||
String testAnnotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(true);
|
||||
if (testAnnotationProcessorDirectory == null) {
|
||||
testAnnotationProcessorDirectory = DEFAULT_TEST_ANNOTATION_OUTPUT;
|
||||
}
|
||||
@@ -398,49 +385,6 @@ public class MavenModuleImporter {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Boolean.parseBoolean(System.getProperty("idea.maven.dont.exclude.annotation.processors.output"))) {
|
||||
if (!oldAnnotationProcessorDirectory.equals(annotationProcessorDirectory) && !oldAnnotationProcessorDirectory.equals(testAnnotationProcessorDirectory)) {
|
||||
removeFromCompilerExclude(oldAnnotationProcessorDirectory);
|
||||
}
|
||||
|
||||
if (!oldTestAnnotationProcessorDirectory.equals(annotationProcessorDirectory) && !oldTestAnnotationProcessorDirectory.equals(testAnnotationProcessorDirectory)) {
|
||||
removeFromCompilerExclude(oldTestAnnotationProcessorDirectory);
|
||||
}
|
||||
|
||||
if (annotationProcessorDirectory != null) {
|
||||
addToCompilerExclude(annotationProcessorDirectory);
|
||||
}
|
||||
if (testAnnotationProcessorDirectory != null) {
|
||||
addToCompilerExclude(testAnnotationProcessorDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addToCompilerExclude(@NotNull String path) {
|
||||
String url = VfsUtil.pathToUrl(myMavenProject.getDirectory() + '/' + path);
|
||||
|
||||
CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myModule.getProject());
|
||||
ExcludedEntriesConfiguration excludedCfg = configuration.getExcludedEntriesConfiguration();
|
||||
|
||||
for (ExcludeEntryDescription description : excludedCfg.getExcludeEntryDescriptions()) {
|
||||
if (url.equals(description.getUrl())) return;
|
||||
}
|
||||
|
||||
excludedCfg.addExcludeEntryDescription(new ExcludeEntryDescription(url, true, false, excludedCfg));
|
||||
}
|
||||
|
||||
private void removeFromCompilerExclude(@NotNull String path) {
|
||||
String url = VfsUtil.pathToUrl(myMavenProject.getDirectory() + '/' + path);
|
||||
|
||||
CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myModule.getProject());
|
||||
ExcludedEntriesConfiguration excludedCfg = configuration.getExcludedEntriesConfiguration();
|
||||
|
||||
for (ExcludeEntryDescription description : excludedCfg.getExcludeEntryDescriptions()) {
|
||||
if (url.equals(description.getUrl())) {
|
||||
excludedCfg.removeExcludeEntryDescription(description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user