Kotlin Facet: Support "implements" relation between modules

#KT-17593 Fixed

Original commit: bdad58cec6
This commit is contained in:
Alexey Sedunov
2017-08-15 19:00:47 +03:00
parent 8a6ed0dac4
commit 17601aacb5
2 changed files with 9 additions and 0 deletions
@@ -149,6 +149,8 @@ class KotlinFacetSettings {
LanguageFeature.State.ENABLED_WITH_ERROR, LanguageFeature.State.DISABLED -> CommonCompilerArguments.ERROR
}
}
var implementedModuleName: String? = null
}
fun TargetPlatformKind<*>.createCompilerArguments(init: CommonCompilerArguments.() -> Unit = {}): CommonCompilerArguments {
@@ -22,6 +22,7 @@ import com.intellij.util.xmlb.SkipDefaultsSerializationFilter
import com.intellij.util.xmlb.XmlSerializer
import org.jdom.DataConversionException
import org.jdom.Element
import org.jdom.Text
import org.jetbrains.kotlin.cli.common.arguments.*
import org.jetbrains.kotlin.load.java.JvmAbi
import java.lang.reflect.Modifier
@@ -95,6 +96,9 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings {
element.getAttributeValue("useProjectSettings")?.let { useProjectSettings = it.toBoolean() }
val platformName = element.getAttributeValue("platform")
val platformKind = TargetPlatformKind.ALL_PLATFORMS.firstOrNull { it.description == platformName } ?: TargetPlatformKind.DEFAULT_PLATFORM
element.getChild("implements")?.let {
implementedModuleName = (element.content.firstOrNull() as? Text)?.textTrim
}
element.getChild("compilerSettings")?.let {
compilerSettings = CompilerSettings()
XmlSerializer.deserializeInto(compilerSettings!!, it)
@@ -224,6 +228,9 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
if (!useProjectSettings) {
element.setAttribute("useProjectSettings", useProjectSettings.toString())
}
implementedModuleName?.let {
element.addContent(Element("implements").apply { addContent(it) })
}
compilerSettings?.let { copyBean(it) }?.let {
it.convertPathsToSystemIndependent()
buildChildElement(element, "compilerSettings", it, filter)