diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt index dc215c63ba5..0df0a51f2cd 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt @@ -200,9 +200,6 @@ class K2JVMCompilerArguments : CommonCompilerArguments() { ) var declarationsOutputPath: String? by NullableStringFreezableVar(null) - @Argument(value = "-Xsingle-module", description = "Combine modules for source files and binary dependencies into a single module") - var singleModule: Boolean by FreezableVar(false) - @Argument( value = "-Xsuppress-missing-builtins-error", description = "Suppress the \"cannot access built-in declaration\" error (useful with -no-stdlib)" diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/TopDownAnalyzerFacadeForJVM.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/TopDownAnalyzerFacadeForJVM.kt index 65ef320a425..1db8412623f 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/TopDownAnalyzerFacadeForJVM.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/TopDownAnalyzerFacadeForJVM.kt @@ -45,8 +45,8 @@ import org.jetbrains.kotlin.frontend.java.di.initJvmBuiltInsForTopDownAnalysis import org.jetbrains.kotlin.frontend.java.di.initialize import org.jetbrains.kotlin.incremental.components.EnumWhenTracker import org.jetbrains.kotlin.incremental.components.ExpectActualTracker -import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.incremental.components.InlineConstTracker +import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.ir.backend.jvm.jvmLibrariesProvidedByDefault import org.jetbrains.kotlin.javac.components.JavacBasedClassFinder import org.jetbrains.kotlin.javac.components.JavacBasedSourceElementFactory @@ -80,7 +80,6 @@ import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory import org.jetbrains.kotlin.resolve.lazy.declarations.FileBasedDeclarationProviderFactory import org.jetbrains.kotlin.storage.LockBasedStorageManager import org.jetbrains.kotlin.storage.StorageManager -import java.util.* import kotlin.reflect.KFunction1 object TopDownAnalyzerFacadeForJVM { @@ -135,7 +134,6 @@ object TopDownAnalyzerFacadeForJVM { return AnalysisResult.success(trace.bindingContext, module) } - @OptIn(ExperimentalStdlibApi::class) fun createContainer( project: Project, files: Collection, @@ -167,10 +165,7 @@ object TopDownAnalyzerFacadeForJVM { val enumWhenTracker = configuration.get(CommonConfigurationKeys.ENUM_WHEN_TRACKER) ?: EnumWhenTracker.DoNothing val targetIds = configuration.get(JVMConfigurationKeys.MODULES)?.map(::TargetId) - val separateModules = !configuration.getBoolean(JVMConfigurationKeys.USE_SINGLE_MODULE) - - val sourceScope = if (separateModules) sourceModuleSearchScope else GlobalSearchScope.allScope(project) - val moduleClassResolver = SourceOrBinaryModuleClassResolver(sourceScope) + val moduleClassResolver = SourceOrBinaryModuleClassResolver(sourceModuleSearchScope) val fallbackBuiltIns = JvmBuiltIns(storageManager, JvmBuiltIns.Kind.FALLBACK).apply { initialize(builtInsModule, languageVersionSettings) @@ -187,14 +182,14 @@ object TopDownAnalyzerFacadeForJVM { if (configuration.getBoolean(JVMConfigurationKeys.USE_JAVAC)) StorageComponentContainer::useJavac else null as KFunction1? - val dependencyModule = if (separateModules) { + val dependencyModule = run { val dependenciesContext = ContextForNewModule( moduleContext, Name.special(""), module.builtIns, jvmPlatform ) // Scope for the dependency module contains everything except files present in the scope for the source module - val dependencyScope = GlobalSearchScope.notScope(sourceScope) + val dependencyScope = GlobalSearchScope.notScope(sourceModuleSearchScope) val dependenciesContainer = createContainerForLazyResolveWithJava( jvmPlatform, @@ -220,9 +215,9 @@ object TopDownAnalyzerFacadeForJVM { ) ) dependenciesContext.module - } else null + } - val partProvider = packagePartProvider(sourceScope).let { fragment -> + val partProvider = packagePartProvider(sourceModuleSearchScope).let { fragment -> if (targetIds == null || incrementalComponents == null) fragment else IncrementalPackagePartProvider(fragment, targetIds.map(incrementalComponents::getIncrementalCache)) } @@ -233,7 +228,7 @@ object TopDownAnalyzerFacadeForJVM { // TODO: get rid of duplicate invocation of CodeAnalyzerInitializer#initialize, or refactor CliLightClassGenerationSupport val container = createContainerForLazyResolveWithJava( jvmPlatform, - moduleContext, trace, declarationProviderFactory(storageManager, files), sourceScope, moduleClassResolver, + moduleContext, trace, declarationProviderFactory(storageManager, files), sourceModuleSearchScope, moduleClassResolver, targetEnvironment, lookupTracker, expectActualTracker, inlineConstTracker, enumWhenTracker, partProvider, languageVersionSettings, useBuiltInsProvider = true, @@ -267,23 +262,9 @@ object TopDownAnalyzerFacadeForJVM { val klibModules = getKlibModules(klibList, dependencyModule) // TODO: remove dependencyModule from friends - val dependencies = buildList { - add(module) - dependencyModule?.let { add(it) } - add(fallbackBuiltIns) - addAll(klibModules) - @Suppress("UNCHECKED_CAST") - addAll(explicitModuleDependencyList) - } - val friends = buildSet { - if (dependencyModule != null) { - add(dependencyModule) - } - addAll(explicitModuleFriendsList) - } module.setDependencies( - dependencies, - friends + listOf(module, dependencyModule, fallbackBuiltIns) + klibModules + explicitModuleDependencyList, + setOf(dependencyModule) + explicitModuleFriendsList, ) module.initialize( CompositePackageFragmentProvider( diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt index 16dd1bccf60..b79173f4c54 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/jvmArguments.kt @@ -338,7 +338,6 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage) put(CLIConfigurationKeys.RENDER_DIAGNOSTIC_INTERNAL_NAME, arguments.renderInternalDiagnosticNames) - put(JVMConfigurationKeys.USE_SINGLE_MODULE, arguments.singleModule) put(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME, arguments.useOldInlineClassesManglingScheme) put(JVMConfigurationKeys.ENABLE_JVM_PREVIEW, arguments.enableJvmPreview) diff --git a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java index 64a736ca0cd..f8642829f32 100644 --- a/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java +++ b/compiler/config.jvm/src/org/jetbrains/kotlin/config/JVMConfigurationKeys.java @@ -58,9 +58,6 @@ public class JVMConfigurationKeys { public static final CompilerConfigurationKey USE_TYPE_TABLE = CompilerConfigurationKey.create("use type table in serializer"); - public static final CompilerConfigurationKey USE_SINGLE_MODULE = - CompilerConfigurationKey.create("combine modules for source files and binary dependencies into a single module"); - public static final CompilerConfigurationKey JVM_TARGET = CompilerConfigurationKey.create("JVM bytecode target version"); diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index c21bd4383d9..139d6f1f1a1 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -124,7 +124,6 @@ where advanced options include: Script resolver environment in key-value pairs (the value could be quoted and escaped) -Xserialize-ir={none|inline|all} Save IR to metadata (EXPERIMENTAL) - -Xsingle-module Combine modules for source files and binary dependencies into a single module -Xgenerate-strict-metadata-version Generate metadata with strict version semantics (see kdoc on Metadata.extraInt) -Xstring-concat={indy-with-constants|indy|inline} diff --git a/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt b/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt index 835ca24883e..39c87f7def8 100644 --- a/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt +++ b/jps/jps-common/test/CompilerArgumentsContentProspectorTest.kt @@ -150,7 +150,6 @@ class CompilerArgumentsContentProspectorTest { K2JVMCompilerArguments::inheritMultifileParts, K2JVMCompilerArguments::useTypeTable, K2JVMCompilerArguments::useOldClassFilesReading, - K2JVMCompilerArguments::singleModule, K2JVMCompilerArguments::suppressMissingBuiltinsError, K2JVMCompilerArguments::useJavac, K2JVMCompilerArguments::compileJava,