|
23 | 23 | */ |
24 | 24 | package dev.shreyaspatil.composeCompilerMetricsGenerator.core |
25 | 25 |
|
26 | | -import com.squareup.moshi.Moshi |
27 | | -import com.squareup.moshi.adapter |
28 | 26 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.model.DetailedStatistics |
29 | 27 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.model.Item |
30 | 28 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.model.RowItems |
31 | 29 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.model.classes.ClassesReport |
32 | 30 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.model.composables.ComposablesReport |
33 | 31 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.parser.ClassReportParser |
34 | 32 | import dev.shreyaspatil.composeCompilerMetricsGenerator.core.parser.ComposableReportParser |
| 33 | +import kotlinx.serialization.decodeFromString |
| 34 | +import kotlinx.serialization.json.Json |
35 | 35 |
|
36 | 36 | /** |
37 | 37 | * Provides metrics and reports of a Compose compiler |
@@ -66,12 +66,11 @@ interface ComposeCompilerMetricsProvider { |
66 | 66 | private class DefaultComposeCompilerMetricsProvider( |
67 | 67 | private val contentProvider: ComposeMetricsContentProvider |
68 | 68 | ) : ComposeCompilerMetricsProvider { |
69 | | - private val moshi = Moshi.Builder().build() |
70 | 69 |
|
71 | 70 | override fun getOverallStatistics(): Map<String, Long> { |
72 | 71 | val statistics = mutableMapOf<String, Long>() |
73 | 72 | contentProvider.briefStatisticsContents.forEach { statContent -> |
74 | | - val stats = moshi.adapter<Map<String, Long>>().fromJson(statContent) ?: emptyMap() |
| 73 | + val stats = Json.decodeFromString<Map<String, Long>>(statContent) |
75 | 74 | if (statistics.isEmpty()) { |
76 | 75 | statistics.putAll(stats) |
77 | 76 | } else { |
|
0 commit comments