Minor: add more logging in KotlinBuilder
This commit is contained in:
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollectorUtil
|
||||
import org.jetbrains.kotlin.config.CompilerSettings
|
||||
import org.jetbrains.kotlin.jps.build.KotlinBuilder
|
||||
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCompilationComponents
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.rmi.*
|
||||
@@ -108,6 +109,7 @@ public object KotlinCompilerRunner {
|
||||
|
||||
if (!tryCompileWithDaemon(compilerClassName, argsArray, environment, messageCollector, collector)) {
|
||||
// otherwise fallback to in-process
|
||||
KotlinBuilder.LOG.info("Compile in-process")
|
||||
|
||||
val stream = ByteArrayOutputStream()
|
||||
val out = PrintStream(stream)
|
||||
@@ -176,9 +178,12 @@ public object KotlinCompilerRunner {
|
||||
|
||||
if (isDaemonEnabled()) {
|
||||
|
||||
KotlinBuilder.LOG.debug("Try to connect to daemon")
|
||||
val connection = getDaemonConnection(environment, messageCollector)
|
||||
|
||||
if (connection?.daemon != null) {
|
||||
KotlinBuilder.LOG.info("Connected to daemon")
|
||||
|
||||
val compilerOut = ByteArrayOutputStream()
|
||||
val daemonOut = ByteArrayOutputStream()
|
||||
|
||||
@@ -199,6 +204,8 @@ public object KotlinCompilerRunner {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
KotlinBuilder.LOG.info("Daemon not found")
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledException
|
||||
import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.rmi.isDaemonEnabled
|
||||
import org.jetbrains.kotlin.utils.LibraryUtils
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
@@ -91,6 +92,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
LOG.debug("==========================================")
|
||||
LOG.info("is Kotlin incremental compilation enabled: ${IncrementalCompilation.isEnabled()}")
|
||||
LOG.info("is Kotlin experimental incremental compilation enabled: ${IncrementalCompilation.isExperimental()}")
|
||||
LOG.info("is Kotlin compiler daemon enabled: ${isDaemonEnabled()}")
|
||||
|
||||
val historyLabel = context.getBuilderParameter("history label")
|
||||
if (historyLabel != null) {
|
||||
@@ -108,12 +110,17 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
val messageCollector = MessageCollectorAdapter(context)
|
||||
|
||||
try {
|
||||
return doBuild(chunk, context, dirtyFilesHolder, messageCollector, outputConsumer)
|
||||
val result = doBuild(chunk, context, dirtyFilesHolder, messageCollector, outputConsumer)
|
||||
LOG.debug("Build result: " + result)
|
||||
return result
|
||||
}
|
||||
catch (e: StopBuildException) {
|
||||
LOG.debug("Caught exception: " + e)
|
||||
throw e
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
LOG.debug("Caught exception: " + e)
|
||||
|
||||
messageCollector.report(
|
||||
CompilerMessageSeverity.EXCEPTION,
|
||||
OutputMessageUtil.renderException(e),
|
||||
|
||||
Reference in New Issue
Block a user