Search in sources :

Example 1 with ModuleVisibilityManager

use of org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager in project kotlin by JetBrains.

the class StdlibTest method createEnvironment.

@Override
protected KotlinCoreEnvironment createEnvironment() {
    @SuppressWarnings("deprecation") File[] runtimeClasspath = ForTestCompileRuntime.runtimeClassesForTests();
    CompilerConfiguration configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.JDK_NO_RUNTIME, TestJdkKind.FULL_JDK, runtimeClasspath);
    JvmContentRootsKt.addJvmClasspathRoot(configuration, ForTestCompileRuntime.kotlinTestJarForTests());
    File junitJar = new File("libraries/lib/junit-4.11.jar");
    assertTrue(junitJar.exists());
    JvmContentRootsKt.addJvmClasspathRoot(configuration, junitJar);
    ContentRootsKt.addKotlinSourceRoot(configuration, KotlinTestUtils.getHomeDirectory() + "/libraries/stdlib/test");
    configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, new PrintingMessageCollector(System.err, MessageRenderer.PLAIN_FULL_PATHS, false));
    KotlinCoreEnvironment environment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES);
    ModuleVisibilityManager moduleVisibilityManager = ModuleVisibilityManager.SERVICE.getInstance(environment.getProject());
    for (File path : runtimeClasspath) {
        moduleVisibilityManager.addFriendPath(path.getPath());
    }
    return environment;
}
Also used : ModuleVisibilityManager(org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager) KotlinCoreEnvironment(org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment) CompilerConfiguration(org.jetbrains.kotlin.config.CompilerConfiguration) KtFile(org.jetbrains.kotlin.psi.KtFile) File(java.io.File) PrintingMessageCollector(org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector)

Aggregations

File (java.io.File)1 PrintingMessageCollector (org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector)1 KotlinCoreEnvironment (org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment)1 CompilerConfiguration (org.jetbrains.kotlin.config.CompilerConfiguration)1 ModuleVisibilityManager (org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager)1 KtFile (org.jetbrains.kotlin.psi.KtFile)1