Remove obsolete compiler argument -Xsingle-module

#KT-51622
This commit is contained in:
Alexander Udalov
2022-08-26 13:16:00 +02:00
parent abaffeddab
commit a76de14026
6 changed files with 9 additions and 37 deletions
@@ -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)"
@@ -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<KtFile>,
@@ -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<StorageComponentContainer, Unit>?
val dependencyModule = if (separateModules) {
val dependencyModule = run {
val dependenciesContext = ContextForNewModule(
moduleContext, Name.special("<dependencies of ${configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME)}>"),
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(
@@ -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)
@@ -58,9 +58,6 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> USE_TYPE_TABLE =
CompilerConfigurationKey.create("use type table in serializer");
public static final CompilerConfigurationKey<Boolean> USE_SINGLE_MODULE =
CompilerConfigurationKey.create("combine modules for source files and binary dependencies into a single module");
public static final CompilerConfigurationKey<JvmTarget> JVM_TARGET =
CompilerConfigurationKey.create("JVM bytecode target version");
-1
View File
@@ -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}
@@ -150,7 +150,6 @@ class CompilerArgumentsContentProspectorTest {
K2JVMCompilerArguments::inheritMultifileParts,
K2JVMCompilerArguments::useTypeTable,
K2JVMCompilerArguments::useOldClassFilesReading,
K2JVMCompilerArguments::singleModule,
K2JVMCompilerArguments::suppressMissingBuiltinsError,
K2JVMCompilerArguments::useJavac,
K2JVMCompilerArguments::compileJava,