Configuration: Support selection of "Latest stable" version vs specific one
#KT-21229 Fixed
This commit is contained in:
+7
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.arguments
|
||||
|
||||
import com.intellij.util.xmlb.annotations.Transient
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.config.AnalysisFlag
|
||||
import java.util.*
|
||||
@@ -32,6 +33,9 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
const val ENABLE = "enable"
|
||||
}
|
||||
|
||||
@get:Transient
|
||||
var autoAdvanceLanguageVersion: Boolean by FreezableVar(true)
|
||||
|
||||
@GradleOption(DefaultValues.LanguageVersions::class)
|
||||
@Argument(
|
||||
value = "-language-version",
|
||||
@@ -40,6 +44,9 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
||||
)
|
||||
var languageVersion: String? by FreezableVar(null)
|
||||
|
||||
@get:Transient
|
||||
var autoAdvanceApiVersion: Boolean by FreezableVar(true)
|
||||
|
||||
@GradleOption(DefaultValues.LanguageVersions::class)
|
||||
@Argument(
|
||||
value = "-api-version",
|
||||
|
||||
+6
-14
@@ -21,45 +21,37 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.text.VersionComparatorUtil
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.SettingConstants.KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION
|
||||
import org.jetbrains.kotlin.config.getOption
|
||||
import org.jetbrains.kotlin.config.detectVersionAutoAdvance
|
||||
import org.jetbrains.kotlin.config.dropVersionsIfNecessary
|
||||
|
||||
@State(name = KOTLIN_COMMON_COMPILER_ARGUMENTS_SECTION,
|
||||
storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
Storage(file = BaseKotlinCompilerSettings.KOTLIN_COMPILER_SETTINGS_PATH,
|
||||
scheme = StorageScheme.DIRECTORY_BASED)))
|
||||
class KotlinCommonCompilerArgumentsHolder(project: Project) : BaseKotlinCompilerSettings<CommonCompilerArguments>(project) {
|
||||
private fun Element.dropElementIfDefault() {
|
||||
if (DEFAULT_LANGUAGE_VERSION == getAttribute("value")?.value) {
|
||||
detach()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getState(): Element {
|
||||
return super.getState().apply {
|
||||
// Do not serialize language/api version if they correspond to the default language version
|
||||
getOption("languageVersion")?.dropElementIfDefault()
|
||||
getOption("apiVersion")?.dropElementIfDefault()
|
||||
dropVersionsIfNecessary(settings)
|
||||
}
|
||||
}
|
||||
|
||||
override fun loadState(state: Element) {
|
||||
super.loadState(state)
|
||||
|
||||
// To fix earlier configurations with incorrect combination of language and API version
|
||||
update {
|
||||
// To fix earlier configurations with incorrect combination of language and API version
|
||||
if (VersionComparatorUtil.compare(languageVersion, apiVersion) < 0) {
|
||||
apiVersion = languageVersion
|
||||
}
|
||||
|
||||
detectVersionAutoAdvance()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createSettings() = CommonCompilerArguments.DummyImpl()
|
||||
|
||||
companion object {
|
||||
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST_STABLE.versionString
|
||||
|
||||
fun getInstance(project: Project) =
|
||||
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
||||
}
|
||||
|
||||
@@ -70,6 +70,48 @@ object CoroutineSupport {
|
||||
}
|
||||
}
|
||||
|
||||
sealed class VersionView : DescriptionAware {
|
||||
abstract val version: LanguageVersion
|
||||
|
||||
object LatestStable : VersionView() {
|
||||
override val version: LanguageVersion = LanguageVersion.LATEST_STABLE
|
||||
|
||||
override val description: String
|
||||
get() = "Latest stable (${version.versionString})"
|
||||
}
|
||||
|
||||
class Specific(override val version: LanguageVersion) : VersionView() {
|
||||
override val description: String
|
||||
get() = version.description
|
||||
|
||||
override fun equals(other: Any?) = other is Specific && version == other.version
|
||||
|
||||
override fun hashCode() = version.hashCode()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun deserialize(value: String?, isAutoAdvance: Boolean): VersionView {
|
||||
if (isAutoAdvance) return VersionView.LatestStable
|
||||
val languageVersion = LanguageVersion.fromVersionString(value)
|
||||
return if (languageVersion != null) VersionView.Specific(languageVersion) else VersionView.LatestStable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var CommonCompilerArguments.languageVersionView: VersionView
|
||||
get() = VersionView.deserialize(languageVersion, autoAdvanceLanguageVersion)
|
||||
set(value) {
|
||||
languageVersion = value.version.versionString
|
||||
autoAdvanceLanguageVersion = value == VersionView.LatestStable
|
||||
}
|
||||
|
||||
var CommonCompilerArguments.apiVersionView: VersionView
|
||||
get() = VersionView.deserialize(apiVersion, autoAdvanceApiVersion)
|
||||
set(value) {
|
||||
apiVersion = value.version.versionString
|
||||
autoAdvanceApiVersion = value == VersionView.LatestStable
|
||||
}
|
||||
|
||||
class KotlinFacetSettings {
|
||||
companion object {
|
||||
// Increment this when making serialization-incompatible changes to configuration data
|
||||
|
||||
@@ -74,6 +74,8 @@ private fun readV1Config(element: Element): KotlinFacetSettings {
|
||||
compilerArguments.apiVersion = apiLevel
|
||||
}
|
||||
|
||||
compilerArguments.detectVersionAutoAdvance()
|
||||
|
||||
if (useProjectSettings != null) {
|
||||
this.useProjectSettings = useProjectSettings
|
||||
}
|
||||
@@ -106,6 +108,7 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings {
|
||||
element.getChild("compilerArguments")?.let {
|
||||
compilerArguments = platformKind.createCompilerArguments { freeArgs = ArrayList() }
|
||||
XmlSerializer.deserializeInto(compilerArguments!!, it)
|
||||
compilerArguments!!.detectVersionAutoAdvance()
|
||||
}
|
||||
testOutputPath = element.getChild("testOutputPath")?.let {
|
||||
PathUtil.toSystemDependentName((it.content.firstOrNull() as? Text)?.textTrim)
|
||||
@@ -214,8 +217,8 @@ private fun Element.restoreNormalOrdering(bean: Any) {
|
||||
.forEachIndexed { index, element -> elementsToReorder[index] = element.clone() }
|
||||
}
|
||||
|
||||
private fun buildChildElement(element: Element, tag: String, bean: Any, filter: SerializationFilter) {
|
||||
Element(tag).apply {
|
||||
private fun buildChildElement(element: Element, tag: String, bean: Any, filter: SerializationFilter): Element {
|
||||
return Element(tag).apply {
|
||||
XmlSerializer.serializeInto(bean, this, filter)
|
||||
restoreNormalOrdering(bean)
|
||||
element.addContent(this)
|
||||
@@ -245,7 +248,24 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
|
||||
}
|
||||
compilerArguments?.let { copyBean(it) }?.let {
|
||||
it.convertPathsToSystemIndependent()
|
||||
buildChildElement(element, "compilerArguments", it, filter)
|
||||
val compilerArgumentsXml = buildChildElement(element, "compilerArguments", it, filter)
|
||||
compilerArgumentsXml.dropVersionsIfNecessary(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun CommonCompilerArguments.detectVersionAutoAdvance() {
|
||||
autoAdvanceLanguageVersion = languageVersion == null
|
||||
autoAdvanceApiVersion = apiVersion == null
|
||||
}
|
||||
|
||||
fun Element.dropVersionsIfNecessary(settings: CommonCompilerArguments) {
|
||||
// Do not serialize language/api version if they correspond to the default language version
|
||||
if (settings.autoAdvanceLanguageVersion) {
|
||||
getOption("languageVersion")?.detach()
|
||||
}
|
||||
|
||||
if (settings.autoAdvanceApiVersion) {
|
||||
getOption("apiVersion")?.detach()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+35
-37
@@ -58,10 +58,7 @@ import org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Configurable.NoScroll{
|
||||
private static final Map<String, String> moduleKindDescriptions = new LinkedHashMap<>();
|
||||
@@ -111,9 +108,9 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
private JPanel k2jvmPanel;
|
||||
private JPanel k2jsPanel;
|
||||
private JComboBox jvmVersionComboBox;
|
||||
private JComboBox languageVersionComboBox;
|
||||
private JComboBox<VersionView> languageVersionComboBox;
|
||||
private JComboBox coroutineSupportComboBox;
|
||||
private JComboBox apiVersionComboBox;
|
||||
private JComboBox<VersionView> apiVersionComboBox;
|
||||
private JPanel scriptPanel;
|
||||
private JLabel labelForOutputPrefixFile;
|
||||
private JLabel labelForOutputPostfixFile;
|
||||
@@ -145,7 +142,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
restrictAPIVersions(getSelectedLanguageVersion());
|
||||
restrictAPIVersions(getSelectedLanguageVersionView().getVersion());
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -295,15 +292,6 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
return jvmVersion != null ? jvmVersion : JvmTarget.DEFAULT.getDescription();
|
||||
}
|
||||
|
||||
private static LanguageVersion getLanguageVersionOrDefault(@Nullable String languageVersion) {
|
||||
LanguageVersion version = LanguageVersion.fromVersionString(languageVersion);
|
||||
return version != null ? version : LanguageVersion.LATEST_STABLE;
|
||||
}
|
||||
|
||||
private static ApiVersion getApiVersionOrDefault(@Nullable String apiVersion) {
|
||||
return apiVersion != null ? ApiVersion.Companion.parse(apiVersion) : ApiVersion.LATEST_STABLE;
|
||||
}
|
||||
|
||||
private static void setupFileChooser(
|
||||
@NotNull JLabel label,
|
||||
@NotNull TextFieldWithBrowseButton fileChooser,
|
||||
@@ -328,15 +316,21 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLessOrEqual(LanguageVersion version, LanguageVersion upperBound) {
|
||||
return VersionComparatorUtil.compare(version.getVersionString(), upperBound.getVersionString()) <= 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void restrictAPIVersions(LanguageVersion upperBound) {
|
||||
ApiVersion selectedAPIVersion = getSelectedAPIVersion();
|
||||
List<ApiVersion> permittedAPIVersions = ArraysKt.mapNotNull(
|
||||
LanguageVersion selectedAPIVersion = getSelectedAPIVersionView().getVersion();
|
||||
List<VersionView> permittedAPIVersions = new ArrayList<>(LanguageVersion.values().length + 1);
|
||||
if (isLessOrEqual(VersionView.LatestStable.INSTANCE.getVersion(), upperBound)) {
|
||||
permittedAPIVersions.add(VersionView.LatestStable.INSTANCE);
|
||||
}
|
||||
ArraysKt.mapNotNullTo(
|
||||
LanguageVersion.values(),
|
||||
version -> VersionComparatorUtil.compare(version.getVersionString(), upperBound.getVersionString()) <= 0 &&
|
||||
VersionComparatorUtil.compare(version.getVersionString(), upperBound.getVersionString()) <= 0
|
||||
? ApiVersion.createByLanguageVersion(version)
|
||||
: null
|
||||
permittedAPIVersions,
|
||||
version -> isLessOrEqual(version, upperBound) ? new VersionView.Specific(version) : null
|
||||
);
|
||||
apiVersionComboBox.setModel(
|
||||
new DefaultComboBoxModel(permittedAPIVersions.toArray())
|
||||
@@ -357,13 +351,17 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void fillLanguageAndAPIVersionList() {
|
||||
languageVersionComboBox.addItem(VersionView.LatestStable.INSTANCE);
|
||||
apiVersionComboBox.addItem(VersionView.LatestStable.INSTANCE);
|
||||
|
||||
for (LanguageVersion version : LanguageVersion.values()) {
|
||||
if (!version.isStable() && !KotlinInternalMode.Instance.getEnabled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
languageVersionComboBox.addItem(version);
|
||||
apiVersionComboBox.addItem(ApiVersion.createByLanguageVersion(version));
|
||||
VersionView.Specific specificVersion = new VersionView.Specific(version);
|
||||
languageVersionComboBox.addItem(specificVersion);
|
||||
apiVersionComboBox.addItem(specificVersion);
|
||||
}
|
||||
languageVersionComboBox.setRenderer(new DescriptionListCellRenderer());
|
||||
apiVersionComboBox.setRenderer(new DescriptionListCellRenderer());
|
||||
@@ -429,8 +427,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return ComparingUtils.isModified(reportWarningsCheckBox, !commonCompilerArguments.getSuppressWarnings()) ||
|
||||
!getSelectedLanguageVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.getLanguageVersion())) ||
|
||||
!getSelectedAPIVersion().equals(getApiVersionOrDefault(commonCompilerArguments.getApiVersion())) ||
|
||||
!getSelectedLanguageVersionView().equals(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments)) ||
|
||||
!getSelectedAPIVersionView().equals(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)) ||
|
||||
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments)) ||
|
||||
ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.getAdditionalArguments()) ||
|
||||
ComparingUtils.isModified(scriptTemplatesField, compilerSettings.getScriptTemplates()) ||
|
||||
@@ -467,15 +465,15 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LanguageVersion getSelectedLanguageVersion() {
|
||||
public VersionView getSelectedLanguageVersionView() {
|
||||
Object item = languageVersionComboBox.getSelectedItem();
|
||||
return item != null ? (LanguageVersion) item : LanguageVersion.LATEST_STABLE;
|
||||
return item != null ? (VersionView) item : VersionView.LatestStable.INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private ApiVersion getSelectedAPIVersion() {
|
||||
private VersionView getSelectedAPIVersionView() {
|
||||
Object item = apiVersionComboBox.getSelectedItem();
|
||||
return item != null ? (ApiVersion) item : ApiVersion.LATEST_STABLE;
|
||||
return item != null ? (VersionView) item : VersionView.LatestStable.INSTANCE;
|
||||
}
|
||||
|
||||
public void applyTo(
|
||||
@@ -486,8 +484,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
) throws ConfigurationException {
|
||||
if (isProjectSettings) {
|
||||
boolean shouldInvalidateCaches =
|
||||
commonCompilerArguments.getLanguageVersion() != getSelectedLanguageVersion().getVersionString() ||
|
||||
commonCompilerArguments.getApiVersion() != getSelectedAPIVersion().getVersionString() ||
|
||||
!getSelectedLanguageVersionView().equals(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments)) ||
|
||||
!getSelectedAPIVersionView().equals(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments)) ||
|
||||
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||
|
||||
if (shouldInvalidateCaches) {
|
||||
@@ -504,8 +502,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
}
|
||||
|
||||
commonCompilerArguments.setSuppressWarnings(!reportWarningsCheckBox.isSelected());
|
||||
commonCompilerArguments.setLanguageVersion(getSelectedLanguageVersion().getVersionString());
|
||||
commonCompilerArguments.setApiVersion(getSelectedAPIVersion().getVersionString());
|
||||
KotlinFacetSettingsKt.setLanguageVersionView(commonCompilerArguments, getSelectedLanguageVersionView());
|
||||
KotlinFacetSettingsKt.setApiVersionView(commonCompilerArguments, getSelectedAPIVersionView());
|
||||
|
||||
switch ((LanguageFeature.State) coroutineSupportComboBox.getSelectedItem()) {
|
||||
case ENABLED:
|
||||
@@ -564,9 +562,9 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
@Override
|
||||
public void reset() {
|
||||
reportWarningsCheckBox.setSelected(!commonCompilerArguments.getSuppressWarnings());
|
||||
languageVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.getLanguageVersion()));
|
||||
apiVersionComboBox.setSelectedItem(getApiVersionOrDefault(commonCompilerArguments.getApiVersion()));
|
||||
restrictAPIVersions(getSelectedLanguageVersion());
|
||||
languageVersionComboBox.setSelectedItem(KotlinFacetSettingsKt.getLanguageVersionView(commonCompilerArguments));
|
||||
restrictAPIVersions(getSelectedLanguageVersionView().getVersion());
|
||||
apiVersionComboBox.setSelectedItem(KotlinFacetSettingsKt.getApiVersionView(commonCompilerArguments));
|
||||
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||
additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments());
|
||||
scriptTemplatesField.setText(compilerSettings.getScriptTemplates());
|
||||
|
||||
@@ -29,11 +29,9 @@ import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.annotations.Contract
|
||||
import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
|
||||
import org.jetbrains.kotlin.idea.framework.ui.CreateLibraryDialogWithModules
|
||||
import org.jetbrains.kotlin.idea.framework.ui.FileUIUtils
|
||||
@@ -112,6 +110,11 @@ abstract class KotlinWithLibraryConfigurator internal constructor() : KotlinProj
|
||||
|
||||
configureKotlinSettings(modulesToConfigure)
|
||||
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
}
|
||||
|
||||
collector.showNotification()
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ class KotlinFacetEditorGeneralTab(
|
||||
|
||||
private fun restrictAPIVersions() {
|
||||
with(editor.compilerConfigurable) {
|
||||
restrictAPIVersions(selectedLanguageVersion)
|
||||
restrictAPIVersions(selectedLanguageVersionView.version)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -31,6 +31,11 @@ import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.config.VersionView
|
||||
import org.jetbrains.kotlin.config.apiVersionView
|
||||
import org.jetbrains.kotlin.config.languageVersionView
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState.COPY
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinWithLibraryConfigurator.FileState.DO_NOT_COPY
|
||||
@@ -96,6 +101,11 @@ abstract class CustomLibraryDescriptorWithDeferredConfig
|
||||
|
||||
configureKotlinSettings(module.project, rootModel.sdk)
|
||||
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(module.project).update {
|
||||
languageVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
apiVersionView = VersionView.Specific(LanguageVersion.LATEST_STABLE)
|
||||
}
|
||||
|
||||
collector.showNotification()
|
||||
}
|
||||
finally {
|
||||
|
||||
Generated
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="apiVersion" value="1.2" />
|
||||
<option name="languageVersion" value="1.2" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
Vendored
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/kotlin-runtime.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/module.iml" filepath="$PROJECT_DIR$/module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
BIN
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
idea/testData/configuration/noKotlincExistsNoSettingsRuntime10/.idea/copyright/profiles_settings.xml
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
||||
idea/testData/configuration/noKotlincExistsNoSettingsRuntime10/.idea/libraries/KotlinJavaRuntime.xml
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/kotlin-runtime.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/module.iml" filepath="$PROJECT_DIR$/module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -48,16 +48,16 @@ class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun testKotlincExistsNoSettingsRuntime10() {
|
||||
fun testNoKotlincExistsNoSettingsRuntime10() {
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.doNotSave(false)
|
||||
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, module.languageVersionSettings.languageVersion)
|
||||
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||
application.saveAll()
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") != null)
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
||||
}
|
||||
|
||||
fun testKotlincExistsNoSettingsLatestRuntime() {
|
||||
fun testNoKotlincExistsNoSettingsLatestRuntime() {
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.doNotSave(false)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||
@@ -66,6 +66,31 @@ class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
||||
}
|
||||
|
||||
fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() {
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.doNotSave(false)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||
autoAdvanceLanguageVersion = false
|
||||
autoAdvanceApiVersion = false
|
||||
}
|
||||
application.saveAll()
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") != null)
|
||||
}
|
||||
|
||||
fun testDropKotlincOnVersionAutoAdvance() {
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.doNotSave(false)
|
||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||
autoAdvanceLanguageVersion = true
|
||||
autoAdvanceApiVersion = true
|
||||
}
|
||||
application.saveAll()
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
||||
}
|
||||
|
||||
fun testProject106InconsistentVersionInConfig() {
|
||||
val settings = KotlinFacetSettingsProvider.getInstance(myProject).getInitializedSettings(module)
|
||||
Assert.assertEquals(false, settings.useProjectSettings)
|
||||
|
||||
Reference in New Issue
Block a user