[lombok] Resolve to absolute path when import from maven
#KT-46723 Fixed
This commit is contained in:
committed by
teamcityserver
parent
2680111125
commit
e82857996f
+11
-2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.lombok.ide
|
||||
|
||||
import org.jetbrains.idea.maven.project.MavenProject
|
||||
import org.jetbrains.kotlin.lombok.LombokCommandLineProcessor
|
||||
import org.jetbrains.kotlin.lombok.LombokCommandLineProcessor.Companion.CONFIG_FILE_OPTION
|
||||
import org.jetbrains.kotlin.plugin.ide.AbstractMavenImportHandler
|
||||
@@ -18,6 +19,7 @@ class LombokMavenProjectImportHandler : AbstractMavenImportHandler() {
|
||||
override val pluginJarFileFromIdea: File = PathUtil.kotlinPathsForIdeaPlugin.lombokPluginJarPath
|
||||
|
||||
override fun getOptions(
|
||||
mavenProject: MavenProject,
|
||||
enabledCompilerPlugins: List<String>,
|
||||
compilerPluginOptions: List<String>
|
||||
): List<PluginOption>? {
|
||||
@@ -25,14 +27,21 @@ class LombokMavenProjectImportHandler : AbstractMavenImportHandler() {
|
||||
|
||||
return compilerPluginOptions.mapNotNull { option ->
|
||||
if (option.startsWith(CONFIG_FILE_PREFIX)) {
|
||||
val location = option.substring(CONFIG_FILE_PREFIX.length)
|
||||
PluginOption(CONFIG_FILE_OPTION.optionName, location)
|
||||
val location = File(option.substring(CONFIG_FILE_PREFIX.length))
|
||||
val correctedLocation =
|
||||
if (!location.isAbsolute) File(mavenProject.directory, location.path)
|
||||
else location
|
||||
PluginOption(CONFIG_FILE_OPTION.optionName, correctedLocation.absolutePath)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getOptions(enabledCompilerPlugins: List<String>, compilerPluginOptions: List<String>): List<PluginOption>? {
|
||||
throw NotImplementedError("Shouldn't be called")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val MAVEN_SUBPLUGIN_NAME = "lombok"
|
||||
private val CONFIG_FILE_PREFIX = "$MAVEN_SUBPLUGIN_NAME:${CONFIG_FILE_OPTION.optionName}="
|
||||
|
||||
Reference in New Issue
Block a user