CLI: support "arg=value" for argument's deprecatedName
#KT-51093 Fixed
This commit is contained in:
+7
-16
@@ -87,29 +87,20 @@ private fun <A : CommonToolArguments> parsePreprocessedCommandLineArguments(args
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
val deprecatedName = argument.deprecatedName.takeUnless(String::isEmpty)
|
val deprecatedName = argument.deprecatedName
|
||||||
if (deprecatedName == arg) {
|
if (deprecatedName.isNotEmpty() && (deprecatedName == arg || arg.startsWith("$deprecatedName="))) {
|
||||||
errors.deprecatedArguments[deprecatedName] = argument.value
|
errors.deprecatedArguments[deprecatedName] = argument.value
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argument.isAdvanced) {
|
if (argument.value == arg) {
|
||||||
if (argument.value == arg) {
|
if (argument.isAdvanced && property.returnType.classifier != Boolean::class) {
|
||||||
if (property.returnType.classifier != Boolean::class) {
|
errors.extraArgumentsPassedInObsoleteForm.add(arg)
|
||||||
errors.extraArgumentsPassedInObsoleteForm.add(arg)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
if (deprecatedName != null && arg.startsWith("$deprecatedName=")) {
|
|
||||||
errors.deprecatedArguments[deprecatedName] = argument.value
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return arg.startsWith(argument.value + "=")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return argument.value == arg || arg.startsWith(argument.value + "=")
|
return arg.startsWith(argument.value + "=")
|
||||||
}
|
}
|
||||||
|
|
||||||
val freeArgs = ArrayList<String>()
|
val freeArgs = ArrayList<String>()
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
warning: flag is not supported by this version of the compiler: -Xopt-in=kotlin.RequiresOptIn
|
warning: argument -Xopt-in is deprecated. Please use -opt-in instead
|
||||||
warning: opt-in requirement marker org.test.Warning is deprecated. Warning
|
warning: opt-in requirement marker org.test.Warning is deprecated. Warning
|
||||||
OK
|
OK
|
||||||
|
|||||||
Reference in New Issue
Block a user