Fix KAPT cli tests on windows

- Fix line separator issue
- Always quote args with delimiters (=, :)
- fix one of args files by removing obsolete stdlib reference
- Fix kotlinc.bat to ensure lazy evaluation of additional classpath
This commit is contained in:
Ivan Gavrilovic
2020-12-04 17:42:50 +00:00
committed by max-kammerer
parent 82ad230e0d
commit 078aa18479
4 changed files with 12 additions and 4 deletions
@@ -25,7 +25,7 @@ abstract class AbstractArgumentParsingTest : TestCase() {
val before = sections.single { it.name == "before" }
val messageCollector = TestMessageCollector()
val transformedArgs = transformArgs(before.content.split(LINE_SEPARATOR), messageCollector, isTest = true)
val transformedArgs = transformArgs(before.content.lines(), messageCollector, isTest = true)
val actualAfter = if (messageCollector.hasErrors()) messageCollector.toString() else transformedArgs.joinToString(LINE_SEPARATOR)
val actual = sections.replacingSection("after", actualAfter).render()
@@ -103,7 +103,14 @@ abstract class AbstractKaptToolIntegrationTest : TestCaseWithTmpdir() {
}
private fun transformArguments(args: List<String>): List<String> {
return args.map { it.replace("%KOTLIN_STDLIB%", File("dist/kotlinc/lib/kotlin-stdlib.jar").absolutePath) }
return args.map {
val arg = it.replace("%KOTLIN_STDLIB%", File("dist/kotlinc/lib/kotlin-stdlib.jar").absolutePath)
if (SystemInfo.isWindows && (arg.contains("=") || arg.contains(":"))) {
"\"" + arg + "\""
} else {
arg
}
}
}
private fun getJdk8Home(): File {
@@ -4,5 +4,5 @@
-Kapt-classpath=output/ap
-Kapt-processors=apt.SampleApt
-d output/classes
-cp output/ap:%KOTLIN_STDLIB%
-cp output/ap
Test.kt