Skip to content

Commit

Permalink
Refine error message
Browse files Browse the repository at this point in the history
(cherry picked from commit 1ca8ca1)
  • Loading branch information
ting-yuan authored and KSP Auto Pick committed Oct 22, 2024
1 parent 36252be commit b27396c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ abstract class KspAATask @Inject constructor(
provider.asArguments().forEach { argument ->
val kv = Regex("(\\S+)=(\\S+)").matchEntire(argument)?.groupValues
require(kv != null && kv.size == 3) {
"KSP apoption does not match (\\S+)=(\\S+): $argument"
"Processor arguments not in the format \\S+=\\S+: $argument"
}
put(kv[1], kv[2])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class KspGradleSubplugin @Inject internal constructor(private val registry: Tool
providers.flatMap { provider ->
provider.asArguments().map { argument ->
require(argument.matches(Regex("\\S+=\\S+"))) {
"KSP apoption does not match \\S+=\\S+: $argument"
"Processor arguments not in the format \\S+=\\S+: $argument"
}
InternalSubpluginOption("apoption", argument)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class GradleCompilationTest {
)

val result = testRule.runner().withArguments(":app:assemble").buildAndFail()
assertThat(result.output).contains("KSP apoption does not match \\S+=\\S+: invalid")
assertThat(result.output).contains("Processor arguments not in the format \\S+=\\S+: invalid")
}

@Test
Expand Down

0 comments on commit b27396c

Please sign in to comment.