Add a compiler option to disable default scripting plugin

This commit is contained in:
Ilya Chernikov
2018-04-05 21:41:33 +02:00
parent ccecc90130
commit cc2b244484
3 changed files with 9 additions and 1 deletions
@@ -231,6 +231,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xenable-jvm-default", description = "Allow to use '@JvmDefault' for JVM default method support")
var enableJvmDefault: Boolean by FreezableVar(false)
@Argument(value = "-Xdisable-default-scripting-plugin", description = "Do not enable scripting plugin by default")
var disableDefaultScriptingPlugin: Boolean by FreezableVar(false)
// Paths to output directories for friend modules.
var friendPaths: Array<String>? by FreezableVar(null)
@@ -232,7 +232,10 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
true
}
if (!isEmbeddable && pluginClasspaths.none { File(it).name == PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR }) {
if (!isEmbeddable &&
pluginClasspaths.none { File(it).name == PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR } &&
!arguments.disableDefaultScriptingPlugin
) {
// if scripting plugin is not enabled explicitly (probably from another path) try to enable it implicitly
val libPath = paths?.libPath ?: File(".")
val pluginJar = File(libPath, PathUtil.KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR)
+2
View File
@@ -9,6 +9,8 @@ where advanced options include:
Normalize constructor calls (disable: don't normalize; enable: normalize), default is disable
-Xdump-declarations-to=<path> Path to JSON file to dump Java to Kotlin declaration mappings
-Xenable-jvm-default Allow to use '@JvmDefault' for JVM default method support
-Xdisable-default-scripting-plugin
Do not enable scripting plugin by default
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
-Xmodule-path=<path> Paths where to find Java 9+ modules
-Xjavac-arguments=<option[,]> Java compiler arguments