From a1da1e1fab7c8bc1a3807ee910a50795cfe37c98 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Tue, 3 Sep 2024 13:59:50 -0400 Subject: [PATCH] Added in "ExtraMetadata" for CodeReferences and changed CollectedStatType -> DataType. --- .../com/squareup/invert/ReportOutputConfig.kt | 7 + .../com/squareup/invert/StatCollector.kt | 6 +- .../internal/CollectedStatAggregator.kt | 12 +- .../internal/report/js/InvertJsReportUtils.kt | 10 +- .../invert/internal/tasks/InvertTask.kt | 9 +- invert-models/build.gradle.kts | 34 ++--- .../invert/models/CollectedStatType.kt | 9 -- .../com/squareup/invert/models/DataType.kt | 25 ++++ .../invert/models/InvertSerialization.kt | 1 + .../kotlin/com/squareup/invert/models/Stat.kt | 136 +++++++++--------- .../squareup/invert/models/StatMetadata.kt | 13 +- .../com/squareup/invert/models/Typealiases.kt | 1 + .../squareup/invert/common/ReportDataRepo.kt | 15 +- .../invert/common/pages/AllStatsReportPage.kt | 12 +- .../common/pages/CodeReferencesReportPage.kt | 26 +++- .../common/pages/StatDetailReportPage.kt | 14 +- 16 files changed, 194 insertions(+), 136 deletions(-) create mode 100644 invert-gradle-plugin/src/main/kotlin/com/squareup/invert/ReportOutputConfig.kt delete mode 100644 invert-models/src/commonMain/kotlin/com/squareup/invert/models/CollectedStatType.kt create mode 100644 invert-models/src/commonMain/kotlin/com/squareup/invert/models/DataType.kt diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/ReportOutputConfig.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/ReportOutputConfig.kt new file mode 100644 index 0000000..a47aa92 --- /dev/null +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/ReportOutputConfig.kt @@ -0,0 +1,7 @@ +package com.squareup.invert + +import java.io.File + +data class ReportOutputConfig( + val invertReportDirectory: File +) \ No newline at end of file diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/StatCollector.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/StatCollector.kt index 1af6f5f..ec3a163 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/StatCollector.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/StatCollector.kt @@ -1,6 +1,7 @@ package com.squareup.invert import org.gradle.api.Named +import java.io.File /** @@ -21,6 +22,7 @@ interface StatCollector : Named { * Compute [CollectedStat]s with the context of all collected information. */ fun aggregate( + reportOutputConfig: ReportOutputConfig, invertAllCollectedDataRepo: InvertAllCollectedDataRepo, - ): CollectedStatsAggregate = CollectedStatsAggregate(mapOf(), listOf()) -} + ): CollectedStatsAggregate? = CollectedStatsAggregate(mapOf(), listOf()) +} \ No newline at end of file diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/CollectedStatAggregator.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/CollectedStatAggregator.kt index 5f1f2ec..9d1406d 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/CollectedStatAggregator.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/CollectedStatAggregator.kt @@ -2,6 +2,7 @@ package com.squareup.invert.internal import com.squareup.invert.CollectedStatsAggregate import com.squareup.invert.InvertAllCollectedDataRepo +import com.squareup.invert.ReportOutputConfig import com.squareup.invert.StatCollector import com.squareup.invert.internal.models.CollectedStatsForProject import com.squareup.invert.internal.models.InvertCombinedCollectedData @@ -9,6 +10,7 @@ import com.squareup.invert.models.Stat import com.squareup.invert.models.StatKey import com.squareup.invert.models.StatMetadata import com.squareup.invert.models.js.MetadataJsReportModel +import java.io.File object CollectedStatAggregator { @@ -17,19 +19,21 @@ object CollectedStatAggregator { */ fun aggregate( allCollectedData: InvertCombinedCollectedData, + reportOutputConfig: ReportOutputConfig, reportMetadata: MetadataJsReportModel, statCollectors: List? ): InvertCombinedCollectedData { val statMap: MutableMap = allCollectedData.collectedStats.associateBy { it.path }.toMutableMap() statCollectors?.forEach { statCollector: StatCollector -> - val result: CollectedStatsAggregate = statCollector.aggregate( - InvertAllCollectedDataRepo( + val result: CollectedStatsAggregate? = statCollector.aggregate( + reportOutputConfig = reportOutputConfig, + invertAllCollectedDataRepo = InvertAllCollectedDataRepo( projectMetadata = reportMetadata, allCollectedData = allCollectedData - ) + ), ) - result.projectStats.entries.forEach { (gradlePath, stats) -> + result?.projectStats?.entries?.forEach { (gradlePath, stats) -> val curr: CollectedStatsForProject = statMap[gradlePath] ?: CollectedStatsForProject( path = gradlePath, statInfos = emptyMap(), diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt index 1acdd04..13f6abc 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/report/js/InvertJsReportUtils.kt @@ -5,8 +5,8 @@ import com.squareup.invert.internal.models.CollectedDependenciesForProject import com.squareup.invert.internal.models.CollectedOwnershipForProject import com.squareup.invert.internal.models.CollectedPluginsForProject import com.squareup.invert.internal.models.CollectedStatsForProject -import com.squareup.invert.models.CollectedStatType import com.squareup.invert.models.ConfigurationName +import com.squareup.invert.models.DataType import com.squareup.invert.models.DependencyId import com.squareup.invert.models.GradlePath import com.squareup.invert.models.GradlePluginId @@ -44,10 +44,10 @@ object InvertJsReportUtils { fun computeGlobalStats(allProjectsStatsData: StatsJsReportModel): Map { val globalStats: Map = allProjectsStatsData.statInfos.values .filter { statInfo -> - when (statInfo.statType) { - CollectedStatType.BOOLEAN, - CollectedStatType.NUMERIC, - CollectedStatType.CODE_REFERENCES -> true + when (statInfo.dataType) { + DataType.BOOLEAN, + DataType.NUMERIC, + DataType.CODE_REFERENCES -> true else -> { false diff --git a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/InvertTask.kt b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/InvertTask.kt index 9d16da6..e3be52c 100644 --- a/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/InvertTask.kt +++ b/invert-gradle-plugin/src/main/kotlin/com/squareup/invert/internal/tasks/InvertTask.kt @@ -1,6 +1,7 @@ package com.squareup.invert.internal.tasks import com.squareup.invert.InvertExtension +import com.squareup.invert.ReportOutputConfig import com.squareup.invert.StatCollector import com.squareup.invert.internal.CollectedStatAggregator import com.squareup.invert.internal.InvertFileUtils @@ -63,6 +64,7 @@ abstract class InvertTask : DefaultTask() { val datePatternFormat = "MMMM dd, yyyy[ 'at' HH:mm:ss]" val mavenRepoUrls = this.mavenRepoUrls.get() runBlocking { + val invertReportDir = rootBuildReportsDir.get().asFile val reportMetadata = ProjectMetadataCollector.gatherProjectMetadata( timeZoneId = timeZoneId, @@ -78,12 +80,15 @@ abstract class InvertTask : DefaultTask() { val allCollectedData = CollectedStatAggregator.aggregate( allCollectedData = allCollectedDataOrig, reportMetadata = reportMetadata, - statCollectors = statCollectors + statCollectors = statCollectors, + reportOutputConfig = ReportOutputConfig( + invertReportDirectory = invertReportDir, + ) ) InvertReportWriter( invertLogger = invertLogger(), - rootBuildReportsDir = rootBuildReportsDir.get().asFile + rootBuildReportsDir = invertReportDir, ).writeProjectData( reportMetadata = reportMetadata, collectedOwners = allCollectedData.collectedOwners, diff --git a/invert-models/build.gradle.kts b/invert-models/build.gradle.kts index aabc0cb..00d0685 100644 --- a/invert-models/build.gradle.kts +++ b/invert-models/build.gradle.kts @@ -1,24 +1,24 @@ plugins { - kotlin("multiplatform") - kotlin("plugin.serialization") - alias(libs.plugins.dokka) - alias(libs.plugins.vanniktech.maven.publish) + kotlin("multiplatform") + kotlin("plugin.serialization") + alias(libs.plugins.dokka) + alias(libs.plugins.vanniktech.maven.publish) } kotlin { - js { - browser() - } - jvm { - withSourcesJar() - } + js { + browser() + } + jvm { + withSourcesJar() + } - sourceSets { - val commonMain by getting { - dependencies { - api(libs.kotlinx.serialization.core) - api(libs.kotlinx.serialization.json) - } - } + sourceSets { + val commonMain by getting { + dependencies { + api(libs.kotlinx.serialization.core) + api(libs.kotlinx.serialization.json) + } } + } } diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/CollectedStatType.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/CollectedStatType.kt deleted file mode 100644 index f3620c9..0000000 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/CollectedStatType.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.squareup.invert.models - -enum class CollectedStatType { - BOOLEAN, - NUMERIC, - STRING, // Become Explore - CODE_REFERENCES, // EXPLORE (CUSTOM) - DI_PROVIDES_AND_INJECTS, // EXPLORE (CUSTOM) -} diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/DataType.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/DataType.kt new file mode 100644 index 0000000..083eecd --- /dev/null +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/DataType.kt @@ -0,0 +1,25 @@ +package com.squareup.invert.models + +import kotlinx.serialization.Transient +import kotlin.reflect.KClass + +enum class DataType( + @Transient val basicType: Basic?, + @Transient val backingType: KClass<*> +) { + BOOLEAN(Basic.BOOLEAN, Boolean::class), + NUMERIC(Basic.NUMERIC, Long::class), + STRING(Basic.STRING, String::class), + CODE_REFERENCES(null, Stat.CodeReferencesStat.CodeReference::class), // EXPLORE (CUSTOM) + DI_PROVIDES_AND_INJECTS(null, Stat.DiProvidesAndInjectsStat::class); // EXPLORE (CUSTOM) + + companion object { + fun fromString(type: String?): DataType? { + return DataType.entries.firstOrNull { it.name == type } + } + } + + enum class Basic { + BOOLEAN, NUMERIC, STRING + } +} diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/InvertSerialization.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/InvertSerialization.kt index 580d1bc..15214df 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/InvertSerialization.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/InvertSerialization.kt @@ -13,6 +13,7 @@ object InvertSerialization { allowStructuredMapKeys = true ignoreUnknownKeys = true serializersModule = SerializersModule { + // Stat polymorphic( baseClass = Stat::class, actualClass = Stat.BooleanStat::class, diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Stat.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Stat.kt index 3f2a03e..9279ed4 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Stat.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Stat.kt @@ -10,80 +10,80 @@ import kotlinx.serialization.Serializable */ sealed interface Stat { - @Serializable - @SerialName("numeric_stat") - data class NumericStat( - val value: Int, - val details: String? = null, - ) : Stat - - @Serializable - @SerialName("string_stat") - data class StringStat( - val value: String, - val details: String? = null, - ) : Stat + @Serializable + @SerialName("numeric_stat") + data class NumericStat( + val value: Int, + val details: String? = null, + ) : Stat - @Serializable - @SerialName("boolean_stat") - data class BooleanStat( - val value: Boolean, - val details: String? = null, - ) : Stat + @Serializable + @SerialName("string_stat") + data class StringStat( + val value: String, + val details: String? = null, + ) : Stat - @Serializable - @SerialName("code_reference") - data class CodeReferencesStat( - val value: List, - ) : Stat { + @Serializable + @SerialName("boolean_stat") + data class BooleanStat( + val value: Boolean, + val details: String? = null, + ) : Stat - @Serializable - data class CodeReference( - val filePath: String, - val startLine: Int, - val endLine: Int, - val code: String? = null - ) - } + @Serializable + @SerialName("code_reference") + data class CodeReferencesStat( + val value: List, + ) : Stat { + @Serializable + data class CodeReference( + val filePath: String, + val startLine: Int, + val endLine: Int, + val code: String? = null, + val extras: Map = emptyMap(), + ) + } + @Serializable + @SerialName("di_provides_and_injects") + data class DiProvidesAndInjectsStat( + val value: List, + val details: String? = null, + ) : Stat { + /** + * Represents the data in an Anvil ContributesBinding Annotation Usage + */ @Serializable - @SerialName("di_provides_and_injects") - data class DiProvidesAndInjectsStat( - val value: List, - val details: String? = null, - ) : Stat { - /** - * Represents the data in an Anvil ContributesBinding Annotation Usage - */ - @Serializable - data class DiContribution( - val annotation: String, - val scope: String, - val boundImplementation: String, - val boundType: String, - val replaces: List, - ) + data class DiContribution( + val annotation: String, + val scope: String, + val boundImplementation: String, + val boundType: String, + val replaces: List, + ) - /** - * Represents the data in an Anvil ContributesBinding Annotation Usage - */ - @Serializable - data class DiInjection( - val type: String, - val qualifierAnnotations: List, - val startLine: Int, - val endLine: Int, - ) + /** + * Represents the data in an Anvil ContributesBinding Annotation Usage + */ + @Serializable + data class DiInjection( + val type: String, + val qualifierAnnotations: List, + val startLine: Int, + val endLine: Int, + ) - @Serializable - data class ProvidesAndInjects( - val classFqName: String, - val contributions: List, - val consumptions: List, - val filePath: String, - val startLine: Int, - val endLine: Int, - ) - } + @Serializable + data class ProvidesAndInjects( + val classFqName: String, + val contributions: List, + val consumptions: List, + val filePath: String, + val startLine: Int, + val endLine: Int, + ) + } } diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/StatMetadata.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/StatMetadata.kt index e2357f9..505d6ec 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/StatMetadata.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/StatMetadata.kt @@ -2,6 +2,14 @@ package com.squareup.invert.models import kotlinx.serialization.Serializable + +@Serializable +data class ExtraMetadata( + val key: ExtraKey, + val type: DataType, + val description: String, +) + /** * Information about a specific stat type. */ @@ -9,6 +17,7 @@ import kotlinx.serialization.Serializable data class StatMetadata( val key: StatKey, val description: String, - val statType: CollectedStatType, - val category: String? = null, + val dataType: DataType, + val category: String = "Stats", + val extraMetadata: List = emptyList(), ) diff --git a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Typealiases.kt b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Typealiases.kt index eee1e7a..8b7f70e 100644 --- a/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Typealiases.kt +++ b/invert-models/src/commonMain/kotlin/com/squareup/invert/models/Typealiases.kt @@ -8,3 +8,4 @@ typealias OwnerName = String typealias GitSha = String typealias GitBranch = String typealias StatKey = String +typealias ExtraKey = String diff --git a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/ReportDataRepo.kt b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/ReportDataRepo.kt index 70a1588..7587d18 100644 --- a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/ReportDataRepo.kt +++ b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/ReportDataRepo.kt @@ -113,12 +113,9 @@ class ReportDataRepo( } - fun diProvides(diKey: DiKey): Flow> = - diProvides().mapLatest { providesList -> - providesList.filter { it.key == diKey } - } - -// fun providesFor(diInjectsItem: DiProvidesAndInjectsItem.Injects) {} + fun diProvides(diKey: DiKey): Flow> = diProvides().mapLatest { providesList -> + providesList.filter { it.key == diKey } + } val statInfos: Flow?> = collectedDataRepo.statsData.mapLatest { it?.statInfos?.values } @@ -238,7 +235,8 @@ class ReportDataRepo( ModuleOwnerAndCodeReference( codeReference = codeReference, module = moduleName, - owner = ownerName + owner = ownerName, + metadata = statsJsReportModel.statInfos[statKey]!! ) ) } @@ -269,5 +267,6 @@ class ReportDataRepo( data class ModuleOwnerAndCodeReference( val module: GradlePath, val owner: OwnerName, - val codeReference: Stat.CodeReferencesStat.CodeReference + val codeReference: Stat.CodeReferencesStat.CodeReference, + val metadata: StatMetadata, ) diff --git a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/AllStatsReportPage.kt b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/AllStatsReportPage.kt index 042976b..360c730 100644 --- a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/AllStatsReportPage.kt +++ b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/AllStatsReportPage.kt @@ -12,7 +12,7 @@ import com.squareup.invert.common.navigation.NavRouteRepo import com.squareup.invert.common.navigation.routes.BaseNavRoute import com.squareup.invert.common.pages.AllStatsReportPage.navPage import com.squareup.invert.common.utils.FormattingUtils.formatDecimalSeparator -import com.squareup.invert.models.CollectedStatType +import com.squareup.invert.models.DataType import com.squareup.invert.models.StatKey import com.squareup.invert.models.StatMetadata import org.jetbrains.compose.web.dom.A @@ -30,15 +30,14 @@ import kotlin.reflect.KClass data class AllStatsNavRoute( - val statType: CollectedStatType? = null + val statType: DataType? = null ) : BaseNavRoute( navPage ) { override fun toSearchParams(): Map = toParamsWithOnlyPageId(this) .also { params -> - statType?.name?.let { - params[STAT_TYPE_PARAM] = - it + statType?.let { + params[STAT_TYPE_PARAM] = statType.name } } @@ -48,7 +47,8 @@ data class AllStatsNavRoute( fun parser(params: Map): AllStatsNavRoute { val statTypeParam = params[STAT_TYPE_PARAM] - val statType = CollectedStatType.entries.firstOrNull { it.name == statTypeParam } + + val statType = DataType.fromString(statTypeParam) return AllStatsNavRoute( statType = statType, ) diff --git a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/CodeReferencesReportPage.kt b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/CodeReferencesReportPage.kt index 7d60230..8f10325 100644 --- a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/CodeReferencesReportPage.kt +++ b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/CodeReferencesReportPage.kt @@ -5,14 +5,18 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import com.squareup.invert.common.DependencyGraph import com.squareup.invert.common.InvertReportPage +import com.squareup.invert.common.ModuleOwnerAndCodeReference import com.squareup.invert.common.ReportDataRepo import com.squareup.invert.common.navigation.NavPage import com.squareup.invert.common.navigation.NavRouteRepo import com.squareup.invert.common.navigation.routes.BaseNavRoute import com.squareup.invert.common.pages.CodeReferencesNavRoute.Companion.parser -import com.squareup.invert.models.CollectedStatType +import com.squareup.invert.models.DataType +import com.squareup.invert.models.ExtraKey import com.squareup.invert.models.GradlePath import com.squareup.invert.models.OwnerName +import com.squareup.invert.models.StatMetadata +import kotlinx.coroutines.flow.first import org.jetbrains.compose.web.dom.H1 import org.jetbrains.compose.web.dom.Text import ui.BootstrapLoadingMessageWithSpinner @@ -103,32 +107,42 @@ fun CodeReferencesComposable( return } StatTiles(statTotalsOrig!!.statTotals - .filter { it.key.statType == CollectedStatType.CODE_REFERENCES }) { statKey -> + .filter { it.key.dataType == DataType.CODE_REFERENCES }) { statKey -> navRouteRepo.updateNavRoute( CodeReferencesNavRoute(statKey) ) } } else { - val statsForKey by reportDataRepo.statsForKey(statKey).collectAsState(null) + + val statsForKey: MutableList? by reportDataRepo.statsForKey(statKey) + .collectAsState(null) if (statsForKey == null) { BootstrapLoadingMessageWithSpinner("Loading Stats for $statKey") return } + val extraKeys = mutableSetOf() + statsForKey!!.forEach { moduleOwnerAndCodeReference -> + moduleOwnerAndCodeReference.codeReference.extras.forEach { + extraKeys.add(it.key) + } + } + BootstrapTable( - headers = listOf("Module", "Owner", "File", "Code"), + headers = listOf("Module", "Owner", "File", "Code") + extraKeys, rows = statsForKey!!.map { + val listOfExtraValues: List = extraKeys.map { key -> it.codeReference.extras[key] ?: "" } listOf( it.module, it.owner, it.codeReference.toHrefLink(projectMetadata!!, false), it.codeReference.code ?: "" - ) + ) + listOfExtraValues }, maxResultsLimitConstant = Int.MAX_VALUE, sortAscending = true, sortByColumn = 2, - types = listOf(String::class, String::class, String::class, String::class) + types = listOf(String::class, String::class, String::class, String::class) + extraKeys.map { String::class } ) } } diff --git a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/StatDetailReportPage.kt b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/StatDetailReportPage.kt index 9cdb65b..7a2fd9e 100644 --- a/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/StatDetailReportPage.kt +++ b/invert-report/src/jsMain/kotlin/com/squareup/invert/common/pages/StatDetailReportPage.kt @@ -13,7 +13,7 @@ import com.squareup.invert.common.navigation.NavPage import com.squareup.invert.common.navigation.NavRouteRepo import com.squareup.invert.common.navigation.routes.BaseNavRoute import com.squareup.invert.common.pages.StatDetailNavRoute.Companion.parser -import com.squareup.invert.models.CollectedStatType +import com.squareup.invert.models.DataType import com.squareup.invert.models.GradlePath import com.squareup.invert.models.GradlePluginId import com.squareup.invert.models.OwnerName @@ -149,17 +149,17 @@ fun StatDetailComposable( } val SUPPORTED_TYPES = listOf( - CollectedStatType.STRING, - CollectedStatType.BOOLEAN, - CollectedStatType.NUMERIC, - CollectedStatType.CODE_REFERENCES + DataType.STRING, + DataType.BOOLEAN, + DataType.NUMERIC, + DataType.CODE_REFERENCES ) val resultsTab = BootstrapTabData("Results") { val statsColumns = mutableListOf>().apply { statKeys.forEach { statKey -> val statInfo = statsData?.statInfos?.get(statKey) statInfo?.let { statMetadata: StatMetadata -> - if (SUPPORTED_TYPES.contains(statMetadata.statType)) { + if (SUPPORTED_TYPES.contains(statMetadata.dataType)) { val value = allModules.map { gradlePath -> val statsDataForModule: Map? = statsData?.statsByModule?.get(gradlePath) val stat = statsDataForModule?.get(statKey) @@ -216,7 +216,7 @@ fun StatDetailComposable( .apply { statKeys.forEach { val thisStatType = statsData?.statInfos?.get(it) - if (SUPPORTED_TYPES.contains(thisStatType?.statType)) { + if (SUPPORTED_TYPES.contains(thisStatType?.dataType)) { if (!moduleToOwnerMapFlowValue.isNullOrEmpty()) { add("Owner") }