Adapt facet, map coroutine settings on three keys
This commit is contained in:
committed by
Stanislav Erokhin
parent
9460426d26
commit
091756b221
-4
@@ -79,10 +79,6 @@ public abstract class CommonCompilerArguments {
|
|||||||
@Argument(value = "Xcoroutines=enable")
|
@Argument(value = "Xcoroutines=enable")
|
||||||
public boolean coroutinesEnable;
|
public boolean coroutinesEnable;
|
||||||
|
|
||||||
@Argument(value = "Xcoroutine-support", description = "Coroutines: produce error/warning/compile silently")
|
|
||||||
// Possible values: "enabled", "warning", "disabled"
|
|
||||||
public String coroutineSupport;
|
|
||||||
|
|
||||||
@Argument(value = "P", description = "Pass an option to a plugin")
|
@Argument(value = "P", description = "Pass an option to a plugin")
|
||||||
@ValueDescription(PLUGIN_OPTION_FORMAT)
|
@ValueDescription(PLUGIN_OPTION_FORMAT)
|
||||||
public String[] pluginOptions;
|
public String[] pluginOptions;
|
||||||
|
|||||||
@@ -72,8 +72,13 @@ enum class CoroutineSupport(
|
|||||||
companion object {
|
companion object {
|
||||||
val DEFAULT = ENABLED_WITH_WARNING
|
val DEFAULT = ENABLED_WITH_WARNING
|
||||||
|
|
||||||
@JvmStatic fun byCompilerArgument(value: String?) = CoroutineSupport.values().firstOrNull { it.compilerArgument == value }
|
@JvmStatic fun byCompilerArguments(arguments: CommonCompilerArguments?) = when {
|
||||||
?: CoroutineSupport.DEFAULT
|
arguments == null -> DEFAULT
|
||||||
|
arguments.coroutinesEnable -> ENABLED
|
||||||
|
arguments.coroutinesWarn -> ENABLED_WITH_WARNING
|
||||||
|
arguments.coroutinesError -> DISABLED
|
||||||
|
else -> DEFAULT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,9 +94,11 @@ class KotlinCompilerInfo {
|
|||||||
var compilerSettings: CompilerSettings? = null
|
var compilerSettings: CompilerSettings? = null
|
||||||
|
|
||||||
@get:Transient var coroutineSupport: CoroutineSupport
|
@get:Transient var coroutineSupport: CoroutineSupport
|
||||||
get() = CoroutineSupport.byCompilerArgument(commonCompilerArguments?.coroutineSupport)
|
get() = CoroutineSupport.byCompilerArguments(commonCompilerArguments)
|
||||||
set(value) {
|
set(value) {
|
||||||
commonCompilerArguments?.coroutineSupport = value.compilerArgument
|
commonCompilerArguments?.coroutinesEnable = value == CoroutineSupport.ENABLED
|
||||||
|
commonCompilerArguments?.coroutinesWarn = value == CoroutineSupport.ENABLED_WITH_WARNING
|
||||||
|
commonCompilerArguments?.coroutinesError = value == CoroutineSupport.DISABLED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -248,7 +248,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
public boolean isModified() {
|
public boolean isModified() {
|
||||||
return ComparingUtils.isModified(generateNoWarningsCheckBox, commonCompilerArguments.suppressWarnings) ||
|
return ComparingUtils.isModified(generateNoWarningsCheckBox, commonCompilerArguments.suppressWarnings) ||
|
||||||
(showLanguageVersion && !getSelectedLanguageVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion))) ||
|
(showLanguageVersion && !getSelectedLanguageVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion))) ||
|
||||||
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArgument(k2jsCompilerArguments.moduleKind)) ||
|
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments)) ||
|
||||||
ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.getAdditionalArguments()) ||
|
ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.getAdditionalArguments()) ||
|
||||||
ComparingUtils.isModified(scriptTemplatesField, compilerSettings.getScriptTemplates()) ||
|
ComparingUtils.isModified(scriptTemplatesField, compilerSettings.getScriptTemplates()) ||
|
||||||
ComparingUtils.isModified(scriptTemplatesClasspathField, compilerSettings.getScriptTemplatesClasspath()) ||
|
ComparingUtils.isModified(scriptTemplatesClasspathField, compilerSettings.getScriptTemplatesClasspath()) ||
|
||||||
@@ -287,7 +287,10 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
if (showLanguageVersion) {
|
if (showLanguageVersion) {
|
||||||
commonCompilerArguments.languageVersion = getSelectedLanguageVersion();
|
commonCompilerArguments.languageVersion = getSelectedLanguageVersion();
|
||||||
}
|
}
|
||||||
commonCompilerArguments.coroutineSupport = ((CoroutineSupport) coroutineSupportComboBox.getSelectedItem()).getCompilerArgument();
|
CoroutineSupport coroutineSupport = (CoroutineSupport) coroutineSupportComboBox.getSelectedItem();
|
||||||
|
commonCompilerArguments.coroutinesEnable = coroutineSupport == CoroutineSupport.ENABLED;
|
||||||
|
commonCompilerArguments.coroutinesWarn = coroutineSupport == CoroutineSupport.ENABLED_WITH_WARNING;
|
||||||
|
commonCompilerArguments.coroutinesError = coroutineSupport == CoroutineSupport.DISABLED;
|
||||||
compilerSettings.setAdditionalArguments(additionalArgsOptionsField.getText());
|
compilerSettings.setAdditionalArguments(additionalArgsOptionsField.getText());
|
||||||
compilerSettings.setScriptTemplates(scriptTemplatesField.getText());
|
compilerSettings.setScriptTemplates(scriptTemplatesField.getText());
|
||||||
compilerSettings.setScriptTemplatesClasspath(scriptTemplatesClasspathField.getText());
|
compilerSettings.setScriptTemplatesClasspath(scriptTemplatesClasspathField.getText());
|
||||||
@@ -322,7 +325,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
if (showLanguageVersion) {
|
if (showLanguageVersion) {
|
||||||
languageVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion));
|
languageVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion));
|
||||||
}
|
}
|
||||||
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArgument(commonCompilerArguments.coroutineSupport));
|
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||||
additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments());
|
additionalArgsOptionsField.setText(compilerSettings.getAdditionalArguments());
|
||||||
scriptTemplatesField.setText(compilerSettings.getScriptTemplates());
|
scriptTemplatesField.setText(compilerSettings.getScriptTemplates());
|
||||||
scriptTemplatesClasspathField.setText(compilerSettings.getScriptTemplatesClasspath());
|
scriptTemplatesClasspathField.setText(compilerSettings.getScriptTemplatesClasspath());
|
||||||
|
|||||||
Reference in New Issue
Block a user