diff --git a/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/Main.kt b/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/Main.kt index 67ab6854cba..a1faab9b8ab 100644 --- a/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/Main.kt +++ b/compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner/Main.kt @@ -42,6 +42,7 @@ object Main { var collectingExpressions = false var needsCompiler = false val arguments = arrayListOf() + val compilerArguments = arrayListOf() var expression: String? = null var noReflect = false @@ -103,6 +104,10 @@ object Main { } else if ("-no-reflect" == arg) { noReflect = true + compilerArguments.add(arg) + } + else if (arg.startsWith("-X")) { + compilerArguments.add(arg) } else if (arg.startsWith("-")) { throw RunnerException("unsupported argument: $arg") @@ -146,7 +151,7 @@ object Main { } } - runner.run(classpath, arguments, compilerClasspath) + runner.run(classpath, compilerArguments, arguments, compilerClasspath) } private fun MutableList.addPath(path: String) { @@ -167,19 +172,21 @@ object Main { private fun printUsageAndExit() { println("""kotlin: run Kotlin programs, scripts or REPL. -Usage: kotlin +Usage: kotlin [] where command may be one of: foo.Bar Runs the 'main' function from the class with the given qualified name + (compiler arguments are ignored) app.jar Runs the given JAR file as 'java -jar' would do - (-classpath argument is ignored and no Kotlin runtime is added to the classpath) -""" + -// script.kts Compiles and runs the given script -// -expression (-e) '2+2' Evaluates the expression and prints the result -"""and possible options include: + (compiler arguments are ignored and no Kotlin stdlib is added to the classpath) + script.kts Compiles and runs the given script, passing to it + -expression (-e) '2+2' Evaluates the expression and prints the result, passing to it + Runs Kotlin REPL, passing to it +and possible options include: -classpath (-cp) Paths where to find user class files -Dname=value Set a system JVM property -J