From 62fb149f082e661c3c1cc51f40c78fa8907944ff Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 9 Jun 2017 19:54:31 +0300 Subject: [PATCH] Add support for sourceMapPrefix option (JS) in IDEA --- .../kotlin/idea/maven/KotlinMavenImporter.kt | 1 + .../KotlinCompilerConfigurableTab.form | 39 +++++++++++++------ .../KotlinCompilerConfigurableTab.java | 9 +++++ .../jetbrains/kotlin/idea/facet/facetUtils.kt | 1 + 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt index cb59916d023..5f6444d7b85 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt @@ -133,6 +133,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_ } is K2JSCompilerArguments -> { arguments.sourceMap = configuration?.getChild("sourceMap")?.text?.trim()?.toBoolean() ?: false + arguments.sourceMapPrefix = configuration?.getChild("sourceMapPrefix")?.text?.trim() ?: "" arguments.outputFile = configuration?.getChild("outputFile")?.text arguments.metaInfo = configuration?.getChild("metaInfo")?.text?.trim()?.toBoolean() ?: false arguments.moduleKind = configuration?.getChild("moduleKind")?.text diff --git a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form index 901cd6f3a30..86a96e286b9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form +++ b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.form @@ -3,7 +3,7 @@ - + @@ -15,7 +15,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -38,13 +38,13 @@ - + - + @@ -52,13 +52,13 @@ - + - + @@ -66,7 +66,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -109,6 +109,23 @@ + + + + + + + + + + + + + + + + + diff --git a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java index 775aa3e9164..9bacce2302f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java +++ b/idea/src/org/jetbrains/kotlin/idea/compiler/configuration/KotlinCompilerConfigurableTab.java @@ -112,6 +112,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co private JLabel labelForOutputPrefixFile; private JLabel labelForOutputPostfixFile; private JLabel warningLabel; + private JTextField sourceMapPrefix; + private JLabel labelForSourceMapPrefix; private boolean isEnabled = true; public KotlinCompilerConfigurableTab( @@ -190,6 +192,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co } } + generateSourceMapsCheckBox.addActionListener(event -> sourceMapPrefix.setEnabled(generateSourceMapsCheckBox.isSelected())); + updateOutputDirEnabled(); } @@ -404,6 +408,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co ComparingUtils.isModified(outputPrefixFile, k2jsCompilerArguments.outputPrefix) || ComparingUtils.isModified(outputPostfixFile, k2jsCompilerArguments.outputPostfix) || !getSelectedModuleKind().equals(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind)) || + ComparingUtils.isModified(sourceMapPrefix, k2jsCompilerArguments.sourceMapPrefix) || !getSelectedJvmVersion().equals(getJvmVersionOrDefault(k2jvmCompilerArguments.jvmTarget)); } @@ -493,6 +498,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co k2jsCompilerArguments.outputPostfix = StringUtil.nullize(outputPostfixFile.getText(), true); k2jsCompilerArguments.moduleKind = getSelectedModuleKind(); + k2jsCompilerArguments.sourceMapPrefix = sourceMapPrefix.getText(); + k2jvmCompilerArguments.jvmTarget = getSelectedJvmVersion(); if (isProjectSettings) { @@ -533,6 +540,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co outputPostfixFile.setText(k2jsCompilerArguments.outputPostfix); moduleKindComboBox.setSelectedItem(getModuleKindOrDefault(k2jsCompilerArguments.moduleKind)); + sourceMapPrefix.setText(k2jsCompilerArguments.sourceMapPrefix); + sourceMapPrefix.setEnabled(k2jsCompilerArguments.sourceMap); jvmVersionComboBox.setSelectedItem(getJvmVersionOrDefault(k2jvmCompilerArguments.jvmTarget)); } diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt index 57e8e1cfba9..9ead2e9abc8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/facetUtils.kt @@ -163,6 +163,7 @@ val jvmUIExposedFields = commonUIExposedFields + jvmSpecificUIExposedFields private val jvmPrimaryFields = commonPrimaryFields + jvmSpecificUIExposedFields private val jsSpecificUIExposedFields = listOf(K2JSCompilerArguments::sourceMap.name, + K2JSCompilerArguments::sourceMapPrefix.name, K2JSCompilerArguments::outputPrefix.name, K2JSCompilerArguments::outputPostfix.name, K2JSCompilerArguments::moduleKind.name)