Add support for sourceMapPrefix option (JS) in IDEA
This commit is contained in:
@@ -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
|
||||
|
||||
+28
-11
@@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="12" 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>
|
||||
<xy x="350" y="20" width="920" height="823"/>
|
||||
<xy x="350" y="20" width="920" height="1119"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="empty">
|
||||
@@ -15,7 +15,7 @@
|
||||
<grid row="11" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="98e8a" binding="k2jsPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="98e8a" binding="k2jsPanel" layout-manager="GridLayoutManager" row-count="7" 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="8" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="true"/>
|
||||
@@ -30,7 +30,7 @@
|
||||
<children>
|
||||
<component id="3ac8f" class="javax.swing.JLabel" binding="labelForOutputPrefixFile">
|
||||
<constraints>
|
||||
<grid row="1" 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="2" 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>
|
||||
<properties>
|
||||
<text resource-bundle="org/jetbrains/kotlin/idea/KotlinBundle" key="kotlin.compiler.js.option.output.prefix"/>
|
||||
@@ -38,13 +38,13 @@
|
||||
</component>
|
||||
<component id="dd0c2" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="outputPrefixFile">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="70326" class="javax.swing.JLabel" binding="labelForOutputPostfixFile">
|
||||
<constraints>
|
||||
<grid row="2" 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="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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="org/jetbrains/kotlin/idea/KotlinBundle" key="kotlin.compiler.js.option.output.postfix"/>
|
||||
@@ -52,13 +52,13 @@
|
||||
</component>
|
||||
<component id="1bdb7" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="outputPostfixFile">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="b93a8" class="javax.swing.JLabel" binding="labelForOutputDirectory">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Destination directory"/>
|
||||
@@ -66,7 +66,7 @@
|
||||
</component>
|
||||
<component id="7c11a" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="outputDirectory">
|
||||
<constraints>
|
||||
<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">
|
||||
<grid row="5" 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"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
@@ -76,7 +76,7 @@
|
||||
</component>
|
||||
<component id="97317" class="com.intellij.util.ui.ThreeStateCheckBox" binding="copyRuntimeFilesCheckBox" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" 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="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<state value="NOT_SELECTED"/>
|
||||
@@ -85,7 +85,7 @@
|
||||
</component>
|
||||
<component id="915d" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" 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="6" 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>
|
||||
<properties>
|
||||
<labelFor value="ca29c"/>
|
||||
@@ -94,7 +94,7 @@
|
||||
</component>
|
||||
<component id="ca29c" class="javax.swing.JComboBox" binding="moduleKindComboBox">
|
||||
<constraints>
|
||||
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="6" 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>
|
||||
<model/>
|
||||
@@ -109,6 +109,23 @@
|
||||
<text resource-bundle="org/jetbrains/kotlin/idea/KotlinBundle" key="kotlin.compiler.js.option.generate.sourcemaps"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="6484c" class="javax.swing.JLabel" binding="labelForSourceMapPrefix">
|
||||
<constraints>
|
||||
<grid row="1" 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>
|
||||
<properties>
|
||||
<labelFor value="e65e6"/>
|
||||
<text value="Add prefix to paths in source map:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e65e6" class="javax.swing.JTextField" binding="sourceMapPrefix">
|
||||
<constraints>
|
||||
<grid row="1" 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"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="483d4" binding="scriptPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
+9
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user