From edc730f70b9a3057f4835757a772c08ccdf7373c Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Mon, 4 Jan 2021 16:01:53 +0100 Subject: [PATCH] Implement -no-stdlib argument support in kotlin runner #KT-43294 fixed --- .../cli-runner/src/org/jetbrains/kotlin/runner/Main.kt | 10 +++++++++- .../org/jetbrains/kotlin/cli/LauncherScriptTest.kt | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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 a1faab9b8ab..cbbccaa7d6b 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 @@ -44,6 +44,7 @@ object Main { val arguments = arrayListOf() val compilerArguments = arrayListOf() var expression: String? = null + var noStdLib = false var noReflect = false fun setExpression(expr: String) { @@ -102,6 +103,10 @@ object Main { collectingExpressions = true needsCompiler = true } + else if ("-no-stdlib" == arg) { + noStdLib = true + compilerArguments.add(arg) + } else if ("-no-reflect" == arg) { noReflect = true compilerArguments.add(arg) @@ -132,7 +137,9 @@ object Main { classpath.addPath(".") } - classpath.addPath("$KOTLIN_HOME/lib/kotlin-stdlib.jar") + if (!noStdLib) { + classpath.addPath("$KOTLIN_HOME/lib/kotlin-stdlib.jar") + } if (!noReflect) { classpath.addPath("$KOTLIN_HOME/lib/kotlin-reflect.jar") @@ -185,6 +192,7 @@ and possible options include: -classpath (-cp) Paths where to find user class files -Dname=value Set a system JVM property -J