mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -23,13 +23,10 @@ import org.jboss.netty.handler.codec.http.QueryStringDecoder;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class HttpRequestHandler {
|
||||
public boolean isSupported(HttpMethod method) {
|
||||
return method == HttpMethod.GET;
|
||||
public boolean isSupported(HttpRequest request) {
|
||||
return request.getMethod() == HttpMethod.GET;
|
||||
}
|
||||
|
||||
public abstract boolean process(QueryStringDecoder urlDecoder, HttpRequest request, ChannelHandlerContext context)
|
||||
throws IOException;
|
||||
|
||||
public void serverStopping() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package org.jetbrains.ide;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class WebServerManager {
|
||||
// Your handler will be instantiated on first user request
|
||||
@@ -29,4 +31,7 @@ public abstract class WebServerManager {
|
||||
public abstract int getPort();
|
||||
|
||||
public abstract WebServerManager waitForStart();
|
||||
|
||||
@Nullable
|
||||
public abstract Disposable getServerDisposable();
|
||||
}
|
||||
@@ -79,8 +79,8 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
|
||||
static final class XmlRpcRequestHandler extends HttpRequestHandler {
|
||||
@Override
|
||||
public boolean isSupported(HttpMethod method) {
|
||||
return method == HttpMethod.POST || method == HttpMethod.OPTIONS;
|
||||
public boolean isSupported(HttpRequest request) {
|
||||
return request.getMethod() == HttpMethod.POST || request.getMethod() == HttpMethod.OPTIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,7 +103,7 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
}
|
||||
|
||||
private boolean process(QueryStringDecoder urlDecoder, HttpRequest request, ChannelHandlerContext context) throws IOException {
|
||||
if (!(urlDecoder.getPath().isEmpty() || urlDecoder.getPath().equals("/") || urlDecoder.getPath().equalsIgnoreCase("/RPC2"))) {
|
||||
if (!isXmlRpcRequest(urlDecoder.getPath())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -138,6 +138,10 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isXmlRpcRequest(String path) {
|
||||
return path.isEmpty() || (path.length() == 1 && path.charAt(0) == '/') || path.equalsIgnoreCase("/RPC2");
|
||||
}
|
||||
|
||||
private static class XmlRpcHandlerMappingImpl implements XmlRpcHandlerMapping {
|
||||
protected final THashMap<String, Object> handlers = new THashMap<String, Object>();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import org.jboss.netty.channel.ChannelException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -21,7 +22,7 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
class WebServerManagerImpl extends WebServerManager implements Disposable {
|
||||
class WebServerManagerImpl extends WebServerManager {
|
||||
private static final Logger LOG = Logger.getInstance(WebServerManager.class);
|
||||
|
||||
@NonNls
|
||||
@@ -102,6 +103,7 @@ class WebServerManagerImpl extends WebServerManager implements Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
Disposer.register(ApplicationManager.getApplication(), server);
|
||||
detectedPortNumber = server.start(getDefaultPort(), PORTS_COUNT, true);
|
||||
if (detectedPortNumber == -1) {
|
||||
LOG.info("web server cannot be started, cannot bind to port");
|
||||
@@ -114,10 +116,8 @@ class WebServerManagerImpl extends WebServerManager implements Disposable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (started.get() && server != null) {
|
||||
server.stop();
|
||||
LOG.info("web server stopped");
|
||||
}
|
||||
@Nullable
|
||||
public Disposable getServerDisposable() {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.io;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -46,7 +47,7 @@ import static org.jboss.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;
|
||||
import static org.jboss.netty.handler.codec.http.HttpResponseStatus.OK;
|
||||
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1;
|
||||
|
||||
public class WebServer {
|
||||
public class WebServer implements Disposable {
|
||||
private static final String START_TIME_PATH = "/startTime";
|
||||
|
||||
private final ChannelGroup openChannels = new DefaultChannelGroup("web-server");
|
||||
@@ -247,25 +248,15 @@ public class WebServer {
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
try {
|
||||
for (HttpRequestHandler handler : WebServerManager.EP_NAME.getExtensions()) {
|
||||
try {
|
||||
handler.serverStopping();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
openChannels.close().awaitUninterruptibly();
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
openChannels.close().awaitUninterruptibly();
|
||||
}
|
||||
finally {
|
||||
channelFactory.releaseExternalResources();
|
||||
}
|
||||
channelFactory.releaseExternalResources();
|
||||
}
|
||||
LOG.info("web server stopped");
|
||||
}
|
||||
|
||||
public static void replaceDefaultHandler(@NotNull ChannelHandlerContext context, @NotNull SimpleChannelUpstreamHandler messageChannelHandler) {
|
||||
@@ -321,7 +312,7 @@ public class WebServer {
|
||||
if (connectedHandler == null) {
|
||||
for (HttpRequestHandler handler : WebServerManager.EP_NAME.getExtensions()) {
|
||||
try {
|
||||
if (handler.isSupported(request.getMethod()) && handler.process(urlDecoder, request, context)) {
|
||||
if (handler.isSupported(request) && handler.process(urlDecoder, request, context)) {
|
||||
if (context.getAttachment() == null) {
|
||||
context.setAttachment(handler);
|
||||
}
|
||||
@@ -333,7 +324,7 @@ public class WebServer {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (connectedHandler.isSupported(request.getMethod())) {
|
||||
else if (connectedHandler.isSupported(request)) {
|
||||
connectedHandler.process(urlDecoder, request, context);
|
||||
return;
|
||||
}
|
||||
|
||||
+25
-33
@@ -106,47 +106,39 @@ public class MavenDefaultModifiableModelsProvider extends MavenBaseModifiableMod
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
((ProjectRootManagerEx)ProjectRootManager.getInstance(myProject)).mergeRootsChangesDuring(new Runnable() {
|
||||
public void run() {
|
||||
((ProjectRootManagerEx)ProjectRootManager.getInstance(myProject)).mergeRootsChangesDuring(new Runnable() {
|
||||
public void run() {
|
||||
processExternalArtifactDependencies();
|
||||
for (Library.ModifiableModel each : myLibraryModels.values()) {
|
||||
each.commit();
|
||||
}
|
||||
myLibrariesModel.commit();
|
||||
Collection<ModifiableRootModel> rootModels = myRootModels.values();
|
||||
processExternalArtifactDependencies();
|
||||
for (Library.ModifiableModel each : myLibraryModels.values()) {
|
||||
each.commit();
|
||||
}
|
||||
myLibrariesModel.commit();
|
||||
Collection<ModifiableRootModel> rootModels = myRootModels.values();
|
||||
|
||||
ModifiableRootModel[] rootModels1 = rootModels.toArray(new ModifiableRootModel[rootModels.size()]);
|
||||
for (ModifiableRootModel model : rootModels1) {
|
||||
assert !model.isDisposed() : "Already disposed: " + model;
|
||||
}
|
||||
ModifiableModelCommitter.multiCommit(rootModels1, myModuleModel);
|
||||
ModifiableRootModel[] rootModels1 = rootModels.toArray(new ModifiableRootModel[rootModels.size()]);
|
||||
for (ModifiableRootModel model : rootModels1) {
|
||||
assert !model.isDisposed() : "Already disposed: " + model;
|
||||
}
|
||||
ModifiableModelCommitter.multiCommit(rootModels1, myModuleModel);
|
||||
|
||||
for (ModifiableFacetModel each : myFacetModels.values()) {
|
||||
each.commit();
|
||||
}
|
||||
if (myArtifactModel != null) {
|
||||
myArtifactModel.commit();
|
||||
}
|
||||
}
|
||||
});
|
||||
for (ModifiableFacetModel each : myFacetModels.values()) {
|
||||
each.commit();
|
||||
}
|
||||
if (myArtifactModel != null) {
|
||||
myArtifactModel.commit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
public void run() {
|
||||
for (ModifiableRootModel each : myRootModels.values()) {
|
||||
each.dispose();
|
||||
}
|
||||
myModuleModel.dispose();
|
||||
if (myArtifactModel != null) {
|
||||
myArtifactModel.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
for (ModifiableRootModel each : myRootModels.values()) {
|
||||
each.dispose();
|
||||
}
|
||||
myModuleModel.dispose();
|
||||
if (myArtifactModel != null) {
|
||||
myArtifactModel.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public ModalityState getModalityStateForQuestionDialogs() {
|
||||
|
||||
-159
@@ -48,13 +48,7 @@ import java.util.Map;
|
||||
|
||||
public class MavenModuleImporter {
|
||||
|
||||
public static final String PROFILE_PREFIX = "Annotation profile for ";
|
||||
|
||||
public static final String MAVEN_DEFAULT_ANNOTATION_PROFILE = "Maven default annotation processors profile";
|
||||
|
||||
public static final String SUREFIRE_PLUGIN_LIBRARY_NAME = "maven-surefire-plugin urls";
|
||||
public static final String DEFAULT_ANNOTATION_PATH_OUTPUT = "target/generated-sources/annotations";
|
||||
public static final String DEFAULT_TEST_ANNOTATION_OUTPUT = "target/generated-test-sources/test-annotations";
|
||||
|
||||
private final Module myModule;
|
||||
private final MavenProjectsTree myMavenTree;
|
||||
@@ -94,26 +88,6 @@ public class MavenModuleImporter {
|
||||
configFolders();
|
||||
configDependencies();
|
||||
configLanguageLevel();
|
||||
configAnnotationProcessors();
|
||||
excludeFromCompilationArchetypeResources();
|
||||
}
|
||||
|
||||
private void excludeFromCompilationArchetypeResources() {
|
||||
VirtualFile directoryFile = myMavenProject.getDirectoryFile();
|
||||
|
||||
VirtualFile archetypeResourcesDir = VfsUtil.findRelativeFile(directoryFile, "src", "main", "resources", "archetype-resources");
|
||||
|
||||
if (archetypeResourcesDir != null) {
|
||||
Project project = myModule.getProject();
|
||||
|
||||
CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
|
||||
|
||||
if (!compilerConfiguration.isExcludedFromCompilation(archetypeResourcesDir)) {
|
||||
ExcludedEntriesConfiguration cfg = compilerConfiguration.getExcludedEntriesConfiguration();
|
||||
|
||||
cfg.addExcludeEntryDescription(new ExcludeEntryDescription(archetypeResourcesDir, true, false, project));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void preConfigFacets() {
|
||||
@@ -267,139 +241,6 @@ public class MavenModuleImporter {
|
||||
}
|
||||
}
|
||||
|
||||
private void configAnnotationProcessors() {
|
||||
if (Boolean.parseBoolean(System.getProperty("idea.maven.keep.annotation.processors"))) return;
|
||||
|
||||
Sdk sdk = ModuleRootManager.getInstance(myModule).getSdk();
|
||||
if (sdk != null) {
|
||||
String versionString = sdk.getVersionString();
|
||||
if (versionString != null) {
|
||||
if (versionString.contains("1.5") || versionString.contains("1.4") || versionString.contains("1.3") || versionString.contains("1.2")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(
|
||||
myModule.getProject());
|
||||
|
||||
ProcessorConfigProfile currentProfile = compilerConfiguration.getAnnotationProcessingConfiguration(myModule);
|
||||
|
||||
String moduleProfileName = PROFILE_PREFIX + myModule.getName();
|
||||
|
||||
if (currentProfile != compilerConfiguration.getDefaultProcessorProfile()
|
||||
&& !MAVEN_DEFAULT_ANNOTATION_PROFILE.equals(currentProfile.getName())
|
||||
&& !moduleProfileName.equals(currentProfile.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorConfigProfile moduleProfile = compilerConfiguration.findModuleProcessorProfile(moduleProfileName);
|
||||
|
||||
ProcessorConfigProfile defaultMavenProfile = compilerConfiguration.findModuleProcessorProfile(MAVEN_DEFAULT_ANNOTATION_PROFILE);
|
||||
|
||||
if (shouldEnableAnnotationProcessors()) {
|
||||
String annotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(false);
|
||||
if (annotationProcessorDirectory == null) {
|
||||
annotationProcessorDirectory = DEFAULT_ANNOTATION_PATH_OUTPUT;
|
||||
}
|
||||
|
||||
String testAnnotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(true);
|
||||
if (testAnnotationProcessorDirectory == null) {
|
||||
testAnnotationProcessorDirectory = DEFAULT_TEST_ANNOTATION_OUTPUT;
|
||||
}
|
||||
|
||||
Map<String, String> options = myMavenProject.getAnnotationProcessorOptions();
|
||||
|
||||
List<String> processors = myMavenProject.getDeclaredAnnotationProcessors();
|
||||
|
||||
if (processors == null
|
||||
&& options.isEmpty()
|
||||
&& DEFAULT_ANNOTATION_PATH_OUTPUT.equals(annotationProcessorDirectory.replace('\\', '/'))
|
||||
&& DEFAULT_TEST_ANNOTATION_OUTPUT.equals(testAnnotationProcessorDirectory.replace('\\', '/'))) {
|
||||
if (moduleProfile != null) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
|
||||
if (defaultMavenProfile == null) {
|
||||
defaultMavenProfile = new ProcessorConfigProfileImpl(MAVEN_DEFAULT_ANNOTATION_PROFILE);
|
||||
defaultMavenProfile.setEnabled(true);
|
||||
defaultMavenProfile.setOutputRelativeToContentRoot(true);
|
||||
defaultMavenProfile.setObtainProcessorsFromClasspath(true);
|
||||
defaultMavenProfile.setGeneratedSourcesDirectoryName(DEFAULT_ANNOTATION_PATH_OUTPUT, false);
|
||||
defaultMavenProfile.setGeneratedSourcesDirectoryName(DEFAULT_TEST_ANNOTATION_OUTPUT, true);
|
||||
compilerConfiguration.addModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
|
||||
defaultMavenProfile.addModuleName(myModule.getName());
|
||||
}
|
||||
else {
|
||||
if (defaultMavenProfile != null) {
|
||||
defaultMavenProfile.removeModuleName(myModule.getName());
|
||||
|
||||
if (defaultMavenProfile.getModuleNames().isEmpty()) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleProfile == null) {
|
||||
moduleProfile = new ProcessorConfigProfileImpl(moduleProfileName);
|
||||
moduleProfile.setOutputRelativeToContentRoot(true);
|
||||
moduleProfile.setEnabled(true);
|
||||
moduleProfile.setObtainProcessorsFromClasspath(true);
|
||||
moduleProfile.addModuleName(myModule.getName());
|
||||
compilerConfiguration.addModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
|
||||
moduleProfile.setGeneratedSourcesDirectoryName(annotationProcessorDirectory, false);
|
||||
moduleProfile.setGeneratedSourcesDirectoryName(testAnnotationProcessorDirectory, true);
|
||||
|
||||
moduleProfile.clearProcessorOptions();
|
||||
for (Map.Entry<String, String> entry : options.entrySet()) {
|
||||
moduleProfile.setOption(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
moduleProfile.clearProcessors();
|
||||
|
||||
if (processors != null) {
|
||||
for (String processor : processors) {
|
||||
moduleProfile.addProcessor(processor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (defaultMavenProfile != null) {
|
||||
defaultMavenProfile.removeModuleName(myModule.getName());
|
||||
|
||||
if (defaultMavenProfile.getModuleNames().isEmpty()) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleProfile != null) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getRelativeAnnotationProcessorDirectory(boolean isTest) {
|
||||
String annotationProcessorDirectory = myMavenProject.getAnnotationProcessorDirectory(isTest);
|
||||
File annotationProcessorDirectoryFile = new File(annotationProcessorDirectory);
|
||||
if (!annotationProcessorDirectoryFile.isAbsolute()) {
|
||||
return annotationProcessorDirectory;
|
||||
}
|
||||
|
||||
String absoluteProjectDirectory = myMavenProject.getDirectory();
|
||||
return FileUtil.getRelativePath(new File(absoluteProjectDirectory), annotationProcessorDirectoryFile);
|
||||
}
|
||||
|
||||
private boolean shouldEnableAnnotationProcessors() {
|
||||
if ("pom".equals(myMavenProject.getPackaging())) return false;
|
||||
|
||||
return myMavenProject.getProcMode() != MavenProject.ProcMode.NONE || myMavenProject.getPluginConfiguration("org.bsc.maven", "maven-processor-plugin") != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static DependencyScope selectScope(String mavenScope) {
|
||||
if (MavenConstants.SCOPE_RUNTIME.equals(mavenScope)) return DependencyScope.RUNTIME;
|
||||
|
||||
+32
-51
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.importing;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.ModifiableModuleModel;
|
||||
@@ -33,13 +31,13 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.importing.configurers.MavenModuleConfigurer;
|
||||
import org.jetbrains.idea.maven.model.MavenArtifact;
|
||||
import org.jetbrains.idea.maven.project.*;
|
||||
import org.jetbrains.idea.maven.utils.MavenLog;
|
||||
@@ -50,9 +48,6 @@ import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.*;
|
||||
|
||||
public class MavenProjectImporter {
|
||||
@@ -95,20 +90,20 @@ public class MavenProjectImporter {
|
||||
public List<MavenProjectsProcessorTask> importProject() {
|
||||
List<MavenProjectsProcessorTask> postTasks = new ArrayList<MavenProjectsProcessorTask>();
|
||||
|
||||
boolean hasChanges = false;
|
||||
boolean hasChanges;
|
||||
|
||||
// in the case projects are changed during importing we must memorise them
|
||||
myAllProjects = new LinkedHashSet<MavenProject>(myProjectsTree.getProjects());
|
||||
myAllProjects.addAll(myProjectsToImportWithChanges.keySet()); // some projects may already have been removed from the tree
|
||||
|
||||
hasChanges |= deleteIncompatibleModules();
|
||||
hasChanges = deleteIncompatibleModules();
|
||||
myProjectsToImportWithChanges = collectProjectsToImport(myProjectsToImportWithChanges);
|
||||
|
||||
mapMavenProjectsToModulesAndNames();
|
||||
|
||||
if (myProject.isDisposed()) return null;
|
||||
|
||||
boolean projectsHaveChanges = projectsToImportHaveChanges();
|
||||
final boolean projectsHaveChanges = projectsToImportHaveChanges();
|
||||
if (projectsHaveChanges) {
|
||||
hasChanges = true;
|
||||
importModules(postTasks);
|
||||
@@ -128,16 +123,30 @@ public class MavenProjectImporter {
|
||||
removeUnusedProjectLibraries();
|
||||
}
|
||||
|
||||
if (hasChanges) {
|
||||
myModelsProvider.commit();
|
||||
final boolean finalHasChanges = hasChanges;
|
||||
|
||||
if (projectsHaveChanges) {
|
||||
configSettings();
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
public void run() {
|
||||
if (finalHasChanges) {
|
||||
myModelsProvider.commit();
|
||||
|
||||
if (projectsHaveChanges) {
|
||||
removeOutdatedCompilerConfigSettings();
|
||||
|
||||
for (MavenProject mavenProject : myAllProjects) {
|
||||
Module module = myMavenProjectToModule.get(mavenProject);
|
||||
|
||||
for (MavenModuleConfigurer configurer : MavenModuleConfigurer.getConfigurers()) {
|
||||
configurer.configure(mavenProject, myProject, module);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
myModelsProvider.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
myModelsProvider.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
return postTasks;
|
||||
}
|
||||
@@ -381,41 +390,13 @@ public class MavenProjectImporter {
|
||||
myImportingSettings.getDedicatedModuleDir());
|
||||
}
|
||||
|
||||
private void configSettings() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
public void run() {
|
||||
CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
|
||||
private void removeOutdatedCompilerConfigSettings() {
|
||||
ApplicationManager.getApplication().assertWriteAccessAllowed();
|
||||
|
||||
MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(myProject);
|
||||
|
||||
for (MavenProject project : myAllProjects) {
|
||||
String targetLevel = project.getTargetLevel();
|
||||
|
||||
if (targetLevel != null) {
|
||||
Module module = projectsManager.findModule(project);
|
||||
if (module != null) {
|
||||
configuration.setBytecodeTargetLevel(module, targetLevel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Boolean.parseBoolean(System.getProperty("maven.disable.encode.import"))) {
|
||||
String encoding = project.getEncoding();
|
||||
if (encoding != null) {
|
||||
try {
|
||||
EncodingProjectManager.getInstance(myProject).setEncoding(project.getDirectoryFile(), Charset.forName(encoding));
|
||||
}
|
||||
catch (UnsupportedCharsetException ignored) {/**/}
|
||||
catch (IllegalCharsetNameException ignored) {/**/}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final JpsJavaCompilerOptions javacOptions = JavacConfiguration.getOptions(myProject, JavacConfiguration.class);
|
||||
String options = javacOptions.ADDITIONAL_OPTIONS_STRING;
|
||||
options = options.replaceFirst("(-target (\\S+))", ""); // Old IDEAs saved
|
||||
javacOptions.ADDITIONAL_OPTIONS_STRING = options;
|
||||
}
|
||||
});
|
||||
final JpsJavaCompilerOptions javacOptions = JavacConfiguration.getOptions(myProject, JavacConfiguration.class);
|
||||
String options = javacOptions.ADDITIONAL_OPTIONS_STRING;
|
||||
options = options.replaceFirst("(-target (\\S+))", ""); // Old IDEAs saved
|
||||
javacOptions.ADDITIONAL_OPTIONS_STRING = options;
|
||||
}
|
||||
|
||||
private void importModules(final List<MavenProjectsProcessorTask> postTasks) {
|
||||
|
||||
+1
-5
@@ -95,11 +95,7 @@ public class MavenUIModifiableModelsProvider extends MavenBaseModifiableModelsPr
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
MavenUtil.invokeAndWaitWriteAction(myProject, new Runnable() {
|
||||
public void run() {
|
||||
processExternalArtifactDependencies();
|
||||
}
|
||||
});
|
||||
processExternalArtifactDependencies();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.importing.configurers;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
import org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile;
|
||||
import org.jetbrains.jps.model.java.impl.compiler.ProcessorConfigProfileImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class MavenAnnotationProcessorConfigurer extends MavenModuleConfigurer {
|
||||
|
||||
public static final String PROFILE_PREFIX = "Annotation profile for ";
|
||||
public static final String MAVEN_DEFAULT_ANNOTATION_PROFILE = "Maven default annotation processors profile";
|
||||
public static final String DEFAULT_ANNOTATION_PATH_OUTPUT = "target/generated-sources/annotations";
|
||||
public static final String DEFAULT_TEST_ANNOTATION_OUTPUT = "target/generated-test-sources/test-annotations";
|
||||
|
||||
@Override
|
||||
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
|
||||
if (module == null) return;
|
||||
|
||||
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
|
||||
if (sdk != null) {
|
||||
String versionString = sdk.getVersionString();
|
||||
if (versionString != null) {
|
||||
if (versionString.contains("1.5") || versionString.contains("1.4") || versionString.contains("1.3") || versionString.contains("1.2")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
|
||||
|
||||
ProcessorConfigProfile currentProfile = compilerConfiguration.getAnnotationProcessingConfiguration(module);
|
||||
|
||||
String moduleProfileName = PROFILE_PREFIX + module.getName();
|
||||
|
||||
if (currentProfile != compilerConfiguration.getDefaultProcessorProfile()
|
||||
&& !MAVEN_DEFAULT_ANNOTATION_PROFILE.equals(currentProfile.getName())
|
||||
&& !moduleProfileName.equals(currentProfile.getName())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessorConfigProfile moduleProfile = compilerConfiguration.findModuleProcessorProfile(moduleProfileName);
|
||||
|
||||
ProcessorConfigProfile defaultMavenProfile = compilerConfiguration.findModuleProcessorProfile(MAVEN_DEFAULT_ANNOTATION_PROFILE);
|
||||
|
||||
if (shouldEnableAnnotationProcessors(mavenProject)) {
|
||||
String annotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(mavenProject, false);
|
||||
if (annotationProcessorDirectory == null) {
|
||||
annotationProcessorDirectory = DEFAULT_ANNOTATION_PATH_OUTPUT;
|
||||
}
|
||||
|
||||
String testAnnotationProcessorDirectory = getRelativeAnnotationProcessorDirectory(mavenProject, true);
|
||||
if (testAnnotationProcessorDirectory == null) {
|
||||
testAnnotationProcessorDirectory = DEFAULT_TEST_ANNOTATION_OUTPUT;
|
||||
}
|
||||
|
||||
Map<String, String> options = mavenProject.getAnnotationProcessorOptions();
|
||||
|
||||
List<String> processors = mavenProject.getDeclaredAnnotationProcessors();
|
||||
|
||||
if (processors == null
|
||||
&& options.isEmpty()
|
||||
&& DEFAULT_ANNOTATION_PATH_OUTPUT.equals(annotationProcessorDirectory.replace('\\', '/'))
|
||||
&& DEFAULT_TEST_ANNOTATION_OUTPUT.equals(testAnnotationProcessorDirectory.replace('\\', '/'))) {
|
||||
if (moduleProfile != null) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
|
||||
if (defaultMavenProfile == null) {
|
||||
defaultMavenProfile = new ProcessorConfigProfileImpl(MAVEN_DEFAULT_ANNOTATION_PROFILE);
|
||||
defaultMavenProfile.setEnabled(true);
|
||||
defaultMavenProfile.setOutputRelativeToContentRoot(true);
|
||||
defaultMavenProfile.setObtainProcessorsFromClasspath(true);
|
||||
defaultMavenProfile.setGeneratedSourcesDirectoryName(DEFAULT_ANNOTATION_PATH_OUTPUT, false);
|
||||
defaultMavenProfile.setGeneratedSourcesDirectoryName(DEFAULT_TEST_ANNOTATION_OUTPUT, true);
|
||||
compilerConfiguration.addModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
|
||||
defaultMavenProfile.addModuleName(module.getName());
|
||||
}
|
||||
else {
|
||||
if (defaultMavenProfile != null) {
|
||||
defaultMavenProfile.removeModuleName(module.getName());
|
||||
|
||||
if (defaultMavenProfile.getModuleNames().isEmpty()) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleProfile == null) {
|
||||
moduleProfile = new ProcessorConfigProfileImpl(moduleProfileName);
|
||||
moduleProfile.setOutputRelativeToContentRoot(true);
|
||||
moduleProfile.setEnabled(true);
|
||||
moduleProfile.setObtainProcessorsFromClasspath(true);
|
||||
moduleProfile.addModuleName(module.getName());
|
||||
compilerConfiguration.addModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
|
||||
moduleProfile.setGeneratedSourcesDirectoryName(annotationProcessorDirectory, false);
|
||||
moduleProfile.setGeneratedSourcesDirectoryName(testAnnotationProcessorDirectory, true);
|
||||
|
||||
moduleProfile.clearProcessorOptions();
|
||||
for (Map.Entry<String, String> entry : options.entrySet()) {
|
||||
moduleProfile.setOption(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
moduleProfile.clearProcessors();
|
||||
|
||||
if (processors != null) {
|
||||
for (String processor : processors) {
|
||||
moduleProfile.addProcessor(processor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (defaultMavenProfile != null) {
|
||||
defaultMavenProfile.removeModuleName(module.getName());
|
||||
|
||||
if (defaultMavenProfile.getModuleNames().isEmpty()) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(defaultMavenProfile);
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleProfile != null) {
|
||||
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String getRelativeAnnotationProcessorDirectory(MavenProject mavenProject, boolean isTest) {
|
||||
String annotationProcessorDirectory = mavenProject.getAnnotationProcessorDirectory(isTest);
|
||||
File annotationProcessorDirectoryFile = new File(annotationProcessorDirectory);
|
||||
if (!annotationProcessorDirectoryFile.isAbsolute()) {
|
||||
return annotationProcessorDirectory;
|
||||
}
|
||||
|
||||
String absoluteProjectDirectory = mavenProject.getDirectory();
|
||||
return FileUtil.getRelativePath(new File(absoluteProjectDirectory), annotationProcessorDirectoryFile);
|
||||
}
|
||||
|
||||
private static boolean shouldEnableAnnotationProcessors(MavenProject mavenProject) {
|
||||
if ("pom".equals(mavenProject.getPackaging())) return false;
|
||||
|
||||
return mavenProject.getProcMode() != MavenProject.ProcMode.NONE
|
||||
|| mavenProject.getPluginConfiguration("org.bsc.maven", "maven-processor-plugin") != null;
|
||||
}
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.importing.configurers;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
|
||||
import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class MavenCompilerConfigurer extends MavenModuleConfigurer {
|
||||
@Override
|
||||
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
|
||||
if (module == null) return;
|
||||
|
||||
String targetLevel = mavenProject.getTargetLevel();
|
||||
if (targetLevel != null) {
|
||||
CompilerConfigurationImpl configuration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
|
||||
configuration.setBytecodeTargetLevel(module, targetLevel);
|
||||
}
|
||||
|
||||
VirtualFile directoryFile = mavenProject.getDirectoryFile();
|
||||
|
||||
// Exclude src/main/archetype-resources
|
||||
VirtualFile archetypeResourcesDir = VfsUtil.findRelativeFile(directoryFile, "src", "main", "resources", "archetype-resources");
|
||||
|
||||
if (archetypeResourcesDir != null) {
|
||||
CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project);
|
||||
|
||||
if (!compilerConfiguration.isExcludedFromCompilation(archetypeResourcesDir)) {
|
||||
ExcludedEntriesConfiguration cfg = compilerConfiguration.getExcludedEntriesConfiguration();
|
||||
|
||||
cfg.addExcludeEntryDescription(new ExcludeEntryDescription(archetypeResourcesDir, true, false, project));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.importing.configurers;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingProjectManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class MavenEncodingConfigurer extends MavenModuleConfigurer {
|
||||
@Override
|
||||
public void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module) {
|
||||
String encoding = mavenProject.getEncoding();
|
||||
if (encoding != null) {
|
||||
try {
|
||||
EncodingProjectManager.getInstance(project).setEncoding(mavenProject.getDirectoryFile(), Charset.forName(encoding));
|
||||
}
|
||||
catch (UnsupportedCharsetException ignored) {/**/}
|
||||
catch (IllegalCharsetNameException ignored) {/**/}
|
||||
}
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.idea.maven.importing.configurers;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.project.MavenProject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public abstract class MavenModuleConfigurer {
|
||||
|
||||
private static volatile List<MavenModuleConfigurer> ourConfigurersList;
|
||||
|
||||
public abstract void configure(@NotNull MavenProject mavenProject, @NotNull Project project, @Nullable Module module);
|
||||
|
||||
public static List<MavenModuleConfigurer> getConfigurers() {
|
||||
List<MavenModuleConfigurer> configurers = ourConfigurersList;
|
||||
if (configurers == null) {
|
||||
configurers = new ArrayList<MavenModuleConfigurer>();
|
||||
|
||||
for (MavenModuleConfigurer configurer : new MavenModuleConfigurer[]{
|
||||
new MavenCompilerConfigurer(),
|
||||
new MavenEncodingConfigurer(),
|
||||
new MavenAnnotationProcessorConfigurer()}) {
|
||||
|
||||
if (!Boolean.parseBoolean(System.getProperty("idea.maven.disable." + configurer.getClass().getSimpleName()))) {
|
||||
configurers.add(configurer);
|
||||
}
|
||||
}
|
||||
|
||||
ourConfigurersList = configurers;
|
||||
}
|
||||
|
||||
return configurers;
|
||||
}
|
||||
|
||||
}
|
||||
+14
-13
@@ -18,7 +18,8 @@ package org.jetbrains.idea.maven.compiler
|
||||
import com.intellij.compiler.CompilerConfiguration
|
||||
import com.intellij.compiler.CompilerConfigurationImpl
|
||||
import org.jetbrains.idea.maven.MavenImportingTestCase
|
||||
import org.jetbrains.idea.maven.importing.MavenModuleImporter
|
||||
import org.jetbrains.idea.maven.importing.configurers.MavenAnnotationProcessorConfigurer
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
@@ -125,10 +126,10 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE).getModuleNames() == new HashSet<String>(["module1"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module2').getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module3') == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module3_1') == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE).getModuleNames() == new HashSet<String>(["module1"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module2').getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module3') == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + 'module3_1') == null
|
||||
}
|
||||
|
||||
public void testOverrideGeneratedOutputDir() {
|
||||
@@ -152,8 +153,8 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName(false).replace('\\', '/').endsWith("out/generated")
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName(false).replace('\\', '/').endsWith("out/generated")
|
||||
}
|
||||
|
||||
public void testImportAnnotationProcessorOptions() {
|
||||
@@ -180,8 +181,8 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def processorOptions = compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getProcessorOptions()
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def processorOptions = compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + "project").getProcessorOptions()
|
||||
assert new HashMap(processorOptions) == ['opt1': '111', 'opt2': '222', 'opt3': '333']
|
||||
}
|
||||
|
||||
@@ -226,8 +227,8 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def profile = compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project")
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def profile = compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + "project")
|
||||
assert profile.getGeneratedSourcesDirectoryName(false).replace('\\', '/').endsWith("target/metamodel")
|
||||
assert profile.getGeneratedSourcesDirectoryName(true).replace('\\', '/').endsWith("target/metamodelTest")
|
||||
}
|
||||
@@ -284,8 +285,8 @@ class AnnotationProcessorImportingTest extends MavenImportingTestCase {
|
||||
|
||||
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
|
||||
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def profile = compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project")
|
||||
assert compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
|
||||
def profile = compilerConfiguration.findModuleProcessorProfile(MavenAnnotationProcessorConfigurer.PROFILE_PREFIX + "project")
|
||||
assert profile.getGeneratedSourcesDirectoryName(false).replace('\\', '/').endsWith("target/metamodel")
|
||||
assert profile.getGeneratedSourcesDirectoryName(true).replace('\\', '/').endsWith("target/metamodelTest")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user