Pill: Update options passed in test configurations

This commit is contained in:
Yan Zhulanow
2021-10-13 01:34:55 +09:00
committed by TeamCityServer
parent 1f2508c177
commit cb74247f8f
4 changed files with 21 additions and 8 deletions
@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.jps=true -Didea.home.path=$IDEA_HOME_PATH$" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1600m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.platform.prefix=Idea -Didea.is.unit.test=true -Didea.ignore.disabled.plugins=true -Didea.home.path=$IDEA_HOME_PATH$ -Duse.jps=true -Djava.awt.headless=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
@@ -7,7 +7,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -Djna.nosys=true -Duse.jps=true -Dkotlin.js.skipMinificationTest=false" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1600m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.platform.prefix=Idea -Didea.is.unit.test=true -Didea.ignore.disabled.plugins=true -Didea.home.path=$IDEA_HOME_PATH$ -Duse.jps=true -Djava.awt.headless=true -Dkotlin.js.skipMinificationTest=false" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
@@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.jps=true -Didea.home.path=$IDEA_HOME_PATH$" />
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1600m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.platform.prefix=Idea -Didea.is.unit.test=true -Didea.ignore.disabled.plugins=true -Didea.home.path=$IDEA_HOME_PATH$ -Duse.jps=true -Djava.awt.headless=true" />
<option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="PASS_PARENT_ENVS" value="true" />
@@ -245,18 +245,31 @@ class JpsCompatiblePluginTasks(
.map { it.trim() }
.filter { it.isNotEmpty() }
fun addOrReplaceOptionValue(name: String, value: Any?) {
val optionsWithoutNewValue = options.filter { !it.startsWith("-D$name=") }
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("-D$name=$value"))
fun addOptionIfAbsent(name: String) {
if (options.none { it == name }) {
options = options + name
}
}
if (options.none { it == "-ea" }) {
options = options + "-ea"
fun addOrReplaceOptionValue(name: String, value: Any?, prefix: String = "-D") {
val optionsWithoutNewValue = options.filter { !it.startsWith("$prefix$name=") }
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("$prefix$name=$value"))
}
addOptionIfAbsent("-ea")
addOptionIfAbsent("-XX:+HeapDumpOnOutOfMemoryError")
addOptionIfAbsent("-Xmx1600m")
addOptionIfAbsent("-XX:+UseCodeCacheFlushing")
addOrReplaceOptionValue("ReservedCodeCacheSize", "128m", prefix = "-XX:")
addOrReplaceOptionValue("jna.nosys", "true")
addOrReplaceOptionValue("idea.platform.prefix", "Idea")
addOrReplaceOptionValue("idea.is.unit.test", "true")
addOrReplaceOptionValue("idea.ignore.disabled.plugins", "true")
addOrReplaceOptionValue("idea.home.path", platformDirProjectRelative)
addOrReplaceOptionValue("use.jps", "true")
addOrReplaceOptionValue("kotlinVersion", project.rootProject.extra["kotlinVersion"].toString())
addOrReplaceOptionValue("java.awt.headless", "true")
val isAndroidStudioBunch = project.findProperty("versions.androidStudioRelease") != null
addOrReplaceOptionValue("idea.platform.prefix", if (isAndroidStudioBunch) "AndroidStudio" else null)