Fix uninitialized lateinit compilerPluginOptionsTask in non-MPP
When a non-MPP is imported into the IDE, the importer anyway tries to build the MPP source sets model, so it tries to access the `compilerPluginArguments` and `compilerPluginClasspath`, resulting in an import error. Issue #KT-27646 Fixed
This commit is contained in:
+7
-7
@@ -63,25 +63,25 @@ internal class DefaultLanguageSettingsBuilder : LanguageSettingsBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* A Kotlin task that is responsible for code analysis of the owner of this language settings builder. */
|
/* A Kotlin task that is responsible for code analysis of the owner of this language settings builder. */
|
||||||
lateinit var compilerPluginOptionsTask: Lazy<AbstractCompile>
|
var compilerPluginOptionsTask: Lazy<AbstractCompile?> = lazyOf(null)
|
||||||
|
|
||||||
val compilerPluginArguments: List<String>
|
val compilerPluginArguments: List<String>?
|
||||||
get() {
|
get() {
|
||||||
val pluginOptionsTask = compilerPluginOptionsTask.value
|
val pluginOptionsTask = compilerPluginOptionsTask.value ?: return null
|
||||||
return when (pluginOptionsTask) {
|
return when (pluginOptionsTask) {
|
||||||
is AbstractKotlinCompile<*> -> pluginOptionsTask.pluginOptions
|
is AbstractKotlinCompile<*> -> pluginOptionsTask.pluginOptions
|
||||||
is KotlinNativeCompile -> pluginOptionsTask.compilerPluginOptions
|
is KotlinNativeCompile -> pluginOptionsTask.compilerPluginOptions
|
||||||
else -> error("Unexpected task: $compilerPluginOptionsTask")
|
else -> error("Unexpected task: $pluginOptionsTask")
|
||||||
}.arguments
|
}.arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
val compilerPluginClasspath: FileCollection
|
val compilerPluginClasspath: FileCollection?
|
||||||
get() {
|
get() {
|
||||||
val pluginClasspathTask = compilerPluginOptionsTask.value
|
val pluginClasspathTask = compilerPluginOptionsTask.value ?: return null
|
||||||
return when (pluginClasspathTask) {
|
return when (pluginClasspathTask) {
|
||||||
is AbstractKotlinCompile<*> -> pluginClasspathTask.pluginClasspath
|
is AbstractKotlinCompile<*> -> pluginClasspathTask.pluginClasspath
|
||||||
is KotlinNativeCompile -> pluginClasspathTask.compilerPluginClasspath ?: pluginClasspathTask.project.files()
|
is KotlinNativeCompile -> pluginClasspathTask.compilerPluginClasspath ?: pluginClasspathTask.project.files()
|
||||||
else -> error("Unexpected task: $compilerPluginOptionsTask")
|
else -> error("Unexpected task: $pluginClasspathTask")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user