Kotlin Facet: Detect module platform by 'kotlin'/'kotlin2js' plugin
This commit is contained in:
@@ -49,6 +49,10 @@ class KotlinGradleModelBuilder : ModelBuilderService {
|
||||
val kotlinCompileTaskClasses = listOf("org.jetbrains.kotlin.gradle.tasks.KotlinCompile_Decorated",
|
||||
"org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile_Decorated")
|
||||
val platformPluginIds = listOf("kotlin-platform-jvm", "kotlin-platform-js", "kotlin-platform-common")
|
||||
val pluginToPlatform = linkedMapOf(
|
||||
"kotlin" to "kotlin-platform-jvm",
|
||||
"kotlin2js" to "kotlin-platform-js"
|
||||
)
|
||||
}
|
||||
|
||||
override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder {
|
||||
@@ -126,12 +130,15 @@ class KotlinGradleModelBuilder : ModelBuilderService {
|
||||
collectCompilerArguments(compileTask, "getDefaultSerializedCompilerArguments", defaultCompilerArgumentsBySourceSet)
|
||||
}
|
||||
|
||||
val platform = platformPluginIds.singleOrNull { project.plugins.findPlugin(it) != null }
|
||||
?: pluginToPlatform.entries.singleOrNull { project.plugins.findPlugin(it.key) != null }?.value
|
||||
|
||||
return KotlinGradleModelImpl(
|
||||
getImplements(project),
|
||||
currentCompilerArgumentsBySourceSet,
|
||||
defaultCompilerArgumentsBySourceSet,
|
||||
getCoroutines(project),
|
||||
platformPluginIds.singleOrNull { project.plugins.findPlugin(it) != null }
|
||||
platform
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user