Project Settings: Expose API version setting in Kotlin compiler configuration UI
This commit is contained in:
+35
-9
@@ -13,7 +13,7 @@
|
|||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</vspacer>
|
</vspacer>
|
||||||
<grid id="27e96" layout-manager="GridLayoutManager" row-count="7" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="27e96" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="ba279" class="javax.swing.JLabel" binding="additionalArgsLabel">
|
<component id="ba279" class="javax.swing.JLabel" binding="additionalArgsLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text resource-bundle="org/jetbrains/kotlin/idea/KotlinBundle" key="kotlin.compiler.option.additional.command.line.parameters"/>
|
<text resource-bundle="org/jetbrains/kotlin/idea/KotlinBundle" key="kotlin.compiler.option.additional.command.line.parameters"/>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="7a827" class="com.intellij.ui.RawCommandLineEditor" binding="additionalArgsOptionsField">
|
<component id="7a827" class="com.intellij.ui.RawCommandLineEditor" binding="additionalArgsOptionsField">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="c45a6" class="javax.swing.JCheckBox" binding="keepAliveCheckBox">
|
<component id="c45a6" class="javax.swing.JCheckBox" binding="keepAliveCheckBox">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Keep compiler process alive between invocations"/>
|
<text value="Keep compiler process alive between invocations"/>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="ae60b" class="javax.swing.JLabel" binding="scriptTemplatesLabel">
|
<component id="ae60b" class="javax.swing.JLabel" binding="scriptTemplatesLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<labelFor value="71c3f"/>
|
<labelFor value="71c3f"/>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="71c3f" class="javax.swing.JTextField" binding="scriptTemplatesField">
|
<component id="71c3f" class="javax.swing.JTextField" binding="scriptTemplatesField">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="56390" class="javax.swing.JLabel" binding="scriptTemplatesClasspathLabel">
|
<component id="56390" class="javax.swing.JLabel" binding="scriptTemplatesClasspathLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<labelFor value="644d9"/>
|
<labelFor value="644d9"/>
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="644d9" class="javax.swing.JTextField" binding="scriptTemplatesClasspathField">
|
<component id="644d9" class="javax.swing.JTextField" binding="scriptTemplatesClasspathField">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="1" use-parent-layout="false">
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
<grid id="6b551" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="6b551" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
@@ -142,6 +142,32 @@
|
|||||||
</component>
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
|
<grid id="d8cd" binding="apiVersionPanel" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="5158" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="201" height="16"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="AP&I Version"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="ab3e4" class="javax.swing.JComboBox" binding="apiVersionComboBox">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<grid id="2f977" binding="k2jvmPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
<grid id="2f977" binding="k2jvmPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
|||||||
+15
-2
@@ -94,6 +94,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
private JComboBox languageVersionComboBox;
|
private JComboBox languageVersionComboBox;
|
||||||
private JPanel languageVersionPanel;
|
private JPanel languageVersionPanel;
|
||||||
private JComboBox coroutineSupportComboBox;
|
private JComboBox coroutineSupportComboBox;
|
||||||
|
private JPanel apiVersionPanel;
|
||||||
|
private JComboBox apiVersionComboBox;
|
||||||
|
|
||||||
public KotlinCompilerConfigurableTab(
|
public KotlinCompilerConfigurableTab(
|
||||||
Project project,
|
Project project,
|
||||||
@@ -114,6 +116,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
|
|
||||||
if (!isProjectSettings) {
|
if (!isProjectSettings) {
|
||||||
languageVersionPanel.setVisible(false);
|
languageVersionPanel.setVisible(false);
|
||||||
|
apiVersionPanel.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
additionalArgsOptionsField.attachLabel(additionalArgsLabel);
|
additionalArgsOptionsField.attachLabel(additionalArgsLabel);
|
||||||
@@ -134,7 +137,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
|
|
||||||
fillModuleKindList();
|
fillModuleKindList();
|
||||||
fillJvmVersionList();
|
fillJvmVersionList();
|
||||||
fillLanguageVersionList();
|
fillLanguageAndAPIVersionList();
|
||||||
fillCoroutineSupportList();
|
fillCoroutineSupportList();
|
||||||
|
|
||||||
if (compilerWorkspaceSettings == null) {
|
if (compilerWorkspaceSettings == null) {
|
||||||
@@ -201,9 +204,10 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void fillLanguageVersionList() {
|
private void fillLanguageAndAPIVersionList() {
|
||||||
for (LanguageVersion version : LanguageVersion.values()) {
|
for (LanguageVersion version : LanguageVersion.values()) {
|
||||||
languageVersionComboBox.addItem(version.getDescription());
|
languageVersionComboBox.addItem(version.getDescription());
|
||||||
|
apiVersionComboBox.addItem(version.getDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +258,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) ||
|
||||||
(isProjectSettings && !getSelectedLanguageVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion))) ||
|
(isProjectSettings && !getSelectedLanguageVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion))) ||
|
||||||
|
(isProjectSettings && !getSelectedAPIVersion().equals(getLanguageVersionOrDefault(commonCompilerArguments.apiVersion))) ||
|
||||||
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments)) ||
|
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments)) ||
|
||||||
ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.additionalArguments) ||
|
ComparingUtils.isModified(additionalArgsOptionsField, compilerSettings.additionalArguments) ||
|
||||||
ComparingUtils.isModified(scriptTemplatesField, compilerSettings.scriptTemplates) ||
|
ComparingUtils.isModified(scriptTemplatesField, compilerSettings.scriptTemplates) ||
|
||||||
@@ -287,14 +292,21 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
return getLanguageVersionOrDefault((String) languageVersionComboBox.getSelectedItem());
|
return getLanguageVersionOrDefault((String) languageVersionComboBox.getSelectedItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private String getSelectedAPIVersion() {
|
||||||
|
return getLanguageVersionOrDefault((String) apiVersionComboBox.getSelectedItem());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply() throws ConfigurationException {
|
public void apply() throws ConfigurationException {
|
||||||
commonCompilerArguments.suppressWarnings = generateNoWarningsCheckBox.isSelected();
|
commonCompilerArguments.suppressWarnings = generateNoWarningsCheckBox.isSelected();
|
||||||
if (isProjectSettings) {
|
if (isProjectSettings) {
|
||||||
boolean shouldInvalidateCaches =
|
boolean shouldInvalidateCaches =
|
||||||
commonCompilerArguments.languageVersion != getSelectedLanguageVersion() ||
|
commonCompilerArguments.languageVersion != getSelectedLanguageVersion() ||
|
||||||
|
commonCompilerArguments.apiVersion != getSelectedAPIVersion() ||
|
||||||
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
!coroutineSupportComboBox.getSelectedItem().equals(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||||
commonCompilerArguments.languageVersion = getSelectedLanguageVersion();
|
commonCompilerArguments.languageVersion = getSelectedLanguageVersion();
|
||||||
|
commonCompilerArguments.apiVersion = getSelectedAPIVersion();
|
||||||
if (shouldInvalidateCaches) {
|
if (shouldInvalidateCaches) {
|
||||||
ApplicationUtilsKt.runWriteAction(
|
ApplicationUtilsKt.runWriteAction(
|
||||||
new Function0<Object>() {
|
new Function0<Object>() {
|
||||||
@@ -344,6 +356,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings);
|
generateNoWarningsCheckBox.setSelected(commonCompilerArguments.suppressWarnings);
|
||||||
if (isProjectSettings) {
|
if (isProjectSettings) {
|
||||||
languageVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion));
|
languageVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.languageVersion));
|
||||||
|
apiVersionComboBox.setSelectedItem(getLanguageVersionOrDefault(commonCompilerArguments.apiVersion));
|
||||||
}
|
}
|
||||||
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
coroutineSupportComboBox.setSelectedItem(CoroutineSupport.byCompilerArguments(commonCompilerArguments));
|
||||||
additionalArgsOptionsField.setText(compilerSettings.additionalArguments);
|
additionalArgsOptionsField.setText(compilerSettings.additionalArguments);
|
||||||
|
|||||||
Reference in New Issue
Block a user