diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/KMockProcessor.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/KMockProcessor.kt index 87467418..0d7549f3 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/KMockProcessor.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/KMockProcessor.kt @@ -10,6 +10,7 @@ import com.google.devtools.ksp.processing.KSPLogger import com.google.devtools.ksp.processing.Resolver import com.google.devtools.ksp.processing.SymbolProcessor import com.google.devtools.ksp.symbol.KSAnnotated +import com.google.devtools.ksp.symbol.KSFile import com.squareup.kotlinpoet.ksp.KotlinPoetKspPreview import tech.antibytes.kmock.processor.ProcessorContract.Aggregated import tech.antibytes.kmock.processor.ProcessorContract.KmpCodeGenerator @@ -51,6 +52,10 @@ internal class KMockProcessor( return commonAggregated.extractedTemplates.isEmpty() } + private fun List.merge(toAdd: List): List { + return this.toMutableSet().also { it.addAll(toAdd) }.toList() + } + private fun mergeSources( rootSource: Aggregated, dependentSource: Aggregated, @@ -62,9 +67,7 @@ internal class KMockProcessor( extractedTemplates = rootSource.extractedTemplates.toMutableList().also { it.addAll(filteredTemplates) }, - dependencies = rootSource.dependencies.toMutableList().also { - it.addAll(dependentSource.dependencies) - } + totalDependencies = rootSource.totalDependencies.merge(dependentSource.totalDependencies) ) } @@ -125,14 +128,13 @@ internal class KMockProcessor( mockGenerator.writeCommonMocks( templateSources = singleCommonSources.extractedTemplates, templateMultiSources = commonMultiAggregated, - dependencies = singleCommonSources.dependencies, relaxer = relaxer, ) if (interfaceBinderIsApplicable(multiCommonSources.extractedTemplates)) { interfaceGenerator.bind( templateSources = multiCommonSources.extractedTemplates, - dependencies = multiCommonSources.dependencies + dependencies = multiCommonSources.totalDependencies, ) } @@ -149,18 +151,18 @@ internal class KMockProcessor( ): Aggregated { val aggregated = singleSourceAggregator.extractSharedInterfaces(resolver) val filteredInterfaces = filter.filter( - filter.filterSharedSources(aggregated.extractedTemplates), - commonAggregated.extractedTemplates + templateSources = filter.filterSharedSources(aggregated.extractedTemplates), + filteredBy = commonAggregated.extractedTemplates ) entryPointGenerator.generateShared( - filteredInterfaces, + templateSources = filteredInterfaces, + dependencies = aggregated.totalDependencies ) mockGenerator.writeSharedMocks( - filteredInterfaces, - aggregated.dependencies, - relaxer + templateSources = filteredInterfaces, + relaxer = relaxer ) return mergeSources(commonAggregated, aggregated, filteredInterfaces) @@ -173,15 +175,18 @@ internal class KMockProcessor( ): Aggregated { val aggregated = singleSourceAggregator.extractPlatformInterfaces(resolver) val filteredInterfaces = filter.filter( - aggregated.extractedTemplates, - sharedAggregated.extractedTemplates + templateSources = aggregated.extractedTemplates, + filteredBy = sharedAggregated.extractedTemplates + ) + val totalAggregated = mergeSources( + rootSource = sharedAggregated, + dependentSource = aggregated, + filteredTemplates = filteredInterfaces, ) - val totalAggregated = mergeSources(sharedAggregated, aggregated, filteredInterfaces) mockGenerator.writePlatformMocks( - filteredInterfaces, - aggregated.dependencies, - relaxer + templateSources = filteredInterfaces, + relaxer = relaxer, ) return totalAggregated @@ -201,10 +206,7 @@ internal class KMockProcessor( Pair(commonAggregated, sharedAggregated) } else { - Pair( - Aggregated(emptyList(), emptyList(), emptyList()), - Aggregated(emptyList(), emptyList(), emptyList()) - ) + Pair(EMPTY_AGGREGATED_SINGLE, EMPTY_AGGREGATED_SINGLE) } } @@ -214,11 +216,13 @@ internal class KMockProcessor( relaxer: Relaxer? ) { if (isFirstRound) { + val totalDependencies = totalAggregated.totalDependencies.merge(commonMultiAggregated.totalDependencies) + factoryGenerator.writeFactories( templateSources = totalAggregated.extractedTemplates, templateMultiSources = commonMultiAggregated.extractedTemplates, - dependencies = totalAggregated.dependencies, - relaxer = relaxer + relaxer = relaxer, + dependencies = totalDependencies ) entryPointGenerator.generateCommon( @@ -226,6 +230,7 @@ internal class KMockProcessor( templateMultiSources = commonMultiAggregated.extractedTemplates, totalTemplates = totalAggregated.extractedTemplates, totalMultiSources = commonMultiAggregated.extractedTemplates, + dependencies = totalDependencies, ) } } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/ProcessorContract.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/ProcessorContract.kt index 81e8efc4..5e67b99c 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/ProcessorContract.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/ProcessorContract.kt @@ -81,12 +81,14 @@ internal interface ProcessorContract { val indicator: String val templateName: String val packageName: String + val dependencies: List } data class TemplateSource( override val indicator: String, override val templateName: String, override val packageName: String, + override val dependencies: List, val template: KSClassDeclaration, val generics: Map>? ) : Source @@ -95,6 +97,7 @@ internal interface ProcessorContract { override val indicator: String, override val templateName: String, override val packageName: String, + override val dependencies: List, val templates: List, val generics: List>?> ) : Source @@ -102,7 +105,7 @@ internal interface ProcessorContract { data class Aggregated( val illFormed: List, val extractedTemplates: List, - val dependencies: List + val totalDependencies: List, ) interface SourceSetValidator { @@ -335,20 +338,17 @@ internal interface ProcessorContract { interface MockGenerator { fun writePlatformMocks( templateSources: List, - dependencies: List, relaxer: Relaxer? ) fun writeSharedMocks( templateSources: List, - dependencies: List, relaxer: Relaxer? ) fun writeCommonMocks( templateSources: List, templateMultiSources: Aggregated, - dependencies: List, relaxer: Relaxer? ) } @@ -435,8 +435,8 @@ internal interface ProcessorContract { fun writeFactories( templateSources: List, templateMultiSources: List, - dependencies: List, relaxer: Relaxer?, + dependencies: List, ) } @@ -444,12 +444,14 @@ internal interface ProcessorContract { fun generateCommon( templateSources: List, templateMultiSources: List, - totalMultiSources: List, totalTemplates: List, + totalMultiSources: List, + dependencies: List, ) fun generateShared( templateSources: List, + dependencies: List, ) } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregator.kt index f24bf4a1..9831bdd8 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregator.kt @@ -35,27 +35,12 @@ internal class KMockMultiSourceAggregator( private val generics: GenericResolver, private val customAnnotations: Map, ) : MultiSourceAggregator, BaseSourceAggregator(logger, customAnnotations, generics) { - private fun isPackageIndicator(char: Char) = char == '.' - - private fun resolvePackageName( - currentName: String?, - nameCandidate: String - ): String { - val currentDepth = currentName?.count(::isPackageIndicator) ?: Int.MAX_VALUE - val candidateDepth = nameCandidate.count(::isPackageIndicator) - - return if (currentDepth > candidateDepth) { - nameCandidate - } else { - currentName!! - } - } - private fun resolveInterfaces( interfaceName: String, interfaces: List, sourceIndicator: String, - templateCollector: MutableMap + dependencies: List, + templateCollector: MutableMap, ) { val interfazes: MutableList = mutableListOf() val generics: MutableList>?> = mutableListOf() @@ -72,24 +57,26 @@ internal class KMockMultiSourceAggregator( indicator = sourceIndicator, templateName = interfaceName, packageName = rootPackage, + dependencies = dependencies, templates = interfazes, - generics = generics + generics = generics, ) } private fun List.extractDeclarations(): List = this.map { type -> type.declaration } private fun resolveInterfaces( - raw: Map>>>, - templateCollector: MutableMap + raw: Map, List>>>, + templateCollector: MutableMap, ) { raw.forEach { (sourceIndicator, interfaces) -> interfaces.forEach { interfacesBundle -> resolveInterfaces( interfaceName = interfacesBundle.first, - interfaces = interfacesBundle.second.extractDeclarations(), + interfaces = interfacesBundle.third.extractDeclarations(), sourceIndicator = sourceIndicator, - templateCollector = templateCollector + dependencies = interfacesBundle.second, + templateCollector = templateCollector, ) } } @@ -117,7 +104,7 @@ internal class KMockMultiSourceAggregator( condition: (String, KSAnnotation) -> Boolean, ): Aggregated { val illAnnotated = mutableListOf() - val typeContainer = mutableMapOf>>>() + val typeContainer = mutableMapOf, List>>>() val templateCollector: MutableMap = mutableMapOf() val fileCollector: MutableList = mutableListOf() @@ -131,9 +118,10 @@ internal class KMockMultiSourceAggregator( val interfaces = typeContainer.getOrElse(sourceIndicator) { mutableListOf() } interfaces.add( - Pair( + Triple( determineMockName(annotation), - annotation.arguments.last().value as List + listOf(annotatedSymbol.containingFile!!), + annotation.arguments.last().value as List, ) ) typeContainer[sourceIndicator] = interfaces @@ -141,12 +129,15 @@ internal class KMockMultiSourceAggregator( } } - resolveInterfaces(typeContainer, templateCollector) + resolveInterfaces( + typeContainer, + templateCollector + ) return Aggregated( - illAnnotated, - templateCollector.values.toList(), - fileCollector + illFormed = illAnnotated, + extractedTemplates = templateCollector.values.toList(), + totalDependencies = fileCollector ) } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregator.kt index c349558c..fdadfb59 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregator.kt @@ -38,7 +38,8 @@ internal class KMockSingleSourceAggregator( private fun resolveInterface( declaration: KSDeclaration, sourceIndicator: String, - templateCollector: MutableMap + dependencies: List, + templateCollector: MutableMap, ) { val interfaze = safeCastInterface(declaration) val qualifiedName = ensureNotNullClassName(interfaze.qualifiedName?.asString()) @@ -48,18 +49,24 @@ internal class KMockSingleSourceAggregator( indicator = sourceIndicator, templateName = aliases[qualifiedName] ?: interfaze.deriveSimpleName(packageName), packageName = packageName, + dependencies = dependencies, template = interfaze, generics = resolveGenerics(interfaze) ) } private fun resolveInterfaces( - raw: Map>, + raw: Map, MutableList>>, templateCollector: MutableMap ) { raw.forEach { (sourceIndicator, interfaces) -> - interfaces.forEach { interfaze -> - resolveInterface(interfaze.declaration, sourceIndicator, templateCollector) + interfaces.second.forEach { interfaze -> + resolveInterface( + declaration = interfaze.declaration, + sourceIndicator = sourceIndicator, + dependencies = interfaces.first, + templateCollector = templateCollector + ) } } } @@ -78,7 +85,7 @@ internal class KMockSingleSourceAggregator( condition: (String, KSAnnotation) -> Boolean, ): Aggregated { val illAnnotated = mutableListOf() - val typeContainer = mutableMapOf>() + val typeContainer = mutableMapOf, MutableList>>() val templateCollector: MutableMap = mutableMapOf() val fileCollector: MutableList = mutableListOf() @@ -89,10 +96,10 @@ internal class KMockSingleSourceAggregator( illAnnotated.add(annotatedSymbol) } else { val sourceIndicator = determineSourceCategory(annotation) - val interfaces = typeContainer.getOrElse(sourceIndicator) { mutableListOf() } + val (_, interfaces) = typeContainer.getOrElse(sourceIndicator) { Pair(null, mutableListOf()) } interfaces.addAll(annotation.arguments.last().value as List) - typeContainer[sourceIndicator] = interfaces + typeContainer[sourceIndicator] = Pair(listOf(annotatedSymbol.containingFile!!), interfaces) fileCollector.add(annotatedSymbol.containingFile!!) } } @@ -100,9 +107,9 @@ internal class KMockSingleSourceAggregator( resolveInterfaces(typeContainer, templateCollector) return Aggregated( - illAnnotated, - templateCollector.values.toList(), - fileCollector + illFormed = illAnnotated, + extractedTemplates = templateCollector.values.toList(), + totalDependencies = fileCollector ) } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryEntryPointGenerator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryEntryPointGenerator.kt index 84db9211..72559514 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryEntryPointGenerator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryEntryPointGenerator.kt @@ -6,6 +6,7 @@ package tech.antibytes.kmock.processor.factory +import com.google.devtools.ksp.symbol.KSFile import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec import com.squareup.kotlinpoet.KModifier @@ -174,8 +175,9 @@ internal class KMockFactoryEntryPointGenerator( override fun generateCommon( templateSources: List, templateMultiSources: List, - totalMultiSources: List, totalTemplates: List, + totalMultiSources: List, + dependencies: List, ) { if (isKmp && (totalTemplates.isNotEmpty() || totalMultiSources.isNotEmpty())) { // TODO: Solve multi Rounds in a better way val file = FileSpec.builder( @@ -203,12 +205,14 @@ internal class KMockFactoryEntryPointGenerator( file.build().writeTo( codeGenerator = codeGenerator, aggregating = false, + originatingKSFiles = dependencies, ) } } private fun generateShared( buckets: Map>, + dependencies: List, ) { buckets.forEach { (indicator, templateSources) -> val (_, generics) = utils.splitInterfacesIntoRegularAndGenerics(templateSources) @@ -229,13 +233,15 @@ internal class KMockFactoryEntryPointGenerator( file.build().writeTo( codeGenerator = codeGenerator, aggregating = false, + originatingKSFiles = dependencies, ) } } } override fun generateShared( - templateSources: List + templateSources: List, + dependencies: List, ) { if (isKmp && templateSources.isNotEmpty()) { // TODO: Solve multi Rounds in a better way val buckets: MutableMap> = mutableMapOf() @@ -248,7 +254,10 @@ internal class KMockFactoryEntryPointGenerator( buckets[indicator] = bucket } - generateShared(buckets) + generateShared( + buckets = buckets, + dependencies = dependencies + ) } } } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryGenerator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryGenerator.kt index d4ff67f2..d72ec628 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryGenerator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/KMockFactoryGenerator.kt @@ -40,8 +40,8 @@ internal class KMockFactoryGenerator( private fun writeFactoryImplementation( templateSources: List, templateMultiSources: List, + relaxer: Relaxer?, dependencies: List, - relaxer: Relaxer? ) { val file = FileSpec.builder( rootPackage, @@ -112,15 +112,15 @@ internal class KMockFactoryGenerator( override fun writeFactories( templateSources: List, templateMultiSources: List, + relaxer: Relaxer?, dependencies: List, - relaxer: Relaxer? ) { if (templateSources.isNotEmpty() || templateMultiSources.isNotEmpty()) { // TODO: Solve multi Rounds in a better way writeFactoryImplementation( templateSources = templateSources, templateMultiSources = templateMultiSources, + relaxer = relaxer, dependencies = dependencies, - relaxer = relaxer ) } } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/NoopFactoryGenerator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/NoopFactoryGenerator.kt index 883ecadd..64affa57 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/NoopFactoryGenerator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/factory/NoopFactoryGenerator.kt @@ -17,18 +17,20 @@ internal object NoopFactoryGenerator : MockFactoryGenerator, MockFactoryEntryPoi override fun writeFactories( templateSources: List, templateMultiSources: List, + relaxer: Relaxer?, dependencies: List, - relaxer: Relaxer? ) = Unit override fun generateCommon( templateSources: List, templateMultiSources: List, + totalTemplates: List, totalMultiSources: List, - totalTemplates: List + dependencies: List, ) = Unit override fun generateShared( - templateSources: List + templateSources: List, + dependencies: List, ) = Unit } diff --git a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/KMockGenerator.kt b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/KMockGenerator.kt index f2d2dc76..2df00452 100644 --- a/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/KMockGenerator.kt +++ b/kmock-processor/src/main/kotlin/tech/antibytes/kmock/processor/mock/KMockGenerator.kt @@ -315,7 +315,6 @@ internal class KMockGenerator( override fun writeCommonMocks( templateSources: List, templateMultiSources: Aggregated, - dependencies: List, relaxer: Relaxer? ) { templateSources.forEach { template -> @@ -332,7 +331,7 @@ internal class KMockGenerator( templateName = template.templateName, packageName = template.packageName, generics = template.generics, - dependencies = dependencies, + dependencies = template.dependencies, relaxer = relaxer ) } @@ -340,7 +339,6 @@ internal class KMockGenerator( override fun writeSharedMocks( templateSources: List, - dependencies: List, relaxer: Relaxer? ) { templateSources.forEach { template -> @@ -352,7 +350,7 @@ internal class KMockGenerator( templateName = template.templateName, packageName = template.packageName, generics = template.generics, - dependencies = dependencies, + dependencies = template.dependencies, relaxer = relaxer ) } @@ -360,7 +358,6 @@ internal class KMockGenerator( override fun writePlatformMocks( templateSources: List, - dependencies: List, relaxer: Relaxer? ) { templateSources.forEach { template -> @@ -371,7 +368,7 @@ internal class KMockGenerator( templateName = template.templateName, packageName = template.packageName, generics = template.generics, - dependencies = dependencies, + dependencies = template.dependencies, relaxer = relaxer ) } diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/KMockProcessorSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/KMockProcessorSpec.kt index 1b216526..b2157045 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/KMockProcessorSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/KMockProcessorSpec.kt @@ -87,13 +87,13 @@ class KMockProcessorSpec { every { relaxationAggregator.extractRelaxer(any()) } returns mockk() - every { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } just Runs - every { mockGenerator.writeSharedMocks(any(), any(), any()) } just Runs - every { mockGenerator.writePlatformMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeCommonMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeSharedMocks(any(), any()) } just Runs + every { mockGenerator.writePlatformMocks(any(), any()) } just Runs every { factoryGenerator.writeFactories(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateCommon(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateShared(any()) } just Runs + every { entryPointGenerator.generateCommon(any(), any(), any(), any(), any()) } just Runs + every { entryPointGenerator.generateShared(any(), any()) } just Runs // When val actual = KMockProcessor( @@ -160,13 +160,13 @@ class KMockProcessorSpec { every { relaxationAggregator.extractRelaxer(any()) } returns mockk() - every { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } just Runs - every { mockGenerator.writeSharedMocks(any(), any(), any()) } just Runs - every { mockGenerator.writePlatformMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeCommonMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeSharedMocks(any(), any()) } just Runs + every { mockGenerator.writePlatformMocks(any(), any()) } just Runs every { factoryGenerator.writeFactories(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateCommon(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateShared(any()) } just Runs + every { entryPointGenerator.generateCommon(any(), any(), any(), any(), any()) } just Runs + every { entryPointGenerator.generateShared(any(), any()) } just Runs // When val processor = KMockProcessor( @@ -223,11 +223,14 @@ class KMockProcessorSpec { val interfacesPlatform: List = listOf(mockk()) val interfacesFiltered: List = listOf(mockk()) - val dependencies: List = listOf(mockk()) + val dependenciesCommon: List = listOf(mockk()) + val dependenciesShared: List = listOf(mockk()) + val dependenciesPlatform: List = listOf(mockk()) + val totalDependencies = listOf(dependenciesCommon, dependenciesShared, dependenciesPlatform,).flatten() every { singleSourceAggregator.extractCommonInterfaces(any()) - } returns Aggregated(illegal, interfacesCommon, dependencies) + } returns Aggregated(illegal, interfacesCommon, dependenciesCommon) every { multiSourceAggregator.extractCommonInterfaces(any()) @@ -235,11 +238,11 @@ class KMockProcessorSpec { every { singleSourceAggregator.extractSharedInterfaces(any()) - } returns Aggregated(illegal, interfacesShared, dependencies) + } returns Aggregated(illegal, interfacesShared, dependenciesShared) every { singleSourceAggregator.extractPlatformInterfaces(any()) - } returns Aggregated(illegal, interfacesPlatform, dependencies) + } returns Aggregated(illegal, interfacesPlatform, dependenciesPlatform) every { filter.filter(any(), any()) } returns interfacesFiltered every { filter.filterSharedSources(any()) } returns interfacesFiltered @@ -248,13 +251,13 @@ class KMockProcessorSpec { every { codeGenerator.closeFiles() } just Runs - every { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } just Runs - every { mockGenerator.writeSharedMocks(any(), any(), any()) } just Runs - every { mockGenerator.writePlatformMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeCommonMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeSharedMocks(any(), any()) } just Runs + every { mockGenerator.writePlatformMocks(any(), any()) } just Runs every { factoryGenerator.writeFactories(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateCommon(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateShared(any()) } just Runs + every { entryPointGenerator.generateCommon(any(), any(), any(), any(), any()) } just Runs + every { entryPointGenerator.generateShared(any(), any()) } just Runs // When KMockProcessor( @@ -276,15 +279,14 @@ class KMockProcessorSpec { mockGenerator.writeCommonMocks( interfacesCommon, Aggregated(emptyList(), emptyList(), emptyList()), - dependencies, - relaxer + relaxer, ) } verify(exactly = 1) { filter.filter(interfacesFiltered, interfacesCommon) } verify(exactly = 1) { filter.filterSharedSources(interfacesShared) } - verify(exactly = 1) { mockGenerator.writeSharedMocks(interfacesFiltered, dependencies, relaxer) } + verify(exactly = 1) { mockGenerator.writeSharedMocks(interfacesFiltered, relaxer) } verify(exactly = 1) { filter.filter( @@ -295,7 +297,7 @@ class KMockProcessorSpec { ).flatten() ) } - verify(exactly = 1) { mockGenerator.writePlatformMocks(interfacesFiltered, dependencies, relaxer) } + verify(exactly = 1) { mockGenerator.writePlatformMocks(interfacesFiltered, relaxer) } verify(exactly = 1) { factoryGenerator.writeFactories( @@ -305,11 +307,8 @@ class KMockProcessorSpec { interfacesFiltered, ).flatten(), emptyList(), - dependencies.toMutableList().also { - it.addAll(dependencies) - it.addAll(dependencies) - }, - relaxer + relaxer, + totalDependencies, ) } @@ -317,16 +316,17 @@ class KMockProcessorSpec { entryPointGenerator.generateCommon( interfacesCommon, emptyList(), - emptyList(), listOf( interfacesCommon, interfacesFiltered, interfacesFiltered, - ).flatten() + ).flatten(), + emptyList(), + totalDependencies, ) } - verify(exactly = 1) { entryPointGenerator.generateShared(interfacesFiltered) } + verify(exactly = 1) { entryPointGenerator.generateShared(interfacesFiltered, dependenciesShared) } verify(exactly = 1) { codeGenerator.closeFiles() } } @@ -357,29 +357,38 @@ class KMockProcessorSpec { val interfacesPlatform: List = listOf(mockk()) val interfacesFiltered: List = listOf(mockk()) - val dependencies: List = listOf(mockk()) + val dependenciesCommon: List = listOf(mockk()) + val dependenciesMultiCommon: List = listOf(mockk()) + val dependenciesShared: List = listOf(mockk()) + val dependenciesPlatform: List = listOf(mockk()) + val totalDependencies = listOf( + dependenciesCommon, + dependenciesShared, + dependenciesPlatform, + dependenciesMultiCommon, + ).flatten() every { singleSourceAggregator.extractCommonInterfaces(any()) } returnsMany listOf( - Aggregated(illegal, interfacesCommonRound1, dependencies), - Aggregated(illegal, interfacesCommonRound2, dependencies), + Aggregated(illegal, interfacesCommonRound1, dependenciesCommon), + Aggregated(illegal, interfacesCommonRound2, dependenciesCommon), ) every { multiSourceAggregator.extractCommonInterfaces(any()) } returnsMany listOf( - Aggregated(illegal, multiInterfacesCommon, dependencies), + Aggregated(illegal, multiInterfacesCommon, dependenciesMultiCommon), Aggregated(emptyList(), emptyList(), emptyList()) ) every { singleSourceAggregator.extractSharedInterfaces(any()) - } returns Aggregated(illegal, interfacesShared, dependencies) + } returns Aggregated(illegal, interfacesShared, dependenciesShared) every { singleSourceAggregator.extractPlatformInterfaces(any()) - } returns Aggregated(illegal, interfacesPlatform, dependencies) + } returns Aggregated(illegal, interfacesPlatform, dependenciesPlatform) every { filter.filter(any(), any()) } returns interfacesFiltered every { filter.filterSharedSources(any()) } returns interfacesFiltered @@ -388,13 +397,13 @@ class KMockProcessorSpec { every { codeGenerator.closeFiles() } just Runs - every { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } just Runs - every { mockGenerator.writeSharedMocks(any(), any(), any()) } just Runs - every { mockGenerator.writePlatformMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeCommonMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeSharedMocks(any(), any()) } just Runs + every { mockGenerator.writePlatformMocks(any(), any()) } just Runs every { factoryGenerator.writeFactories(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateCommon(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateShared(any()) } just Runs + every { entryPointGenerator.generateCommon(any(), any(), any(), any(), any()) } just Runs + every { entryPointGenerator.generateShared(any(), any()) } just Runs // When val processor = KMockProcessor( @@ -418,7 +427,6 @@ class KMockProcessorSpec { mockGenerator.writeCommonMocks( interfacesCommonRound1, Aggregated(emptyList(), emptyList(), emptyList()), - dependencies, relaxer ) } @@ -426,14 +434,13 @@ class KMockProcessorSpec { verify(exactly = 1) { mockGenerator.writeCommonMocks( interfacesCommonRound2, - Aggregated(illegal, multiInterfacesCommon, dependencies), - dependencies, + Aggregated(illegal, multiInterfacesCommon, dependenciesMultiCommon), relaxer ) } verify(exactly = 1) { - interfaceBinder.bind(multiInterfacesCommon, dependencies) + interfaceBinder.bind(multiInterfacesCommon, dependenciesMultiCommon) } verify(exactly = 1) { @@ -449,7 +456,7 @@ class KMockProcessorSpec { } verify(exactly = 2) { filter.filterSharedSources(interfacesShared) } - verify(exactly = 2) { mockGenerator.writeSharedMocks(interfacesFiltered, dependencies, relaxer) } + verify(exactly = 2) { mockGenerator.writeSharedMocks(interfacesFiltered, relaxer) } verify(exactly = 1) { filter.filter( @@ -461,7 +468,7 @@ class KMockProcessorSpec { ).flatten() ) } - verify(exactly = 2) { mockGenerator.writePlatformMocks(interfacesFiltered, dependencies, relaxer) } + verify(exactly = 2) { mockGenerator.writePlatformMocks(interfacesFiltered, relaxer) } verify(exactly = 1) { factoryGenerator.writeFactories( @@ -471,11 +478,8 @@ class KMockProcessorSpec { interfacesFiltered, ).flatten(), multiInterfacesCommon, - dependencies.toMutableList().also { - it.addAll(dependencies) - it.addAll(dependencies) - }, - relaxer + relaxer, + totalDependencies, ) } @@ -483,16 +487,17 @@ class KMockProcessorSpec { entryPointGenerator.generateCommon( listOf(interfacesCommonRound1).flatten(), multiInterfacesCommon, - multiInterfacesCommon, listOf( interfacesCommonRound1, interfacesFiltered, interfacesFiltered, - ).flatten() + ).flatten(), + multiInterfacesCommon, + totalDependencies, ) } - verify(exactly = 2) { entryPointGenerator.generateShared(interfacesFiltered) } + verify(exactly = 2) { entryPointGenerator.generateShared(interfacesFiltered, dependenciesShared) } verify(exactly = 1) { codeGenerator.closeFiles() } } @@ -531,12 +536,12 @@ class KMockProcessorSpec { every { codeGenerator.closeFiles() } just Runs - every { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } just Runs - every { mockGenerator.writeSharedMocks(any(), any(), any()) } just Runs - every { mockGenerator.writePlatformMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeCommonMocks(any(), any(), any()) } just Runs + every { mockGenerator.writeSharedMocks(any(), any()) } just Runs + every { mockGenerator.writePlatformMocks(any(), any()) } just Runs every { factoryGenerator.writeFactories(any(), any(), any(), any()) } just Runs - every { entryPointGenerator.generateCommon(any(), any(), any(), any()) } just Runs + every { entryPointGenerator.generateCommon(any(), any(), any(), any(), any()) } just Runs // When KMockProcessor( @@ -556,12 +561,12 @@ class KMockProcessorSpec { // Then verify(exactly = 1) { singleSourceAggregator.extractPlatformInterfaces(any()) } - verify(exactly = 0) { mockGenerator.writeCommonMocks(any(), any(), any(), any()) } + verify(exactly = 0) { mockGenerator.writeCommonMocks(any(), any(), any()) } verify(exactly = 1) { filter.filter(any(), any()) } verify(exactly = 0) { filter.filterSharedSources(any()) } - verify(exactly = 0) { mockGenerator.writeSharedMocks(any(), any(), any()) } + verify(exactly = 0) { mockGenerator.writeSharedMocks(any(), any()) } verify(exactly = 1) { filter.filter( @@ -569,7 +574,7 @@ class KMockProcessorSpec { emptyList() ) } - verify(exactly = 1) { mockGenerator.writePlatformMocks(interfacesFiltered, dependencies, relaxer) } + verify(exactly = 1) { mockGenerator.writePlatformMocks(interfacesFiltered, relaxer) } verify(exactly = 1) { factoryGenerator.writeFactories( @@ -577,13 +582,13 @@ class KMockProcessorSpec { interfacesFiltered.first(), ), emptyList(), + relaxer, dependencies, - relaxer ) } verify(exactly = 0) { - entryPointGenerator.generateCommon(interfacesCommon, emptyList(), emptyList(), interfacesFiltered) + entryPointGenerator.generateCommon(emptyList(), emptyList(), interfacesCommon, any(), dependencies) } verify(exactly = 1) { codeGenerator.closeFiles() } diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorCommonSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorCommonSpec.kt index a961baca..960c48de 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorCommonSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorCommonSpec.kt @@ -395,7 +395,8 @@ class KMockMultiSourceAggregatorCommonSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -486,7 +487,8 @@ class KMockMultiSourceAggregatorCommonSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -597,7 +599,8 @@ class KMockMultiSourceAggregatorCommonSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration1, declaration2, declaration3), - generics = listOf(generics, generics, generics) + generics = listOf(generics, generics, generics), + dependencies = listOf(file) ) ) @@ -765,7 +768,8 @@ class KMockMultiSourceAggregatorCommonSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(emptyMap()) + generics = listOf(emptyMap()), + dependencies = listOf(file) ) ) verify(exactly = 1) { diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorPlatformSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorPlatformSpec.kt index 74c0472a..7d67c702 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorPlatformSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorPlatformSpec.kt @@ -395,7 +395,8 @@ class KMockMultiSourceAggregatorPlatformSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -486,7 +487,8 @@ class KMockMultiSourceAggregatorPlatformSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -597,7 +599,8 @@ class KMockMultiSourceAggregatorPlatformSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration1, declaration2, declaration3), - generics = listOf(generics, generics, generics) + generics = listOf(generics, generics, generics), + dependencies = listOf(file) ) ) @@ -765,7 +768,8 @@ class KMockMultiSourceAggregatorPlatformSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(emptyMap()) + generics = listOf(emptyMap()), + dependencies = listOf(file) ) ) verify(exactly = 1) { diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorSharedSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorSharedSpec.kt index 77ce4a8a..55653a5d 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorSharedSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockMultiSourceAggregatorSharedSpec.kt @@ -809,7 +809,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -913,7 +914,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -1075,14 +1077,16 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ), TemplateMultiSource( indicator = marker1, templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -1245,14 +1249,16 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ), TemplateMultiSource( indicator = marker1, templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(generics) + generics = listOf(generics), + dependencies = listOf(file) ) ) @@ -1388,7 +1394,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration1, declaration2, declaration3), - generics = listOf(generics, generics, generics) + generics = listOf(generics, generics, generics), + dependencies = listOf(file) ) ) @@ -1507,7 +1514,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration1, declaration2, declaration3), - generics = listOf(generics, generics, generics) + generics = listOf(generics, generics, generics), + dependencies = listOf(file) ) ) @@ -1797,7 +1805,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(emptyMap()) + generics = listOf(emptyMap()), + dependencies = listOf(file) ), ) sourceFiles mustBe listOf(file) @@ -1904,7 +1913,8 @@ class KMockMultiSourceAggregatorSharedSpec { templateName = mockName, packageName = rootPackage, templates = listOf(declaration), - generics = listOf(emptyMap()) + generics = listOf(emptyMap()), + dependencies = listOf(file), ), ) sourceFiles mustBe listOf(file, file) diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorCommonSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorCommonSpec.kt similarity index 98% rename from kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorCommonSpec.kt rename to kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorCommonSpec.kt index 32aa8956..47a6eb27 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorCommonSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorCommonSpec.kt @@ -39,7 +39,7 @@ import tech.antibytes.util.test.fulfils import tech.antibytes.util.test.mustBe import kotlin.test.assertFailsWith -class KMockSourceAggregatorCommonSpec { +class KMockSingleSourceAggregatorCommonSpec { private val fixture = kotlinFixture { configuration -> configuration.addGenerator( String::class, @@ -387,7 +387,8 @@ class KMockSourceAggregatorCommonSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -475,7 +476,8 @@ class KMockSourceAggregatorCommonSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -640,7 +642,8 @@ class KMockSourceAggregatorCommonSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = emptyMap() + generics = emptyMap(), + dependencies = listOf(file) ) ) verify(exactly = 1) { @@ -734,7 +737,8 @@ class KMockSourceAggregatorCommonSpec { templateName = alias, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorFactorySpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorFactorySpec.kt similarity index 97% rename from kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorFactorySpec.kt rename to kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorFactorySpec.kt index 723d6c3a..9c44c011 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorFactorySpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorFactorySpec.kt @@ -21,7 +21,7 @@ import tech.antibytes.util.test.fixture.kotlinFixture import tech.antibytes.util.test.fixture.mapFixture import tech.antibytes.util.test.fulfils -class KMockSourceAggregatorFactorySpec { +class KMockSingleSourceAggregatorFactorySpec { private val fixture = kotlinFixture() @Test diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorPlatformSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorPlatformSpec.kt similarity index 98% rename from kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorPlatformSpec.kt rename to kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorPlatformSpec.kt index b938ef74..935f1adf 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorPlatformSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorPlatformSpec.kt @@ -39,7 +39,7 @@ import tech.antibytes.util.test.fulfils import tech.antibytes.util.test.mustBe import kotlin.test.assertFailsWith -class KMockSourceAggregatorPlatformSpec { +class KMockSingleSourceAggregatorPlatformSpec { private val fixture = kotlinFixture { configuration -> configuration.addGenerator( String::class, @@ -387,7 +387,8 @@ class KMockSourceAggregatorPlatformSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -475,7 +476,8 @@ class KMockSourceAggregatorPlatformSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -640,7 +642,8 @@ class KMockSourceAggregatorPlatformSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = emptyMap() + generics = emptyMap(), + dependencies = listOf(file) ) ) verify(exactly = 1) { @@ -734,7 +737,8 @@ class KMockSourceAggregatorPlatformSpec { templateName = alias, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorSharedSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorSharedSpec.kt similarity index 98% rename from kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorSharedSpec.kt rename to kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorSharedSpec.kt index 8e1ee059..227c2fb7 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSourceAggregatorSharedSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/aggregation/KMockSingleSourceAggregatorSharedSpec.kt @@ -41,7 +41,7 @@ import tech.antibytes.util.test.fulfils import tech.antibytes.util.test.mustBe import kotlin.test.assertFailsWith -class KMockSourceAggregatorSharedSpec { +class KMockSingleSourceAggregatorSharedSpec { private val fixture = kotlinFixture { configuration -> configuration.addGenerator( String::class, @@ -796,7 +796,8 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -897,7 +898,8 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -1055,14 +1057,16 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ), TemplateSource( indicator = marker1, templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -1221,14 +1225,16 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ), TemplateSource( indicator = marker1, templateName = simpleName, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -1520,7 +1526,8 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = emptyMap() + generics = emptyMap(), + dependencies = listOf(file) ), ) sourceFiles mustBe listOf(file) @@ -1623,7 +1630,8 @@ class KMockSourceAggregatorSharedSpec { templateName = simpleName, packageName = packageName, template = declaration, - generics = emptyMap() + generics = emptyMap(), + dependencies = listOf(file) ), ) sourceFiles mustBe listOf(file, file) @@ -1735,7 +1743,8 @@ class KMockSourceAggregatorSharedSpec { templateName = alias, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) @@ -1834,7 +1843,8 @@ class KMockSourceAggregatorSharedSpec { templateName = alias, packageName = packageName, template = declaration, - generics = generics + generics = generics, + dependencies = listOf(file) ) ) diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/multi/ParentFinderSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/multi/ParentFinderSpec.kt index f395c41d..cabd80f3 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/multi/ParentFinderSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/multi/ParentFinderSpec.kt @@ -37,7 +37,8 @@ class ParentFinderSpec { packageName = fixture.fixture(), templateName = templateName, template = mockk(), - generics = emptyMap() + generics = emptyMap(), + dependencies = emptyList() ) val templateMultiSource = TemplateMultiSource( @@ -45,7 +46,8 @@ class ParentFinderSpec { packageName = fixture.fixture(), templateName = templateName, templates = mockk(), - generics = emptyList() + generics = emptyList(), + dependencies = emptyList() ) val multiDependency: KSFile = mockk() @@ -56,7 +58,7 @@ class ParentFinderSpec { templateMultiSources = Aggregated( illFormed = emptyList(), extractedTemplates = listOf(templateMultiSource), - dependencies = listOf(multiDependency) + totalDependencies = listOf(multiDependency) ), ) @@ -75,7 +77,8 @@ class ParentFinderSpec { packageName = packageName, templateName = templateName, template = mockk(), - generics = emptyMap() + generics = emptyMap(), + dependencies = emptyList() ) val templateMultiSource = TemplateMultiSource( @@ -83,7 +86,8 @@ class ParentFinderSpec { packageName = packageName, templateName = templateName, templates = mockk(), - generics = emptyList() + generics = emptyList(), + dependencies = emptyList() ) val multiDependency: KSFile = mockk() @@ -94,7 +98,7 @@ class ParentFinderSpec { templateMultiSources = Aggregated( illFormed = emptyList(), extractedTemplates = listOf(templateMultiSource), - dependencies = listOf(multiDependency) + totalDependencies = listOf(multiDependency) ), ) @@ -113,7 +117,8 @@ class ParentFinderSpec { packageName = packageName, templateName = fixture.fixture(), template = mockk(), - generics = emptyMap() + generics = emptyMap(), + dependencies = emptyList() ) val templateMultiSource = TemplateMultiSource( @@ -121,7 +126,8 @@ class ParentFinderSpec { packageName = packageName, templateName = fixture.fixture(), templates = mockk(), - generics = emptyList() + generics = emptyList(), + dependencies = emptyList() ) val multiDependency: KSFile = mockk() @@ -132,7 +138,7 @@ class ParentFinderSpec { templateMultiSources = Aggregated( illFormed = emptyList(), extractedTemplates = listOf(templateMultiSource), - dependencies = listOf(multiDependency) + totalDependencies = listOf(multiDependency) ), ) @@ -152,7 +158,8 @@ class ParentFinderSpec { packageName = packageName, templateName = templateName, template = mockk(), - generics = emptyMap() + generics = emptyMap(), + dependencies = emptyList() ) val templateMultiSource = TemplateMultiSource( @@ -160,7 +167,8 @@ class ParentFinderSpec { packageName = packageName, templateName = templateName, templates = mockk(), - generics = emptyList() + generics = emptyList(), + dependencies = emptyList() ) val multiDependency: KSFile = mockk() @@ -171,7 +179,7 @@ class ParentFinderSpec { templateMultiSources = Aggregated( illFormed = emptyList(), extractedTemplates = listOf(templateMultiSource), - dependencies = listOf(multiDependency) + totalDependencies = listOf(multiDependency) ), ) diff --git a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/utils/SourceFilterSpec.kt b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/utils/SourceFilterSpec.kt index f1ffce38..2a5027b6 100644 --- a/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/utils/SourceFilterSpec.kt +++ b/kmock-processor/src/test/kotlin/tech/antibytes/kmock/processor/utils/SourceFilterSpec.kt @@ -47,14 +47,16 @@ class SourceFilterSpec { template = source0_0, templateName = packageName0, packageName = interfaceName0, - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = "", template = source0_1, templateName = packageName0, packageName = interfaceName1, - generics = null + generics = null, + dependencies = emptyList() ) ) @@ -64,14 +66,16 @@ class SourceFilterSpec { template = source1_0, templateName = packageName1, packageName = interfaceName0, - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = "", template = source1_1, templateName = packageName0, packageName = interfaceName1, - generics = null + generics = null, + dependencies = emptyList() ) ) @@ -96,14 +100,16 @@ class SourceFilterSpec { template = source0, templateName = fixture.fixture(), packageName = fixture.fixture(), - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = fixture.fixture(), template = source1, templateName = fixture.fixture(), packageName = fixture.fixture(), - generics = null + generics = null, + dependencies = emptyList() ) ) @@ -133,14 +139,16 @@ class SourceFilterSpec { template = source0, templateName = interfaceName, packageName = packageName, - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = marker1, template = source1, templateName = interfaceName, packageName = packageName, - generics = null + generics = null, + dependencies = emptyList() ) ) @@ -172,21 +180,24 @@ class SourceFilterSpec { template = source0, templateName = interfaceName, packageName = packageName, - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = marker1, template = source1, templateName = interfaceName, packageName = packageName, - generics = null + generics = null, + dependencies = emptyList() ), TemplateSource( indicator = marker2, template = source2, templateName = interfaceName, packageName = packageName, - generics = null + generics = null, + dependencies = emptyList() ) )