[AA] Refactoring: Rename KtModuleFactory to KtTestModuleFactory
^KT-65960
This commit is contained in:
committed by
Space Team
parent
3f04604187
commit
4ea3de1760
+1
-1
@@ -28,7 +28,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.CodeFragment
|
||||
*/
|
||||
object KtCodeFragmentModuleFactory : KtModuleFactory {
|
||||
object KtCodeFragmentTestModuleFactory : KtTestModuleFactory {
|
||||
override fun createModule(
|
||||
testModule: TestModule,
|
||||
contextModule: KtTestModule?,
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.LibraryBinaryDecompiled
|
||||
*/
|
||||
object KtLibraryBinaryDecompiledModuleFactory : KtLibraryBinaryModuleFactoryBase() {
|
||||
object KtLibraryBinaryDecompiledTestModuleFactory : KtLibraryBinaryTestModuleFactoryBase() {
|
||||
override val testModuleKind: TestModuleKind
|
||||
get() = TestModuleKind.LibraryBinaryDecompiled
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.LibraryBinary
|
||||
*/
|
||||
object KtLibraryBinaryModuleFactory : KtLibraryBinaryModuleFactoryBase() {
|
||||
object KtLibraryBinaryTestModuleFactory : KtLibraryBinaryTestModuleFactoryBase() {
|
||||
override val testModuleKind: TestModuleKind
|
||||
get() = TestModuleKind.LibraryBinary
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.nio.file.Path
|
||||
|
||||
abstract class KtLibraryBinaryModuleFactoryBase : KtModuleFactory {
|
||||
abstract class KtLibraryBinaryTestModuleFactoryBase : KtTestModuleFactory {
|
||||
protected abstract val testModuleKind: TestModuleKind
|
||||
|
||||
protected abstract fun decompileToPsiFiles(binaryRoot: Path, testServices: TestServices, project: Project): List<PsiFile>
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.LibrarySource
|
||||
*/
|
||||
object KtLibrarySourceModuleFactory : KtModuleFactory {
|
||||
object KtLibrarySourceTestModuleFactory : KtTestModuleFactory {
|
||||
override fun createModule(
|
||||
testModule: TestModule,
|
||||
contextModule: KtTestModule?,
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.ScriptSource
|
||||
*/
|
||||
object KtScriptModuleFactory : KtModuleFactory {
|
||||
object KtScriptTestModuleFactory : KtTestModuleFactory {
|
||||
override fun createModule(
|
||||
testModule: TestModule,
|
||||
contextModule: KtTestModule?,
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.nio.file.Path
|
||||
/**
|
||||
* @see TestModuleKind.Source
|
||||
*/
|
||||
object KtSourceModuleFactory : KtModuleFactory {
|
||||
object KtSourceTestModuleFactory : KtTestModuleFactory {
|
||||
override fun createModule(
|
||||
testModule: TestModule,
|
||||
contextModule: KtTestModule?,
|
||||
+13
-13
@@ -13,9 +13,9 @@ import org.jetbrains.kotlin.test.services.TestService
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import java.nio.file.Path
|
||||
|
||||
fun interface KtModuleFactory : TestService {
|
||||
fun interface KtTestModuleFactory : TestService {
|
||||
/**
|
||||
* Creates a [KtModule](org.jetbrains.kotlin.analysis.project.structure.KtModule) for the given [testModule].
|
||||
* Creates a [KtTestModule] for the given [testModule].
|
||||
*
|
||||
* @param contextModule a module to use as a context module. Some kinds of modules (such as dangling file modules) require a
|
||||
* context module. Modules representing code fragments also require a context element. That is why the [KtTestModule] is passed
|
||||
@@ -32,13 +32,13 @@ fun interface KtModuleFactory : TestService {
|
||||
): KtTestModule
|
||||
}
|
||||
|
||||
private val TestServices.ktModuleFactory: KtModuleFactory by TestServices.testServiceAccessor()
|
||||
private val TestServices.ktTestModuleFactory: KtTestModuleFactory by TestServices.testServiceAccessor()
|
||||
|
||||
/**
|
||||
* Returns the appropriate [KtModuleFactory] to build a [KtModule][org.jetbrains.kotlin.analysis.project.structure.KtModule] for the given
|
||||
* Returns the appropriate [KtTestModuleFactory] to build a [KtModule][org.jetbrains.kotlin.analysis.project.structure.KtModule] for the given
|
||||
* [testModule].
|
||||
*
|
||||
* By default, the [KtModuleFactory] registered with these [TestServices] is returned. It may be overruled by the
|
||||
* By default, the [KtTestModuleFactory] registered with these [TestServices] is returned. It may be overruled by the
|
||||
* [MODULE_KIND][org.jetbrains.kotlin.analysis.test.framework.AnalysisApiTestDirectives.MODULE_KIND] directive for a specific test module.
|
||||
*
|
||||
* [DependencyKindModuleStructureTransformer][org.jetbrains.kotlin.analysis.test.framework.services.DependencyKindModuleStructureTransformer]
|
||||
@@ -46,13 +46,13 @@ private val TestServices.ktModuleFactory: KtModuleFactory by TestServices.testSe
|
||||
*
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.services.DependencyKindModuleStructureTransformer
|
||||
*/
|
||||
fun TestServices.getKtModuleFactoryForTestModule(testModule: TestModule): KtModuleFactory = when (testModule.explicitTestModuleKind) {
|
||||
TestModuleKind.Source -> KtSourceModuleFactory
|
||||
TestModuleKind.LibraryBinary -> KtLibraryBinaryModuleFactory
|
||||
TestModuleKind.LibraryBinaryDecompiled -> KtLibraryBinaryDecompiledModuleFactory
|
||||
TestModuleKind.LibrarySource -> KtLibrarySourceModuleFactory
|
||||
TestModuleKind.ScriptSource -> KtScriptModuleFactory
|
||||
TestModuleKind.CodeFragment -> KtCodeFragmentModuleFactory
|
||||
fun TestServices.getKtModuleFactoryForTestModule(testModule: TestModule): KtTestModuleFactory = when (testModule.explicitTestModuleKind) {
|
||||
TestModuleKind.Source -> KtSourceTestModuleFactory
|
||||
TestModuleKind.LibraryBinary -> KtLibraryBinaryTestModuleFactory
|
||||
TestModuleKind.LibraryBinaryDecompiled -> KtLibraryBinaryDecompiledTestModuleFactory
|
||||
TestModuleKind.LibrarySource -> KtLibrarySourceTestModuleFactory
|
||||
TestModuleKind.ScriptSource -> KtScriptTestModuleFactory
|
||||
TestModuleKind.CodeFragment -> KtCodeFragmentTestModuleFactory
|
||||
TestModuleKind.NotUnderContentRoot -> error("Unsupported test module kind: ${TestModuleKind.NotUnderContentRoot}")
|
||||
else -> ktModuleFactory
|
||||
else -> ktTestModuleFactory
|
||||
}
|
||||
+6
-6
@@ -20,12 +20,12 @@ import org.jetbrains.kotlin.test.model.TestModule
|
||||
*/
|
||||
enum class TestModuleKind(val suffix: String) {
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceTestModuleFactory
|
||||
*/
|
||||
Source("Source"),
|
||||
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryTestModuleFactory
|
||||
*/
|
||||
LibraryBinary("LibraryBinary"),
|
||||
|
||||
@@ -37,22 +37,22 @@ enum class TestModuleKind(val suffix: String) {
|
||||
* module. See [AbstractAnalysisApiBasedTest][org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest] for an
|
||||
* overview of "main module" and "main file".
|
||||
*
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryDecompiledModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryDecompiledTestModuleFactory
|
||||
*/
|
||||
LibraryBinaryDecompiled("LibraryBinaryDecompiled"),
|
||||
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibrarySourceModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibrarySourceTestModuleFactory
|
||||
*/
|
||||
LibrarySource("LibrarySource"),
|
||||
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtScriptModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtScriptTestModuleFactory
|
||||
*/
|
||||
ScriptSource("ScriptSource"),
|
||||
|
||||
/**
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtCodeFragmentModuleFactory
|
||||
* @see org.jetbrains.kotlin.analysis.test.framework.project.structure.KtCodeFragmentTestModuleFactory
|
||||
*/
|
||||
CodeFragment("CodeFragment"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user