CLI: improve error message if libraries are not found in Kotlin home

Also support the '-kotlin-home' argument in kotlinc-js

 #KT-18859 Fixed
This commit is contained in:
Alexander Udalov
2017-07-05 21:47:27 +03:00
parent eb673d6ed3
commit 1e6850f198
16 changed files with 158 additions and 42 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ where possible options include:
-output-postfix <path> Path to file which will be added to the end of output file
-language-version <version> Provide source compatibility with specified language version
-api-version <version> Allow to use declarations only from the specified version of bundled libraries
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
-P plugin:<pluginId>:<optionName>=<value>
Pass an option to a plugin
-help (-h) Print a synopsis of standard options
@@ -25,4 +26,4 @@ where possible options include:
-version Display compiler version
-verbose Enable verbose logging output
-nowarn Generate no warnings
OK
OK
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/simple2js.kt
-kotlin-home
$TESTDATA_DIR$
-output
$TEMP_DIR$/out.js
+2
View File
@@ -0,0 +1,2 @@
warning: unable to find kotlin-stdlib-js.jar in the Kotlin home directory. Pass either '-no-stdlib' to prevent adding it to the classpath, or the correct '-kotlin-home'
OK
+5
View File
@@ -0,0 +1,5 @@
$TESTDATA_DIR$/simple2js.kt
-kotlin-home
non-existing-path
-output
$TEMP_DIR$/out.js
+2
View File
@@ -0,0 +1,2 @@
error: Kotlin home does not exist or is not a directory: non-existing-path
COMPILATION_ERROR
+1 -1
View File
@@ -10,12 +10,12 @@ where possible options include:
-script Evaluate the script file
-script-templates <fully qualified class name[,]>
Script definition template classes
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
-module-name Module name
-jvm-target <version> Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6
-java-parameters Generate metadata for Java 1.8 reflection on method parameters
-language-version <version> Provide source compatibility with specified language version
-api-version <version> Allow to use declarations only from the specified version of bundled libraries
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
-P plugin:<pluginId>:<optionName>=<value>
Pass an option to a plugin
-help (-h) Print a synopsis of standard options
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/simple.kt
-kotlin-home
$TESTDATA_DIR$
+10
View File
@@ -0,0 +1,10 @@
warning: unable to find kotlin-stdlib.jar in the Kotlin home directory. Pass either '-no-stdlib' to prevent adding it to the classpath, or the correct '-kotlin-home'
warning: unable to find kotlin-script-runtime.jar in the Kotlin home directory. Pass either '-no-stdlib' to prevent adding it to the classpath, or the correct '-kotlin-home'
warning: unable to find kotlin-reflect.jar in the Kotlin home directory. Pass either '-no-reflect' or '-no-stdlib' to prevent adding it to the classpath, or the correct '-kotlin-home'
compiler/testData/cli/jvm/simple.kt:1:16: error: unresolved reference: Array
fun main(args: Array<String>) = println("hello world")
^
compiler/testData/cli/jvm/simple.kt:1:33: error: unresolved reference: println
fun main(args: Array<String>) = println("hello world")
^
COMPILATION_ERROR