Use separate configuration for resolving native compiler plugin artifacts

Kotlin/JVM and Kotlin/JS use shaded compiler, but
Kotlin/Native uses non-shaded one.
Serialization plugin was configured to use either shaded or non-shaded
plugin version, because we used one configuration for resolving
compiler plugins.
This change introduces 'kotlinNativeCompilerPluginClasspath' configuration
for resolving Kotlin/Native compiler plugins.
This commit is contained in:
Alexey Tsvetkov
2018-09-21 23:27:05 +03:00
committed by Ilya Matveev
parent affa881421
commit de261df6f5
6 changed files with 26 additions and 18 deletions
@@ -42,14 +42,8 @@ class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlin-serialization-unshaded"
}
private var useUnshaded = false
override fun isApplicable(project: Project, task: AbstractCompile): Boolean {
if (!SerializationGradleSubplugin.isEnabled(project)) return false
// Kotlin/Native task is not an AbstractKotlinCompile and uses unshaded compiler
if (task !is AbstractKotlinCompile<*>) useUnshaded = true
return true
}
override fun isApplicable(project: Project, task: AbstractCompile): Boolean =
SerializationGradleSubplugin.isEnabled(project)
override fun apply(
project: Project,
@@ -62,11 +56,11 @@ class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile
return emptyList()
}
override fun getPluginArtifact(): SubpluginArtifact =
SubpluginArtifact(SERIALIZATION_GROUP_NAME, SERIALIZATION_ARTIFACT_NAME)
override fun getPluginArtifact(): SubpluginArtifact {
val artifact = if (useUnshaded) SERIALIZATION_ARTIFACT_UNSHADED_NAME else SERIALIZATION_ARTIFACT_NAME
return SubpluginArtifact(SERIALIZATION_GROUP_NAME, artifact)
}
override fun getNativeCompilerPluginArtifact(): SubpluginArtifact? =
SubpluginArtifact(SERIALIZATION_GROUP_NAME, SERIALIZATION_ARTIFACT_UNSHADED_NAME)
override fun getCompilerPluginId() = "org.jetbrains.kotlinx.serialization"
}