[AA] Turn KtModuleWithFiles into KtTestModule (AA test framework)

- `KtModuleWithFiles` isn't actually used in a production Standalone API
  context, but it was exposed via `analysis-api-standalone-base`. In
  current production usages, the project structure is built with the
  module builder DSL.
- Hence, `KtModuleWithFiles` is only relevant for tests. This commit
  moves `KtModuleWithFiles` to the Analysis API test framework and
  renames it to `KtTestModule`. This removes any risk that an outside
  user could start using `KtModuleWithFiles` and completely uncouples
  the test project structure from production APIs.
- In addition, we can add the `TestModule` to `KtTestModule`, allowing
  tests to quickly access the original test module, for example to check
  the test module kind.
- The commit also removes the data class status of `KtTestModule` and
  `KtTestModuleProjectStructure` to avoid issues with destructuring when
  properties are added or removed.

^KT-65960
This commit is contained in:
Marco Pennekamp
2024-02-20 20:37:23 +01:00
committed by Space Team
parent 878eba7d52
commit 2060709c03
23 changed files with 128 additions and 115 deletions
@@ -10,9 +10,9 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiBaseTestServiceRegistrar
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiDecompiledCodeTestServiceRegistrar
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtTestModuleProjectStructure
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.services.configuration.AnalysisApiBinaryLibraryIndexingMode
import org.jetbrains.kotlin.analysis.test.framework.services.configuration.AnalysisApiJvmEnvironmentConfigurator
@@ -63,7 +63,7 @@ object AnalysisApiFe10TestConfigurator : AnalysisApiTestConfigurator() {
moduleStructure: TestModuleStructure,
testServices: TestServices,
project: Project,
): KtModuleProjectStructure {
): KtTestModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
}