Make serialization plugin for Maven consistent with all other plugins:
Use correct import handler because old one was not working in IDE Change maven artifact id to match pattern from other plugins
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>kotlinx-maven-serialization-plugin</artifactId>
|
||||
<artifactId>kotlin-maven-serialization</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>Serialization plugin for Maven</description>
|
||||
|
||||
@@ -13,6 +13,7 @@ dependencies {
|
||||
compile(project(":idea"))
|
||||
compile(project(":idea:idea-gradle"))
|
||||
compile(project(":idea:idea-maven"))
|
||||
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
|
||||
compileOnly(intellijDep())
|
||||
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) }
|
||||
compileOnly(intellijPluginDep("gradle"))
|
||||
|
||||
+14
-8
@@ -5,14 +5,20 @@
|
||||
|
||||
package org.jetbrains.kotlinx.serialization.idea
|
||||
|
||||
import org.jetbrains.idea.maven.project.MavenProject
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.kotlin.idea.maven.MavenProjectImportHandler
|
||||
import org.jetbrains.kotlin.annotation.plugin.ide.AbstractMavenImportHandler
|
||||
import org.jetbrains.kotlin.annotation.plugin.ide.AnnotationBasedCompilerPluginSetup
|
||||
import java.io.File
|
||||
|
||||
class KotlinSerializationMavenImportHandler: MavenProjectImportHandler {
|
||||
override fun invoke(facet: KotlinFacet, mavenProject: MavenProject) {
|
||||
KotlinSerializationImportHandler.modifyCompilerArguments(facet, PLUGIN_MAVEN_JAR)
|
||||
}
|
||||
class KotlinSerializationMavenImportHandler : AbstractMavenImportHandler() {
|
||||
override val compilerPluginId: String = "org.jetbrains.kotlinx.serialization"
|
||||
override val pluginName: String = "serialization"
|
||||
override val mavenPluginArtifactName: String = "kotlin-maven-serialization"
|
||||
override val pluginJarFileFromIdea: File
|
||||
get() = File(KotlinSerializationImportHandler.PLUGIN_JPS_JAR)
|
||||
|
||||
private val PLUGIN_MAVEN_JAR = "kotlinx-maven-serialization-plugin"
|
||||
override fun getOptions(
|
||||
enabledCompilerPlugins: List<String>,
|
||||
compilerPluginOptions: List<String>
|
||||
): List<AnnotationBasedCompilerPluginSetup.PluginOption>? =
|
||||
if ("kotlinx-serialization" in enabledCompilerPlugins) emptyList() else null
|
||||
}
|
||||
Reference in New Issue
Block a user