From 298a30d245842b659caf98c46e1b2b2111dd440f Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 12 Sep 2019 11:26:52 +0300 Subject: [PATCH] Minor: run javac-mode compileJava after destroying of generation state Not very important but seems more logical --- .../compiler/KotlinToJVMBytecodeCompiler.kt | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index 5b12c54d3dc..609d145dff5 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -210,27 +210,27 @@ object KotlinToJVMBytecodeCompiler { val mainClassProvider = if (outputs.size == 1) MainClassProvider(state, environment) else null writeOutput(state.configuration, state.factory, mainClassProvider) } - - if (projectConfiguration.getBoolean(JVMConfigurationKeys.COMPILE_JAVA)) { - val singleModule = chunk.singleOrNull() - if (singleModule != null) { - return JavacWrapper.getInstance(environment.project).use { - it.compile(File(singleModule.getOutputDirectory())) - } - } else { - projectConfiguration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report( - WARNING, - "A chunk contains multiple modules (${chunk.joinToString { it.getModuleName() }}). " + - "-Xuse-javac option couldn't be used to compile java files" - ) - JavacWrapper.getInstance(environment.project).close() - } - } - - return true } finally { outputs.values.forEach(GenerationState::destroy) } + + if (projectConfiguration.getBoolean(JVMConfigurationKeys.COMPILE_JAVA)) { + val singleModule = chunk.singleOrNull() + if (singleModule != null) { + return JavacWrapper.getInstance(environment.project).use { + it.compile(File(singleModule.getOutputDirectory())) + } + } else { + projectConfiguration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report( + WARNING, + "A chunk contains multiple modules (${chunk.joinToString { it.getModuleName() }}). " + + "-Xuse-javac option couldn't be used to compile java files" + ) + JavacWrapper.getInstance(environment.project).close() + } + } + + return true } internal fun configureSourceRoots(configuration: CompilerConfiguration, chunk: List, buildFile: File? = null) {