File tree 2 files changed +24
-1
lines changed
main/kotlin/com/tschuchort/compiletesting
test/kotlin/com/tschuchort/compiletesting
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -361,7 +361,6 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
361
361
while (i < options.size) {
362
362
val option = options[i]
363
363
if (option.startsWith(" -" ) || option.startsWith(" --" )) {
364
- // Check if the option contains an equal sign
365
364
if (option.contains(" =" )) {
366
365
val (key, value) = option.split(" =" , limit = 2 )
367
366
result[key] = value
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import javax.annotation.processing.RoundEnvironment
17
17
import javax.lang.model.element.TypeElement
18
18
import org.mockito.kotlin.*
19
19
import java.nio.file.Path
20
+ import java.util.regex.Pattern
20
21
import kotlin.io.path.createDirectory
21
22
import kotlin.io.path.createFile
22
23
import kotlin.io.path.writeText
@@ -968,5 +969,28 @@ class KotlinCompilationTests {
968
969
assertThat(result.exitCode).isEqualTo(ExitCode .OK )
969
970
}
970
971
972
+ @Test
973
+ fun `javac arguments are passed to kapt` () {
974
+ val jSource = SourceFile .java(
975
+ " JSource.java" , """
976
+ package com.tschuchort.compiletesting;
977
+
978
+ @ProcessElem
979
+ class JSource {
980
+ }
981
+ """
982
+ )
983
+
984
+ val result = defaultCompilerConfig().apply {
985
+ sources = listOf (jSource)
986
+ annotationProcessors = listOf (kotlinTestProc)
987
+ inheritClassPath = true
988
+ javacArguments + = listOf (" -Xlint" )
989
+ }.compile()
990
+
991
+ assertThat(result.exitCode).isEqualTo(ExitCode .OK )
992
+ assertThat(result.messages).containsPattern(Pattern .compile(" \\ [kapt\\ ] All Javac options: \\ {.*?-Xlint.*?\\ }" ))
993
+ }
994
+
971
995
class InheritedClass {}
972
996
}
You can’t perform that action at this time.
0 commit comments