[AA] Enable test-specific configuration of write access permissions

- In general, Analysis API tests forbid write access because the
  Analysis API should not be used from write actions. However, in some
  cases we might want tests to e.g. modify PSI, which requires write
  access. This change allows `AnalysisApiTestConfigurator`s to enable
  write access for the specific test.
This commit is contained in:
Marco Pennekamp
2023-11-13 15:17:59 +01:00
committed by Space Team
parent 6189d68c3c
commit 03a7162f37
7 changed files with 108 additions and 32 deletions
@@ -69,14 +69,15 @@ object StandaloneProjectFactory {
fun createProjectEnvironment(
projectDisposable: Disposable,
applicationDisposable: Disposable,
unitTestMode: Boolean = false,
applicationEnvironmentMode: KotlinCoreApplicationEnvironmentMode,
compilerConfiguration: CompilerConfiguration = CompilerConfiguration(),
classLoader: ClassLoader = MockProject::class.java.classLoader,
): KotlinCoreProjectEnvironment {
val applicationEnvironment = if (unitTestMode)
KotlinCoreEnvironment.getOrCreateApplicationEnvironmentForTests(applicationDisposable, compilerConfiguration)
else
KotlinCoreEnvironment.getOrCreateApplicationEnvironmentForProduction(applicationDisposable, compilerConfiguration)
val applicationEnvironment = KotlinCoreEnvironment.getOrCreateApplicationEnvironment(
applicationDisposable,
compilerConfiguration,
applicationEnvironmentMode,
)
registerApplicationExtensionPoints(applicationEnvironment, applicationDisposable)