Temporary restore generation state and related PSI-based APIs
Changes required on IDE plugin side before applying API changes.
This commit is contained in:
@@ -368,4 +368,10 @@ public class ClassFileFactory implements OutputFileCollection {
|
|||||||
generators.remove(classInternalName + ".class");
|
generators.remove(classInternalName + ".class");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove after cleanin up IDE counterpart
|
||||||
|
@TestOnly
|
||||||
|
public List<KtFile> getInputFiles() {
|
||||||
|
return state.getFiles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.progress.ProgressIndicatorAndCompilationCanceledStat
|
|||||||
import org.jetbrains.kotlin.psi.KtFile;
|
import org.jetbrains.kotlin.psi.KtFile;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class KotlinCodegenFacade {
|
public class KotlinCodegenFacade {
|
||||||
public static void compileCorrectFiles(
|
public static void compileCorrectFiles(
|
||||||
@@ -49,6 +48,12 @@ public class KotlinCodegenFacade {
|
|||||||
state.getFactory().done();
|
state.getFactory().done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: remove after cleanin up IDE counterpart
|
||||||
|
public static void compileCorrectFiles(@NotNull GenerationState state) {
|
||||||
|
CodegenFactory codegenFactory = state.getCodegenFactory();
|
||||||
|
compileCorrectFiles(state.getFiles(), state, codegenFactory != null ? codegenFactory : DefaultCodegenFactory.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
public static void generatePackage(@NotNull GenerationState state, @NotNull FqName packageFqName, @NotNull Collection<KtFile> files) {
|
public static void generatePackage(@NotNull GenerationState state, @NotNull FqName packageFqName, @NotNull Collection<KtFile> files) {
|
||||||
DefaultCodegenFactory.INSTANCE.generatePackage(state, packageFqName, files);
|
DefaultCodegenFactory.INSTANCE.generatePackage(state, packageFqName, files);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,18 @@ class GenerationState private constructor(
|
|||||||
private val bindingContext: BindingContext,
|
private val bindingContext: BindingContext,
|
||||||
private val configuration: CompilerConfiguration
|
private val configuration: CompilerConfiguration
|
||||||
) {
|
) {
|
||||||
|
// TODO: patch IntelliJ project and remove this compatibility c-tor
|
||||||
|
constructor(
|
||||||
|
project: Project,
|
||||||
|
builderFactory: ClassBuilderFactory,
|
||||||
|
module: ModuleDescriptor,
|
||||||
|
bindingContext: BindingContext,
|
||||||
|
files: List<KtFile>,
|
||||||
|
configuration: CompilerConfiguration
|
||||||
|
) : this(project, builderFactory, module, bindingContext, configuration) {
|
||||||
|
this.files = files
|
||||||
|
}
|
||||||
|
|
||||||
private var generateDeclaredClassFilter: GenerateClassFilter = GenerateClassFilter.GENERATE_ALL
|
private var generateDeclaredClassFilter: GenerateClassFilter = GenerateClassFilter.GENERATE_ALL
|
||||||
fun generateDeclaredClassFilter(v: GenerateClassFilter) =
|
fun generateDeclaredClassFilter(v: GenerateClassFilter) =
|
||||||
apply { generateDeclaredClassFilter = v }
|
apply { generateDeclaredClassFilter = v }
|
||||||
@@ -125,6 +137,12 @@ class GenerationState private constructor(
|
|||||||
|
|
||||||
val isIncrementalCompilation: Boolean = configuration.getBoolean(CommonConfigurationKeys.INCREMENTAL_COMPILATION)
|
val isIncrementalCompilation: Boolean = configuration.getBoolean(CommonConfigurationKeys.INCREMENTAL_COMPILATION)
|
||||||
|
|
||||||
|
// TODO: remove after cleanin up IDE counterpart
|
||||||
|
private var files: List<KtFile>? = null
|
||||||
|
private var codegenFactory: CodegenFactory? = null
|
||||||
|
fun codegenFactory(v: CodegenFactory) =
|
||||||
|
apply { codegenFactory = v }
|
||||||
|
|
||||||
fun build() =
|
fun build() =
|
||||||
GenerationState(
|
GenerationState(
|
||||||
project, builderFactory, module, bindingContext, configuration,
|
project, builderFactory, module, bindingContext, configuration,
|
||||||
@@ -133,7 +151,10 @@ class GenerationState private constructor(
|
|||||||
jvmBackendClassResolver, isIrBackend, ignoreErrors,
|
jvmBackendClassResolver, isIrBackend, ignoreErrors,
|
||||||
diagnosticReporter ?: DiagnosticReporterFactory.createReporter(),
|
diagnosticReporter ?: DiagnosticReporterFactory.createReporter(),
|
||||||
isIncrementalCompilation
|
isIncrementalCompilation
|
||||||
)
|
).also {
|
||||||
|
it.files = files
|
||||||
|
it.codegenFactory = codegenFactory
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class GenerateClassFilter {
|
abstract class GenerateClassFilter {
|
||||||
@@ -170,6 +191,10 @@ class GenerationState private constructor(
|
|||||||
LockBasedStorageManager.NO_LOCKS, languageVersionSettings, JavaDeprecationSettings
|
LockBasedStorageManager.NO_LOCKS, languageVersionSettings, JavaDeprecationSettings
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: remove after cleanin up IDE counterpart
|
||||||
|
var files: List<KtFile>? = null
|
||||||
|
var codegenFactory: CodegenFactory? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
|
val icComponents = configuration.get(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS)
|
||||||
if (icComponents != null) {
|
if (icComponents != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user