Don't use global state for keeping incremental compilation state
Previously IC state was stored in System properties. As result parallel compilation might cause incorrect state of IC, what led to corruption of kotlin_module files. Now IC state is stored via CompilerArguments and CompilerConfiguration #KT-46038 Fixed
This commit is contained in:
@@ -372,7 +372,7 @@ class MultifileClassCodegenImpl(
|
||||
private fun getCompiledPackageFragment(
|
||||
facadeFqName: FqName, state: GenerationState
|
||||
): IncrementalPackageFragmentProvider.IncrementalMultifileClassPackageFragment? {
|
||||
if (!IncrementalCompilation.isEnabledForJvm()) return null
|
||||
if (!state.isIncrementalCompilation) return null
|
||||
|
||||
val packageFqName = facadeFqName.parent()
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ class GenerationState private constructor(
|
||||
val isIrBackend: Boolean,
|
||||
val ignoreErrors: Boolean,
|
||||
val diagnosticReporter: DiagnosticReporter,
|
||||
val isIncrementalCompilation: Boolean
|
||||
) {
|
||||
class Builder(
|
||||
private val project: Project,
|
||||
@@ -129,13 +130,16 @@ class GenerationState private constructor(
|
||||
fun diagnosticReporter(v: DiagnosticReporter) =
|
||||
apply { diagnosticReporter = v }
|
||||
|
||||
val isIncrementalCompilation: Boolean = configuration.getBoolean(CommonConfigurationKeys.INCREMENTAL_COMPILATION)
|
||||
|
||||
fun build() =
|
||||
GenerationState(
|
||||
project, builderFactory, module, bindingContext, files, configuration,
|
||||
generateDeclaredClassFilter, codegenFactory, targetId,
|
||||
moduleName, outDirectory, onIndependentPartCompilationEnd, wantsDiagnostics,
|
||||
jvmBackendClassResolver, isIrBackend, ignoreErrors,
|
||||
diagnosticReporter ?: DiagnosticReporterFactory.createReporter()
|
||||
diagnosticReporter ?: DiagnosticReporterFactory.createReporter(),
|
||||
isIncrementalCompilation
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user