Gradle: Import production output path for JavaScript modules

Original commit: 1f7fab837f
This commit is contained in:
Alexey Sedunov
2018-01-24 16:27:02 +03:00
parent 0f68c3017a
commit 1577239e4d
2 changed files with 9 additions and 0 deletions
@@ -194,6 +194,7 @@ class KotlinFacetSettings {
var implementedModuleName: String? = null
var productionOutputPath: String? = null
var testOutputPath: String? = null
}
@@ -110,6 +110,9 @@ private fun readV2AndLaterConfig(element: Element): KotlinFacetSettings {
XmlSerializer.deserializeInto(compilerArguments!!, it)
compilerArguments!!.detectVersionAutoAdvance()
}
productionOutputPath = element.getChild("productionOutputPath")?.let {
PathUtil.toSystemDependentName((it.content.firstOrNull() as? Text)?.textTrim)
} ?: (compilerArguments as? K2JSCompilerArguments)?.outputFile
testOutputPath = element.getChild("testOutputPath")?.let {
PathUtil.toSystemDependentName((it.content.firstOrNull() as? Text)?.textTrim)
} ?: (compilerArguments as? K2JSCompilerArguments)?.outputFile
@@ -237,6 +240,11 @@ private fun KotlinFacetSettings.writeLatestConfig(element: Element) {
implementedModuleName?.let {
element.addContent(Element("implements").apply { addContent(it) })
}
productionOutputPath?.let {
if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) {
element.addContent(Element("productionOutputPath").apply { addContent(PathUtil.toSystemIndependentName(it)) })
}
}
testOutputPath?.let {
if (it != (compilerArguments as? K2JSCompilerArguments)?.outputFile) {
element.addContent(Element("testOutputPath").apply { addContent(PathUtil.toSystemIndependentName(it)) })