CLI, Ant: add kotlin-reflect.jar to classpath by default, support "-no-reflect"

Note that now "-no-stdlib" implies "-no-reflect".

 #KT-13237 Fixed
This commit is contained in:
Alexander Udalov
2015-10-31 15:02:55 +03:00
parent 30fd22499b
commit 0d26087040
20 changed files with 128 additions and 27 deletions
@@ -301,11 +301,16 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
private fun getClasspath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): List<File> {
val classpath = arrayListOf<File>()
if (arguments.classpath != null) {
classpath.addAll(arguments.classpath.split(File.pathSeparatorChar).map { File(it) })
classpath.addAll(arguments.classpath.split(File.pathSeparatorChar).map(::File))
}
if (!arguments.noStdlib) {
classpath.add(paths.runtimePath)
}
// "-no-stdlib" implies "-no-reflect": otherwise we would be able to transitively read stdlib classes through kotlin-reflect,
// which is likely not what user wants since s/he manually provided "-no-stdlib"
if (!arguments.noReflect && !arguments.noStdlib) {
classpath.add(paths.reflectPath)
}
return classpath
}