adding java startup parameters for headless appearance of the daemon on mac, prepared a function for resetting alive flag in kotlin plugin startup component as a temporary solution to stop daemon from idea, fixing code that disable incremental compilation, that was broken on the last modification of KotlinBuildProcessParametersProvider
This commit is contained in:
@@ -276,8 +276,10 @@ public object KotlinCompilerClient {
|
|||||||
// TODO: doesn't seem reliable enough, consider more checks if OS is of windows flavor, etc.
|
// TODO: doesn't seem reliable enough, consider more checks if OS is of windows flavor, etc.
|
||||||
if (javaw.exists() && javaw.isFile && javaw.canExecute()) javaw else File(it, "java")
|
if (javaw.exists() && javaw.isFile && javaw.canExecute()) javaw else File(it, "java")
|
||||||
}
|
}
|
||||||
val args = listOf(javaExecutable.absolutePath,
|
// TODO add os detection to specify option more precisely
|
||||||
"-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)) +
|
val platformSpecificOptions = listOf("-Djava.awt.headless=true") // hide daemon in OS X
|
||||||
|
val args = listOf(javaExecutable.absolutePath, "-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)) +
|
||||||
|
platformSpecificOptions +
|
||||||
daemonJVMOptions.mappers.flatMap { it.toArgs("-") } +
|
daemonJVMOptions.mappers.flatMap { it.toArgs("-") } +
|
||||||
COMPILER_DAEMON_CLASS_FQN +
|
COMPILER_DAEMON_CLASS_FQN +
|
||||||
daemonOptions.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
daemonOptions.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.idea.caches.JarUserDataManager;
|
|||||||
import org.jetbrains.kotlin.idea.debugger.filter.DebuggerFiltersUtilKt;
|
import org.jetbrains.kotlin.idea.debugger.filter.DebuggerFiltersUtilKt;
|
||||||
import org.jetbrains.kotlin.idea.decompiler.HasCompiledKotlinInJar;
|
import org.jetbrains.kotlin.idea.decompiler.HasCompiledKotlinInJar;
|
||||||
import org.jetbrains.kotlin.idea.framework.KotlinJavaScriptLibraryDetectionUtil;
|
import org.jetbrains.kotlin.idea.framework.KotlinJavaScriptLibraryDetectionUtil;
|
||||||
import org.jetbrains.kotlin.rmi.kotlinr.KotlinCompilerClient;
|
|
||||||
import org.jetbrains.kotlin.utils.PathUtil;
|
import org.jetbrains.kotlin.utils.PathUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -55,20 +54,31 @@ public class PluginStartupComponent implements ApplicationComponent {
|
|||||||
|
|
||||||
private String aliveFlagPath;
|
private String aliveFlagPath;
|
||||||
|
|
||||||
public String getAliveFlagPath() {
|
public synchronized String getAliveFlagPath() {
|
||||||
if (aliveFlagPath == null) {
|
if (this.aliveFlagPath == null) {
|
||||||
try {
|
try {
|
||||||
File flagFile = File.createTempFile("kotlin-idea-", "-is-running");
|
File flagFile = File.createTempFile("kotlin-idea-", "-is-running");
|
||||||
flagFile.deleteOnExit();
|
flagFile.deleteOnExit();
|
||||||
aliveFlagPath = flagFile.getAbsolutePath();
|
this.aliveFlagPath = flagFile.getAbsolutePath();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
aliveFlagPath = "";
|
this.aliveFlagPath = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.aliveFlagPath;
|
return this.aliveFlagPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void resetAliveFlag() {
|
||||||
|
if (this.aliveFlagPath != null) {
|
||||||
|
File flagFile = new File(this.aliveFlagPath);
|
||||||
|
if (flagFile.exists()) {
|
||||||
|
if (flagFile.delete()) {
|
||||||
|
this.aliveFlagPath = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disposeComponent() {}
|
public void disposeComponent() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -24,12 +24,12 @@ public class KotlinBuildProcessParametersProvider(private val compilerWorkspaceS
|
|||||||
): BuildProcessParametersProvider() {
|
): BuildProcessParametersProvider() {
|
||||||
override fun getVMArguments(): MutableList<String> {
|
override fun getVMArguments(): MutableList<String> {
|
||||||
val res = arrayListOf<String>()
|
val res = arrayListOf<String>()
|
||||||
if (compilerWorkspaceSettings.incrementalCompilationEnabled) {
|
if (!compilerWorkspaceSettings.incrementalCompilationEnabled) {
|
||||||
res.add("-Dkotlin.incremental.compilation=false")
|
res.add("-Dkotlin.incremental.compilation=false")
|
||||||
}
|
}
|
||||||
kotlinPluginStartupComponent.aliveFlagPath.let {
|
kotlinPluginStartupComponent.aliveFlagPath.let {
|
||||||
if (!it.isBlank()) {
|
if (!it.isBlank()) {
|
||||||
// TODO: cosider taking the property name from compiler/rmi-interface (check whether dependency will be not too heavy)
|
// TODO: consider taking the property name from compiler/rmi-interface (check whether dependency will be not too heavy)
|
||||||
res.add("-Dkotlin.daemon.client.alive.path=$it")
|
res.add("-Dkotlin.daemon.client.alive.path=$it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user