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:
committed by
Ilya Matveev
parent
affa881421
commit
de261df6f5
+6
-12
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user