Allow to run scratch without module selected
^KT-23985 Fixed
This commit is contained in:
@@ -54,7 +54,7 @@ class KotlinConsoleKeeper(val project: Project) {
|
||||
companion object {
|
||||
@JvmStatic fun getInstance(project: Project) = ServiceManager.getService(project, KotlinConsoleKeeper::class.java)
|
||||
|
||||
fun createCommandLine(module: Module): GeneralCommandLine {
|
||||
fun createCommandLine(module: Module?): GeneralCommandLine {
|
||||
val javaParameters = createJavaParametersWithSdk(module)
|
||||
|
||||
javaParameters.mainClass = "dummy"
|
||||
@@ -79,16 +79,18 @@ class KotlinConsoleKeeper(val project: Project) {
|
||||
|
||||
paramList.add("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
|
||||
|
||||
addPathToCompiledOutput(paramList, module)
|
||||
if (module != null) {
|
||||
addPathToCompiledOutput(paramList, module)
|
||||
}
|
||||
|
||||
return commandLine
|
||||
}
|
||||
|
||||
fun createJavaParametersWithSdk(module: Module): JavaParameters {
|
||||
fun createJavaParametersWithSdk(module: Module?): JavaParameters {
|
||||
val params = JavaParameters()
|
||||
params.charset = null
|
||||
|
||||
val sdk = ModuleRootManager.getInstance(module).sdk
|
||||
val sdk = module?.let { ModuleRootManager.getInstance(module).sdk }
|
||||
if (sdk != null && sdk.sdkType is JavaSdkType && File(sdk.homePath).exists()) {
|
||||
params.jdk = sdk
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user