mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CompilerConfiguration — do not save default annotationProcessing (will be enabled by default in IDEA 17+, for now behind the flag)
This commit is contained in:
@@ -171,8 +171,9 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
addChild(newChild, JpsJavaCompilerConfigurationSerializer.ENTRY).setAttribute(JpsJavaCompilerConfigurationSerializer.NAME, pattern);
|
||||
}
|
||||
|
||||
boolean savingStateInNewFormatAllowed = Registry.is("saving.state.in.new.format.is.allowed", false);
|
||||
if ((myWildcardPatternsInitialized || !myWildcardPatterns.isEmpty()) &&
|
||||
(!Registry.is("saving.state.in.new.format.is.allowed", false) || !DEFAULT_WILDCARD_PATTERNS.equals(myWildcardPatterns))) {
|
||||
(!savingStateInNewFormatAllowed || !DEFAULT_WILDCARD_PATTERNS.equals(myWildcardPatterns))) {
|
||||
final Element wildcardPatterns = addChild(state, JpsJavaCompilerConfigurationSerializer.WILDCARD_RESOURCE_PATTERNS);
|
||||
for (final String wildcardPattern : myWildcardPatterns) {
|
||||
addChild(wildcardPatterns, JpsJavaCompilerConfigurationSerializer.ENTRY)
|
||||
@@ -180,12 +181,26 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
}
|
||||
}
|
||||
|
||||
final Element annotationProcessingSettings = addChild(state, JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
|
||||
final Element defaultProfileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "true");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, defaultProfileElem);
|
||||
Element annotationProcessingSettings = new Element(JpsJavaCompilerConfigurationSerializer.ANNOTATION_PROCESSING);
|
||||
|
||||
Element profileElement = new Element("profile");
|
||||
profileElement.setAttribute("default", "true");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(myDefaultProcessorsProfile, profileElement);
|
||||
if (!savingStateInNewFormatAllowed || !JDOMUtil.isEmpty(profileElement, 2)) {
|
||||
annotationProcessingSettings.addContent(profileElement);
|
||||
}
|
||||
|
||||
for (ProcessorConfigProfile profile : myModuleProcessorProfiles) {
|
||||
final Element profileElem = addChild(annotationProcessingSettings, "profile").setAttribute("default", "false");
|
||||
AnnotationProcessorProfileSerializer.writeExternal(profile, profileElem);
|
||||
Element element = new Element("profile");
|
||||
if (!savingStateInNewFormatAllowed) {
|
||||
element.setAttribute("default", "false");
|
||||
}
|
||||
AnnotationProcessorProfileSerializer.writeExternal(profile, element);
|
||||
annotationProcessingSettings.addContent(element);
|
||||
}
|
||||
|
||||
if (!savingStateInNewFormatAllowed || !JDOMUtil.isEmpty(annotationProcessingSettings)) {
|
||||
state.addContent(annotationProcessingSettings);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(myBytecodeTargetLevel) || !myModuleBytecodeTarget.isEmpty()) {
|
||||
|
||||
+17
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -16,8 +16,10 @@
|
||||
package org.jetbrains.jps.model.serialization.java.compiler;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.model.java.compiler.ProcessorConfigProfile;
|
||||
|
||||
import java.io.File;
|
||||
@@ -100,9 +102,11 @@ public class AnnotationProcessorProfileSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeExternal(ProcessorConfigProfile profile, final Element element) {
|
||||
public static void writeExternal(@NotNull ProcessorConfigProfile profile, @NotNull Element element) {
|
||||
element.setAttribute(NAME, profile.getName());
|
||||
element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled()));
|
||||
if (!Registry.is("saving.state.in.new.format.is.allowed", false) || profile.isEnabled()) {
|
||||
element.setAttribute(ENABLED, Boolean.toString(profile.isEnabled()));
|
||||
}
|
||||
|
||||
final String srcDirName = profile.getGeneratedSourcesDirectoryName(false);
|
||||
if (!StringUtil.equals(ProcessorConfigProfile.DEFAULT_PRODUCTION_DIR_NAME, srcDirName)) {
|
||||
@@ -135,10 +139,18 @@ public class AnnotationProcessorProfileSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
final Element pathElement = addChild(element, "processorPath").setAttribute("useClasspath", Boolean.toString(
|
||||
profile.isObtainProcessorsFromClasspath()));
|
||||
|
||||
Element pathElement = null;
|
||||
if (!Registry.is("saving.state.in.new.format.is.allowed", false) || !profile.isObtainProcessorsFromClasspath()) {
|
||||
pathElement = addChild(element, "processorPath");
|
||||
pathElement.setAttribute("useClasspath", Boolean.toString(profile.isObtainProcessorsFromClasspath()));
|
||||
}
|
||||
|
||||
final String path = profile.getProcessorPath();
|
||||
if (!StringUtil.isEmpty(path)) {
|
||||
if (pathElement == null) {
|
||||
pathElement = addChild(element, "processorPath");
|
||||
}
|
||||
final StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator, false);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
final String token = tokenizer.nextToken();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -770,4 +770,8 @@ public class JDOMUtil {
|
||||
public static boolean isEmpty(@Nullable Element element) {
|
||||
return element == null || (element.getAttributes().isEmpty() && element.getContent().isEmpty());
|
||||
}
|
||||
|
||||
public static boolean isEmpty(@Nullable Element element, int attributeCount) {
|
||||
return element == null || (element.getAttributes().size() == attributeCount && element.getContent().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user