diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt index cc00fb5d2bc..b55582fdec7 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.kt @@ -66,6 +66,7 @@ import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackagePartProvid import org.jetbrains.kotlin.modules.Module import org.jetbrains.kotlin.modules.TargetId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStatus import org.jetbrains.kotlin.psi.KtFile @@ -339,7 +340,7 @@ object KotlinToJVMBytecodeCompiler { val languageVersionSettings = moduleConfiguration.languageVersionSettings val session = createSessionWithDependencies( - module, + Name.identifier(module.getModuleName()), JvmPlatforms.unspecifiedJvmPlatform, JvmPlatformAnalyzerServices, externalSessionProvider = null, @@ -357,6 +358,10 @@ object KotlinToJVMBytecodeCompiler { ) FirSessionFactory.ProviderAndScopeForIncrementalCompilation(packagePartProvider, librariesScope) }, + dependenciesConfigurator = { + dependencies(moduleConfiguration.jvmClasspathRoots.map { it.toPath() }) + friendDependencies(moduleConfiguration[JVMConfigurationKeys.FRIEND_PATHS] ?: emptyList()) + }, sessionConfigurator = { if (extendedAnalysisMode) { registerExtendedCommonCheckers() diff --git a/compiler/testData/cli/jvm/firStdlibDependency.args b/compiler/testData/cli/jvm/firStdlibDependency.args new file mode 100644 index 00000000000..160be8bc9ca --- /dev/null +++ b/compiler/testData/cli/jvm/firStdlibDependency.args @@ -0,0 +1,6 @@ +$TESTDATA_DIR$/firStdlibDependency.kt +-Xuse-fir +-cp +. +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/firStdlibDependency.kt b/compiler/testData/cli/jvm/firStdlibDependency.kt new file mode 100644 index 00000000000..fa9466f61d1 --- /dev/null +++ b/compiler/testData/cli/jvm/firStdlibDependency.kt @@ -0,0 +1 @@ +fun main() = println("hello") diff --git a/compiler/testData/cli/jvm/firStdlibDependency.out b/compiler/testData/cli/jvm/firStdlibDependency.out new file mode 100644 index 00000000000..b2e67e607be --- /dev/null +++ b/compiler/testData/cli/jvm/firStdlibDependency.out @@ -0,0 +1,4 @@ +warning: ATTENTION! + This build uses in-dev FIR: + -Xuse-fir +OK diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 34de45c2179..4e39966058b 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -316,6 +316,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/firHello.args"); } + @TestMetadata("firStdlibDependency.args") + public void testFirStdlibDependency() throws Exception { + runTest("compiler/testData/cli/jvm/firStdlibDependency.args"); + } + @TestMetadata("flagAllowingResultAsReturnType.args") public void testFlagAllowingResultAsReturnType() throws Exception { runTest("compiler/testData/cli/jvm/flagAllowingResultAsReturnType.args");