[kotlin gradle plugin] enable to work with embedded k/n compiler.

This commit is contained in:
Vasily Levchenko
2021-07-09 14:39:46 +02:00
committed by Space
parent 1eb951749d
commit 2baf344f5f
8 changed files with 38 additions and 5 deletions
@@ -50,6 +50,12 @@ class SerializationGradleSubplugin :
override fun getPluginArtifactForNative(): SubpluginArtifact? =
SubpluginArtifact(SERIALIZATION_GROUP_NAME, SERIALIZATION_ARTIFACT_UNSHADED_NAME)
override fun getPluginArtifactForNative(project: Project): SubpluginArtifact? =
if (project.isNativeEmbedded)
getPluginArtifact()
else getPluginArtifactForNative()
override fun getCompilerPluginId() = "org.jetbrains.kotlinx.serialization"
//region Stub implementation for legacy API, KT-39809
@@ -63,4 +69,9 @@ class SerializationGradleSubplugin :
"Please use an older version of kotlin-serialization or upgrade the Kotlin Gradle plugin version to make them match."
)
//endregion
// TODO: find better place (see org.jetbrains.kotlin.compilerRunner.KotlinNativeToolRunner.isNativeEmbedded)
private val Project.isNativeEmbedded: Boolean
get() = findProperty("kotlin.native.shaded")?.toString()?.toBoolean() == true
}