Skip to content

Commit

Permalink
fix apk total size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xera committed Jan 17, 2025
1 parent f57e96b commit 26a0a97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ internal class BasicApkAnalyzer @Inject constructor(
val assetDownloadSize = flatMap { it.assets }.sumOf { it.downloadSize }
val otherDownloadSize = flatMap { it.others }.sumOf { it.downloadSize }
val dexDownloadFile = flatMap { it.dexes }.sumOf { it.downloadSize }
val classDownloadSize = flatMap { it.dexes }.flatMap { it.classes }.sumOf { it.downloadSize }
val total =
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + classDownloadSize
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + dexDownloadFile

return listOf(
createRow(
Expand Down
7 changes: 4 additions & 3 deletions app-sizer/src/main/kotlin/com/grab/sizer/report/ReportExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ internal fun Set<ApkFileInfo>.apksSizeReport(): ReportItem {
val assetDownloadSize = flatMap { it.assets }.sumOf { it.downloadSize }
val otherDownloadSize = flatMap { it.others }.sumOf { it.downloadSize }
val classDownloadSize = flatMap { it.dexes }.flatMap { it.classes }.sumOf { it.downloadSize }
val dexDownloadSize = flatMap { it.dexes }.sumOf { it.downloadSize }
val total =
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + classDownloadSize
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + dexDownloadSize

return ReportItem(
id = "apk",
Expand All @@ -57,9 +58,9 @@ internal fun Set<ApkFileInfo>.toReportField(): List<Field> {
val nativeLibDownloadSize = flatMap { it.nativeLibs }.sumOf { it.downloadSize }
val assetDownloadSize = flatMap { it.assets }.sumOf { it.downloadSize }
val otherDownloadSize = flatMap { it.others }.sumOf { it.downloadSize }
val classDownloadSize = flatMap { it.dexes }.flatMap { it.classes }.sumOf { it.downloadSize }
val dexDownloadSize = flatMap { it.dexes }.sumOf { it.downloadSize }
val total =
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + classDownloadSize
resourceDownloadSize + nativeLibDownloadSize + assetDownloadSize + otherDownloadSize + dexDownloadSize
return listOf(
TagField(
name = FIELD_KEY_CONTRIBUTOR,
Expand Down

0 comments on commit 26a0a97

Please sign in to comment.