Add setting to enable JS IC for JPS
#KT-25565 fixed
This commit is contained in:
@@ -21,11 +21,11 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import java.util.List;
|
||||
|
||||
public class IncrementalCompilation {
|
||||
private static final String INCREMENTAL_COMPILATION_PROPERTY = "kotlin.incremental.compilation";
|
||||
private static final String INCREMENTAL_COMPILATION_JS_PROPERTY = "kotlin.incremental.compilation.js";
|
||||
public static final String INCREMENTAL_COMPILATION_JVM_PROPERTY = "kotlin.incremental.compilation";
|
||||
public static final String INCREMENTAL_COMPILATION_JS_PROPERTY = "kotlin.incremental.compilation.js";
|
||||
|
||||
public static boolean isEnabledForJvm() {
|
||||
return "true".equals(System.getProperty(INCREMENTAL_COMPILATION_PROPERTY));
|
||||
return "true".equals(System.getProperty(INCREMENTAL_COMPILATION_JVM_PROPERTY));
|
||||
}
|
||||
|
||||
public static boolean isEnabledForJs() {
|
||||
@@ -34,7 +34,7 @@ public class IncrementalCompilation {
|
||||
|
||||
@TestOnly
|
||||
public static void setIsEnabled(boolean value) {
|
||||
System.setProperty(INCREMENTAL_COMPILATION_PROPERTY, String.valueOf(value));
|
||||
System.setProperty(INCREMENTAL_COMPILATION_JVM_PROPERTY, String.valueOf(value));
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@@ -43,7 +43,7 @@ public class IncrementalCompilation {
|
||||
}
|
||||
|
||||
public static void toJvmArgs(List<String> jvmArgs) {
|
||||
if (isEnabledForJvm()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_PROPERTY);
|
||||
if (isEnabledForJvm()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_JVM_PROPERTY);
|
||||
if (isEnabledForJs()) addJvmSystemFlag(jvmArgs, INCREMENTAL_COMPILATION_JS_PROPERTY);
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -23,12 +23,14 @@ import com.intellij.openapi.components.StoragePathMacros
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil
|
||||
|
||||
@State(
|
||||
name = "KotlinCompilerWorkspaceSettings",
|
||||
storages = arrayOf(
|
||||
Storage(file = StoragePathMacros.WORKSPACE_FILE)
|
||||
)
|
||||
) class KotlinCompilerWorkspaceSettings : PersistentStateComponent<KotlinCompilerWorkspaceSettings> {
|
||||
name = "KotlinCompilerWorkspaceSettings",
|
||||
storages = arrayOf(
|
||||
Storage(file = StoragePathMacros.WORKSPACE_FILE)
|
||||
)
|
||||
)
|
||||
class KotlinCompilerWorkspaceSettings : PersistentStateComponent<KotlinCompilerWorkspaceSettings> {
|
||||
var preciseIncrementalEnabled: Boolean = true
|
||||
var incrementalCompilationForJsEnabled: Boolean = false
|
||||
var enableDaemon: Boolean = true
|
||||
|
||||
override fun getState(): KotlinCompilerWorkspaceSettings {
|
||||
|
||||
+9
-4
@@ -17,15 +17,20 @@
|
||||
package org.jetbrains.kotlin.idea.compiler.configuration
|
||||
|
||||
import com.intellij.compiler.server.BuildProcessParametersProvider
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.idea.PluginStartupComponent
|
||||
|
||||
class KotlinBuildProcessParametersProvider(private val compilerWorkspaceSettings: KotlinCompilerWorkspaceSettings,
|
||||
private val kotlinPluginStartupComponent: PluginStartupComponent
|
||||
): BuildProcessParametersProvider() {
|
||||
class KotlinBuildProcessParametersProvider(
|
||||
private val compilerWorkspaceSettings: KotlinCompilerWorkspaceSettings,
|
||||
private val kotlinPluginStartupComponent: PluginStartupComponent
|
||||
) : BuildProcessParametersProvider() {
|
||||
override fun getVMArguments(): MutableList<String> {
|
||||
val res = arrayListOf<String>()
|
||||
if (compilerWorkspaceSettings.preciseIncrementalEnabled) {
|
||||
res.add("-Dkotlin.incremental.compilation=true")
|
||||
res.add("-D" + IncrementalCompilation.INCREMENTAL_COMPILATION_JVM_PROPERTY + "=true")
|
||||
}
|
||||
if (compilerWorkspaceSettings.incrementalCompilationForJsEnabled) {
|
||||
res.add("-D" + IncrementalCompilation.INCREMENTAL_COMPILATION_JS_PROPERTY + "=true")
|
||||
}
|
||||
if (compilerWorkspaceSettings.enableDaemon) {
|
||||
res.add("-Dkotlin.daemon.enabled")
|
||||
|
||||
+25
-17
@@ -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="8" 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="9" 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="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>
|
||||
<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="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"/>
|
||||
<grid row="4" 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="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"/>
|
||||
<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"/>
|
||||
</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="4" 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="5" 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="6" 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="7" 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="6" 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="7" 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="5" 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="6" 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="7" 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="8" 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="7" 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="8" 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/>
|
||||
@@ -102,7 +102,7 @@
|
||||
</component>
|
||||
<component id="e1cc8" class="com.intellij.util.ui.ThreeStateCheckBox" binding="generateSourceMapsCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="0" 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="1" 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"/>
|
||||
@@ -111,7 +111,7 @@
|
||||
</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"/>
|
||||
<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>
|
||||
<labelFor value="e65e6"/>
|
||||
@@ -120,7 +120,7 @@
|
||||
</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">
|
||||
<grid row="2" 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>
|
||||
@@ -128,7 +128,7 @@
|
||||
</component>
|
||||
<component id="e5314" class="javax.swing.JLabel">
|
||||
<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 value="Embed source code into source map:"/>
|
||||
@@ -136,10 +136,18 @@
|
||||
</component>
|
||||
<component id="48310" class="javax.swing.JComboBox" binding="sourceMapEmbedSources">
|
||||
<constraints>
|
||||
<grid row="2" 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="3" 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>
|
||||
<component id="6f3" class="javax.swing.JCheckBox" binding="enableIncrementalCompilationForJsCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<text value="Enable incremental compilation (experimental)"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="483d4" binding="scriptPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
@@ -247,12 +255,12 @@
|
||||
<text value="Target &JVM version"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d8f92" class="javax.swing.JCheckBox" binding="enablePreciseIncrementalCheckBox">
|
||||
<component id="d8f92" class="javax.swing.JCheckBox" binding="enableIncrementalCompilationForJvmCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" 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>
|
||||
<properties>
|
||||
<text value="Enable precise incremental compilation"/>
|
||||
<text value="Enable incremental compilation"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="769be" class="javax.swing.JComboBox" binding="jvmVersionComboBox">
|
||||
|
||||
+8
-4
@@ -88,7 +88,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
private TextFieldWithBrowseButton outputDirectory;
|
||||
private ThreeStateCheckBox copyRuntimeFilesCheckBox;
|
||||
private ThreeStateCheckBox keepAliveCheckBox;
|
||||
private JCheckBox enablePreciseIncrementalCheckBox;
|
||||
private JCheckBox enableIncrementalCompilationForJvmCheckBox;
|
||||
private JCheckBox enableIncrementalCompilationForJsCheckBox;
|
||||
private JComboBox moduleKindComboBox;
|
||||
private JCheckBox scriptDependenciesAutoReload;
|
||||
private JTextField scriptTemplatesField;
|
||||
@@ -438,7 +439,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
isModified(outputDirectory, compilerSettings.getOutputDirectoryForJsLibraryFiles()) ||
|
||||
|
||||
(compilerWorkspaceSettings != null &&
|
||||
(isModified(enablePreciseIncrementalCheckBox, compilerWorkspaceSettings.getPreciseIncrementalEnabled()) ||
|
||||
(isModified(enableIncrementalCompilationForJvmCheckBox, compilerWorkspaceSettings.getPreciseIncrementalEnabled()) ||
|
||||
isModified(enableIncrementalCompilationForJsCheckBox, compilerWorkspaceSettings.getIncrementalCompilationForJsEnabled()) ||
|
||||
isModified(keepAliveCheckBox, compilerWorkspaceSettings.getEnableDaemon()))) ||
|
||||
|
||||
isModified(generateSourceMapsCheckBox, k2jsCompilerArguments.getSourceMap()) ||
|
||||
@@ -528,7 +530,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
getScriptingSettings().setAutoReloadEnabled(scriptDependenciesAutoReload.isSelected());
|
||||
|
||||
if (compilerWorkspaceSettings != null) {
|
||||
compilerWorkspaceSettings.setPreciseIncrementalEnabled(enablePreciseIncrementalCheckBox.isSelected());
|
||||
compilerWorkspaceSettings.setPreciseIncrementalEnabled(enableIncrementalCompilationForJvmCheckBox.isSelected());
|
||||
compilerWorkspaceSettings.setIncrementalCompilationForJsEnabled(enableIncrementalCompilationForJsCheckBox.isSelected());
|
||||
|
||||
boolean oldEnableDaemon = compilerWorkspaceSettings.getEnableDaemon();
|
||||
compilerWorkspaceSettings.setEnableDaemon(keepAliveCheckBox.isSelected());
|
||||
@@ -579,7 +582,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
||||
outputDirectory.setText(compilerSettings.getOutputDirectoryForJsLibraryFiles());
|
||||
|
||||
if (compilerWorkspaceSettings != null) {
|
||||
enablePreciseIncrementalCheckBox.setSelected(compilerWorkspaceSettings.getPreciseIncrementalEnabled());
|
||||
enableIncrementalCompilationForJvmCheckBox.setSelected(compilerWorkspaceSettings.getPreciseIncrementalEnabled());
|
||||
enableIncrementalCompilationForJsCheckBox.setSelected(compilerWorkspaceSettings.getIncrementalCompilationForJsEnabled());
|
||||
keepAliveCheckBox.setSelected(compilerWorkspaceSettings.getEnableDaemon());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user