stubs for new components
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.lazy
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.load.java.lazy.PackageMappingProvider
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||
|
||||
public class JvmPackageMappingProvider(val env: KotlinCoreEnvironment) : PackageMappingProvider {
|
||||
override fun findPackageMembers(packageName: String): List<String> {
|
||||
val res = env.configuration.getList(CommonConfigurationKeys.CONTENT_ROOTS).
|
||||
filterIsInstance<JvmClasspathRoot>().
|
||||
map {
|
||||
env.contentRootToVirtualFile(it);
|
||||
}.filterNotNull()
|
||||
|
||||
//TODO additional filtering by package existing
|
||||
//val path = packageName.split("/")
|
||||
|
||||
val mappings = res.map {
|
||||
it.findChild("META-INF")
|
||||
}.filterNotNull().flatMap {
|
||||
it.children.filter { it.name.endsWith(ModuleMapping.MAPPING_FILE_EXT) }.toList<VirtualFile>()
|
||||
}.map {
|
||||
ModuleMapping(String(it.contentsToByteArray(), "UTF-8"))
|
||||
}
|
||||
|
||||
return mappings.map { it.findPackageParts(packageName) }.filterNotNull().flatMap { it.parts }.distinct()
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun contentRootToVirtualFile(root: JvmContentRoot): VirtualFile? {
|
||||
fun contentRootToVirtualFile(root: JvmContentRoot): VirtualFile? {
|
||||
when (root) {
|
||||
is JvmClasspathRoot -> {
|
||||
return if (root.file.isFile()) findJarRoot(root) else findLocalDirectory(root)
|
||||
@@ -242,6 +242,10 @@ public class KotlinCoreEnvironment private constructor(
|
||||
messageCollector.report(severity, message, CompilerMessageLocation.NO_LOCATION)
|
||||
}
|
||||
|
||||
public fun getJavaRoots() : List<JavaRoot> {
|
||||
return javaRoots
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private val APPLICATION_LOCK = Object()
|
||||
|
||||
+3
-1
@@ -57,6 +57,7 @@ import org.jetbrains.kotlin.resolve.BindingTraceContext;
|
||||
import org.jetbrains.kotlin.resolve.ScriptNameUtil;
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName;
|
||||
import org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM;
|
||||
import org.jetbrains.kotlin.resolve.lazy.JvmPackageMappingProvider;
|
||||
import org.jetbrains.kotlin.util.PerformanceCounter;
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths;
|
||||
|
||||
@@ -326,7 +327,8 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
environment.getSourceFiles(),
|
||||
sharedTrace,
|
||||
environment.getConfiguration().get(JVMConfigurationKeys.MODULE_IDS),
|
||||
environment.getConfiguration().get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
|
||||
environment.getConfiguration().get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS),
|
||||
new JvmPackageMappingProvider(environment)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user