File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
main/kotlin/com/tschuchort/compiletesting
test/kotlin/com/tschuchort/compiletesting Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,10 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
506
506
if (jdkHome != null && jdkHome!! .canonicalPath != processJdkHome.canonicalPath) {
507
507
/* If a JDK home is given, try to run javac from there so it uses the same JDK
508
508
as K2JVMCompiler. Changing the JDK of the system java compiler via the
509
- "--system" and "-bootclasspath" options is not so easy. */
509
+ "--system" and "-bootclasspath" options is not so easy.
510
+ If the jdkHome is the same as the current process, we still run an in process compilation because it is
511
+ expensive to fork a process to compile.
512
+ */
510
513
log(" compiling java in a sub-process because a jdkHome is specified" )
511
514
val jdkBinFile = File (jdkHome, " bin" )
512
515
check(jdkBinFile.exists()) { " No JDK bin folder found at: ${jdkBinFile.toPath()} " }
@@ -539,7 +542,7 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
539
542
val isJavac9OrLater = isJdk9OrLater()
540
543
val javacArgs = baseJavacArgs(isJavac9OrLater).apply {
541
544
if (jdkHome == null ) {
542
- log(" jdkHome is set to null, removing booth classpath from java compilation" )
545
+ log(" jdkHome is set to null, removing boot classpath from java compilation" )
543
546
// erase bootclasspath or JDK path because no JDK was specified
544
547
if (isJavac9OrLater)
545
548
addAll(" --system" , " none" )
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ class KotlinCompilationTests {
184
184
assertThat(result.exitCode).isEqualTo(ExitCode .COMPILATION_ERROR )
185
185
assertThat(result.messages).contains(" Unable to find package java.lang" )
186
186
assertThat(result.messages).contains(
187
- " jdkHome is set to null, removing booth classpath from java compilation"
187
+ " jdkHome is set to null, removing boot classpath from java compilation"
188
188
)
189
189
}
190
190
@@ -826,7 +826,7 @@ class KotlinCompilationTests {
826
826
" jdkHome is not specified. Using system java compiler of the host process."
827
827
)
828
828
assertThat(result.messages).doesNotContain(
829
- " jdkHome is set to null, removing booth classpath from java compilation"
829
+ " jdkHome is set to null, removing boot classpath from java compilation"
830
830
)
831
831
}
832
832
@@ -855,7 +855,7 @@ class KotlinCompilationTests {
855
855
" compiling java in a sub-process because a jdkHome is specified"
856
856
)
857
857
assertThat(logs).doesNotContain(
858
- " jdkHome is set to null, removing booth classpath from java compilation"
858
+ " jdkHome is set to null, removing boot classpath from java compilation"
859
859
)
860
860
}
861
861
You can’t perform that action at this time.
0 commit comments