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.
|
||||
if (javaw.exists() && javaw.isFile && javaw.canExecute()) javaw else File(it, "java")
|
||||
}
|
||||
val args = listOf(javaExecutable.absolutePath,
|
||||
"-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)) +
|
||||
// TODO add os detection to specify option more precisely
|
||||
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("-") } +
|
||||
COMPILER_DAEMON_CLASS_FQN +
|
||||
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.decompiler.HasCompiledKotlinInJar;
|
||||
import org.jetbrains.kotlin.idea.framework.KotlinJavaScriptLibraryDetectionUtil;
|
||||
import org.jetbrains.kotlin.rmi.kotlinr.KotlinCompilerClient;
|
||||
import org.jetbrains.kotlin.utils.PathUtil;
|
||||
|
||||
import java.io.File;
|
||||
@@ -55,20 +54,31 @@ public class PluginStartupComponent implements ApplicationComponent {
|
||||
|
||||
private String aliveFlagPath;
|
||||
|
||||
public String getAliveFlagPath() {
|
||||
if (aliveFlagPath == null) {
|
||||
public synchronized String getAliveFlagPath() {
|
||||
if (this.aliveFlagPath == null) {
|
||||
try {
|
||||
File flagFile = File.createTempFile("kotlin-idea-", "-is-running");
|
||||
flagFile.deleteOnExit();
|
||||
aliveFlagPath = flagFile.getAbsolutePath();
|
||||
this.aliveFlagPath = flagFile.getAbsolutePath();
|
||||
}
|
||||
catch (IOException e) {
|
||||
aliveFlagPath = "";
|
||||
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
|
||||
public void disposeComponent() {}
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,12 +24,12 @@ public class KotlinBuildProcessParametersProvider(private val compilerWorkspaceS
|
||||
): BuildProcessParametersProvider() {
|
||||
override fun getVMArguments(): MutableList<String> {
|
||||
val res = arrayListOf<String>()
|
||||
if (compilerWorkspaceSettings.incrementalCompilationEnabled) {
|
||||
if (!compilerWorkspaceSettings.incrementalCompilationEnabled) {
|
||||
res.add("-Dkotlin.incremental.compilation=false")
|
||||
}
|
||||
kotlinPluginStartupComponent.aliveFlagPath.let {
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user