201: Trick idea home path exception with custom idea.home variable
This commit is contained in:
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.cli.common.messages.*
|
|||||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
|
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.INFO
|
||||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING
|
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.STRONG_WARNING
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException
|
import org.jetbrains.kotlin.cli.jvm.compiler.CompileEnvironmentException
|
||||||
|
import org.jetbrains.kotlin.cli.jvm.compiler.setupIdeaStandaloneExecution
|
||||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature.Kind.BUG_FIX
|
import org.jetbrains.kotlin.config.LanguageFeature.Kind.BUG_FIX
|
||||||
import org.jetbrains.kotlin.config.LanguageFeature.State.ENABLED
|
import org.jetbrains.kotlin.config.LanguageFeature.State.ENABLED
|
||||||
@@ -204,6 +205,9 @@ abstract class CLITool<A : CommonToolArguments> {
|
|||||||
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
|
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
|
||||||
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
|
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setupIdeaStandaloneExecution()
|
||||||
|
|
||||||
val exitCode = doMainNoExit(compiler, args)
|
val exitCode = doMainNoExit(compiler, args)
|
||||||
if (exitCode != ExitCode.OK) {
|
if (exitCode != ExitCode.OK) {
|
||||||
exitProcess(exitCode.code)
|
exitProcess(exitCode.code)
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
fun createForProduction(
|
fun createForProduction(
|
||||||
parentDisposable: Disposable, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles
|
parentDisposable: Disposable, configuration: CompilerConfiguration, configFiles: EnvironmentConfigFiles
|
||||||
): KotlinCoreEnvironment {
|
): KotlinCoreEnvironment {
|
||||||
|
setupIdeaStandaloneExecution()
|
||||||
val appEnv = getOrCreateApplicationEnvironmentForProduction(parentDisposable, configuration)
|
val appEnv = getOrCreateApplicationEnvironmentForProduction(parentDisposable, configuration)
|
||||||
val projectEnv = ProjectEnvironment(parentDisposable, appEnv)
|
val projectEnv = ProjectEnvironment(parentDisposable, appEnv)
|
||||||
val environment = KotlinCoreEnvironment(projectEnv, configuration, configFiles)
|
val environment = KotlinCoreEnvironment(projectEnv, configuration, configFiles)
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||||
|
|
||||||
|
fun setupIdeaStandaloneExecution() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.cli.jvm.compiler
|
||||||
|
|
||||||
|
fun setupIdeaStandaloneExecution() {
|
||||||
|
System.getProperties().setProperty("idea.home.path", System.getProperty("java.io.tmpdir"))
|
||||||
|
System.getProperties().setProperty("project.structure.add.tools.jar.to.new.jdk", "false")
|
||||||
|
System.getProperties().setProperty("psi.track.invalidation", "true")
|
||||||
|
System.getProperties().setProperty("psi.incremental.reparse.depth.limit", "1000")
|
||||||
|
System.getProperties().setProperty("ide.hide.excluded.files", "false")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user