mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[Kotlin] Prevent bundled JPS version from being serialized in kotlinc.xml
GitOrigin-RevId: df18dbcb8d06e57e52bdc3f7352bb7eab60fdafb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c931d935cd
commit
e5bd548bb2
@@ -94,6 +94,13 @@ abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(p
|
||||
|
||||
override fun getState() = XmlSerializer.serialize(_settings, DefaultValuesFilter)
|
||||
|
||||
/**
|
||||
* Can be used to modify the [state] after deserializing it.
|
||||
*/
|
||||
protected open fun onStateDeserialized(state: T) {
|
||||
|
||||
}
|
||||
|
||||
override fun loadState(state: Element) {
|
||||
_settings = ReflectionUtil.newInstance(_settings.javaClass).apply {
|
||||
if (this is CommonCompilerArguments) {
|
||||
@@ -101,6 +108,7 @@ abstract class BaseKotlinCompilerSettings<T : Freezable> protected constructor(p
|
||||
internalArguments = mutableListOf()
|
||||
}
|
||||
XmlSerializer.deserializeInto(this, state)
|
||||
onStateDeserialized(this)
|
||||
}
|
||||
|
||||
runReadAction {
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.util.xmlb.XmlSerializer
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.kotlin.config.JpsPluginSettings
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
@@ -40,6 +41,25 @@ class KotlinJpsPluginSettings(project: Project) : BaseKotlinCompilerSettings<Jps
|
||||
}
|
||||
}
|
||||
|
||||
override fun getState(): Element {
|
||||
// We never want to save the bundled JPS version in the kotlinc.xml, so we filter it out here.
|
||||
if (settings.version.contains("-release")) {
|
||||
update {
|
||||
version = ""
|
||||
}
|
||||
}
|
||||
return super.getState()
|
||||
}
|
||||
|
||||
override fun onStateDeserialized(state: JpsPluginSettings) {
|
||||
// Internal JPS versions are not published to Maven central, so we do not want to load them here as they
|
||||
// cannot be downloaded.
|
||||
// The empty string defaults to use the bundled JPS version, which is what the user likely expects in this case.
|
||||
if (state.version.contains("-release")) {
|
||||
state.version = ""
|
||||
}
|
||||
}
|
||||
|
||||
fun dropExplicitVersion(): Unit = setVersion("")
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user