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:
committed by
max-kammerer
parent
82ad230e0d
commit
078aa18479
@@ -49,6 +49,7 @@ if "%_KOTLIN_RUNNER%"=="1" (
|
|||||||
"%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
"%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
||||||
org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS%
|
org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS%
|
||||||
) else (
|
) else (
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
SET _ADDITIONAL_CLASSPATH=
|
SET _ADDITIONAL_CLASSPATH=
|
||||||
|
|
||||||
if not "%_KOTLIN_TOOL%"=="" (
|
if not "%_KOTLIN_TOOL%"=="" (
|
||||||
@@ -56,7 +57,7 @@ if "%_KOTLIN_RUNNER%"=="1" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
"%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
"%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
||||||
org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar%_ADDITIONAL_CLASSPATH%" ^
|
org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar!_ADDITIONAL_CLASSPATH!" ^
|
||||||
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
|
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ abstract class AbstractArgumentParsingTest : TestCase() {
|
|||||||
val before = sections.single { it.name == "before" }
|
val before = sections.single { it.name == "before" }
|
||||||
|
|
||||||
val messageCollector = TestMessageCollector()
|
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 actualAfter = if (messageCollector.hasErrors()) messageCollector.toString() else transformedArgs.joinToString(LINE_SEPARATOR)
|
||||||
val actual = sections.replacingSection("after", actualAfter).render()
|
val actual = sections.replacingSection("after", actualAfter).render()
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -103,7 +103,14 @@ abstract class AbstractKaptToolIntegrationTest : TestCaseWithTmpdir() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun transformArguments(args: List<String>): List<String> {
|
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 {
|
private fun getJdk8Home(): File {
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
-Kapt-classpath=output/ap
|
-Kapt-classpath=output/ap
|
||||||
-Kapt-processors=apt.SampleApt
|
-Kapt-processors=apt.SampleApt
|
||||||
-d output/classes
|
-d output/classes
|
||||||
-cp output/ap:%KOTLIN_STDLIB%
|
-cp output/ap
|
||||||
Test.kt
|
Test.kt
|
||||||
Reference in New Issue
Block a user