Pill: Rewrite existing "idea.home.path" option if already set
This commit is contained in:
@@ -190,10 +190,15 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
|||||||
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
|
getOrCreateChild("option", "name" to "VM_PARAMETERS").also { vmParams ->
|
||||||
val ideaHomePathOptionKey = "-Didea.home.path="
|
val ideaHomePathOptionKey = "-Didea.home.path="
|
||||||
val ideaHomePathOption = ideaHomePathOptionKey + platformDirProjectRelative
|
val ideaHomePathOption = ideaHomePathOptionKey + platformDirProjectRelative
|
||||||
val existingOptions = vmParams.getAttributeValue("value", "").split(' ')
|
|
||||||
if (existingOptions.none { it.startsWith(ideaHomePathOptionKey) }) {
|
val existingOptions = vmParams.getAttributeValue("value", "")
|
||||||
vmParams.setAttribute("value", (vmParams.getAttributeValue("value", "") + " " + ideaHomePathOption).trim())
|
.split(' ')
|
||||||
}
|
.map { it.trim() }
|
||||||
|
.filter { it.isNotEmpty() && !it.startsWith(ideaHomePathOptionKey) }
|
||||||
|
|
||||||
|
val newOptions = existingOptions.joinToString(" ") + " " + ideaHomePathOption
|
||||||
|
|
||||||
|
vmParams.setAttribute("value", newOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user