[AA] Use MODULE_KIND in standalone API multi-module binary tests
- `MODULE_KIND` is a more general and straight-forward approach than an "app" magic module name. ^KT-64468
This commit is contained in:
committed by
Space Team
parent
d3d21b3f34
commit
43a3f7db5f
+1
-15
@@ -10,12 +10,10 @@ import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiBaseTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiLibraryBaseTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
|
||||
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.configureOptionalTestCompilerPlugin
|
||||
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryBinaryModuleFactory
|
||||
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.TestModuleStructureFactory
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.configuration.AnalysisApiJvmEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.DispatchingTestModuleCompiler
|
||||
@@ -25,14 +23,12 @@ import org.jetbrains.kotlin.analysis.test.framework.services.libraries.TestModul
|
||||
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.model.DependencyKind
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.preprocessors.ExternalAnnotationsSourcePreprocessor
|
||||
import org.jetbrains.kotlin.test.services.TestModuleStructure
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.configuration.ExternalAnnotationsEnvironmentConfigurator
|
||||
|
||||
object StandaloneModeLibraryBinaryTestConfigurator : StandaloneModeConfiguratorBase() {
|
||||
|
||||
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
|
||||
with(builder) {
|
||||
configureOptionalTestCompilerPlugin()
|
||||
@@ -40,7 +36,7 @@ object StandaloneModeLibraryBinaryTestConfigurator : StandaloneModeConfiguratorB
|
||||
useConfigurators(::ExternalAnnotationsEnvironmentConfigurator)
|
||||
useSourcePreprocessor(::ExternalAnnotationsSourcePreprocessor)
|
||||
|
||||
useAdditionalService<KtModuleFactory> { KtCombinedModuleFactory() }
|
||||
useAdditionalService<KtModuleFactory> { KtLibraryBinaryModuleFactory }
|
||||
useAdditionalService<TestModuleCompiler> { DispatchingTestModuleCompiler() }
|
||||
useAdditionalService<TestModuleDecompiler> { TestModuleDecompilerJar() }
|
||||
|
||||
@@ -64,13 +60,3 @@ object StandaloneModeLibraryBinaryTestConfigurator : StandaloneModeConfiguratorB
|
||||
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
|
||||
}
|
||||
}
|
||||
|
||||
private class KtCombinedModuleFactory : KtModuleFactory {
|
||||
override fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles {
|
||||
return if (testModule.name == "app") {
|
||||
KtSourceModuleFactory.createModule(testModule, testServices, project)
|
||||
} else {
|
||||
KtLibraryBinaryModuleFactory.createModule(testModule, testServices, project)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ package my.collections
|
||||
fun <K, V> myMapOf(vararg pairs: Pair<K, V>): Map<K, V> = mapOf(*pairs)
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
import my.collections.*
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
Vendored
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
analysis/analysis-api/testData/standalone/multiModuleBinary/propertiesInCompanionObject_JvmStatic.kt
Vendored
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ class Outer {
|
||||
}
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
Vendored
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ class Dependency {
|
||||
val DEPENDENCY_TOP_LEVEL_VAL_FLAG: Flag<*> = TODO()
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ class Outer {
|
||||
}
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -11,6 +11,7 @@ object DependencyObject {
|
||||
}
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
+1
@@ -16,6 +16,7 @@ class Outer {
|
||||
}
|
||||
|
||||
// MODULE: app(lib)
|
||||
// MODULE_KIND: Source
|
||||
// FILE: main.kt
|
||||
|
||||
package some
|
||||
|
||||
Reference in New Issue
Block a user