Add optional compilation start plugin option + remove exitProcess

This commit is contained in:
Tamas Vajk
2021-11-09 16:06:57 +01:00
committed by Ian Lynagh
parent 6fb5854589
commit 69e8db06cb
3 changed files with 31 additions and 15 deletions

View File

@@ -23,6 +23,13 @@ class KotlinExtractorCommandLineProcessor : CommandLineProcessor {
description = "Check whether different invocations produce identical TRAP",
required = false,
allowMultipleOccurrences = false
),
CliOption(
optionName = OPTION_COMPILATION_STARTTIME,
valueDescription = "The start time of the compilation as a Unix timestamp",
description = "The start time of the compilation as a Unix timestamp",
required = false,
allowMultipleOccurrences = false
)
)
@@ -31,13 +38,18 @@ class KotlinExtractorCommandLineProcessor : CommandLineProcessor {
value: String,
configuration: CompilerConfiguration
) = when (option.optionName) {
"invocationTrapFile" -> configuration.put(KEY_INVOCATION_TRAP_FILE, value)
"checkTrapIdentical" ->
OPTION_INVOCATION_TRAP_FILE -> configuration.put(KEY_INVOCATION_TRAP_FILE, value)
OPTION_CHECK_TRAP_IDENTICAL ->
when (value) {
"true" -> configuration.put(KEY_CHECK_TRAP_IDENTICAL, true)
"false" -> configuration.put(KEY_CHECK_TRAP_IDENTICAL, false)
else -> error("kotlin extractor: Bad argument $value for checkTrapIdentical")
"true" -> configuration.put(KEY_CHECK_TRAP_IDENTICAL, true)
"false" -> configuration.put(KEY_CHECK_TRAP_IDENTICAL, false)
else -> error("kotlin extractor: Bad argument $value for $OPTION_CHECK_TRAP_IDENTICAL")
}
OPTION_COMPILATION_STARTTIME ->
when (val v = value.toLongOrNull()) {
is Long -> configuration.put(KEY_COMPILATION_STARTTIME, v)
else -> error("kotlin extractor: Bad argument $value for $OPTION_COMPILATION_STARTTIME")
}
else -> error("kotlin extractor: Bad option: ${option.optionName}")
}
}
@@ -46,3 +58,5 @@ private val OPTION_INVOCATION_TRAP_FILE = "invocationTrapFile"
val KEY_INVOCATION_TRAP_FILE = CompilerConfigurationKey<String>(OPTION_INVOCATION_TRAP_FILE)
private val OPTION_CHECK_TRAP_IDENTICAL = "checkTrapIdentical"
val KEY_CHECK_TRAP_IDENTICAL= CompilerConfigurationKey<Boolean>(OPTION_CHECK_TRAP_IDENTICAL)
private val OPTION_COMPILATION_STARTTIME = "compilationStartTime"
val KEY_COMPILATION_STARTTIME= CompilerConfigurationKey<Long>(OPTION_COMPILATION_STARTTIME)