Improve a reported message if -jdk-home path does not exist.
Fix KT-18794
This commit is contained in:
committed by
Alexander Udalov
parent
994b6d687c
commit
61e52f0bfe
@@ -407,6 +407,10 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
|
||||
val (jdkHome, classesRoots) = if (arguments.jdkHome != null) {
|
||||
val jdkHome = File(arguments.jdkHome)
|
||||
if (!jdkHome.exists()) {
|
||||
messageCollector.report(ERROR, "JDK home directory does not exist: $jdkHome")
|
||||
return COMPILATION_ERROR
|
||||
}
|
||||
messageCollector.report(LOGGING, "Using JDK home directory $jdkHome")
|
||||
jdkHome to PathUtil.getJdkClassesRoots(jdkHome)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
$TESTDATA_DIR$/simple.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-jdk-home
|
||||
$TESTDATA_DIR$/abacaba
|
||||
@@ -0,0 +1,2 @@
|
||||
error: JDK home directory does not exist: compiler/testData/cli/jvm/abacaba
|
||||
COMPILATION_ERROR
|
||||
@@ -224,6 +224,12 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jdkPathDoesNotExist.args")
|
||||
public void testJdkPathDoesNotExist() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/jdkPathDoesNotExist.args");
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvm8Target.args")
|
||||
public void testJvm8Target() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/jvm8Target.args");
|
||||
|
||||
Reference in New Issue
Block a user