Load built-ins from module dependencies in JVM compiler

Introduce a new method KotlinClassFinder#findBuiltInsData, which is only
implemented correctly in the JvmCliVirtualFileFinder because it's only used in
the compiler code at the moment.

Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look
for .kotlin_builtins files in the classpath and provide definitions of
built-ins from those files.

Also exclude script.runtime from compilation because, as other excluded
modules, it has no dependency on the stdlib and is no longer compilable from
the IDE now, because it cannot resolve built-ins from anywhere
This commit is contained in:
Alexander Udalov
2016-10-17 18:11:38 +03:00
parent 0b59c71340
commit e0989caf46
14 changed files with 145 additions and 25 deletions
@@ -21,6 +21,8 @@ import org.jetbrains.kotlin.load.java.structure.JavaClass
import org.jetbrains.kotlin.load.kotlin.KotlinClassFinder
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import java.io.InputStream
class ReflectKotlinClassFinder(private val classLoader: ClassLoader) : KotlinClassFinder {
private fun findKotlinClass(fqName: String): KotlinJvmBinaryClass? {
@@ -33,6 +35,9 @@ class ReflectKotlinClassFinder(private val classLoader: ClassLoader) : KotlinCla
// TODO: go through javaClass's class loader
return findKotlinClass(javaClass.fqName?.asString() ?: return null)
}
// TODO: load built-ins from classLoader
override fun findBuiltInsData(packageFqName: FqName): InputStream? = null
}
private fun ClassId.toRuntimeFqName(): String {