Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cli-config-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project-input:
modules-dir-is-project-root: true
r8-mapping-file: "./path/to/R8/mapping/file.txt"
owner-mapping-file: "./path/to/owner/mapping/file.yml"
library-owner-mapping-file: "./path/to/library/owner/mapping/file.yml"
version: "your/app/version"
large-file-threshold: 10
project-name: "your/project/name"
Expand Down
Binary file modified docker/grafana/grafana.db
Binary file not shown.
Binary file added docker/grafana/grafana.db.bak
Binary file not shown.
24 changes: 24 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ report:
| modules-dir-is-project-root | Boolean value. Enable this flag if you set the root project as the modules-directory to optimize performance |
| r8-mapping-file | Path to the R8 mapping file if you enable R8 for your build |
| owner-mapping-file | Path to YAML file mapping project modules to team owners |
| library-owner-mapping-file | Path to YAML file mapping external libraries (Maven coordinates) to team owners. Optional. |
| version | Your app version |
| large-file-threshold | File size threshold (in bytes) for considering a file as large |
| project-name | Project name |
Expand All @@ -57,6 +58,28 @@ Team2:
- sample-group:android-module-level2
```

And example of `library-owner-mapping-file`:

```yaml
Platform:
- androidx.core:* # all artifacts under the androidx.core group
- androidx.lifecycle:*
Team1:
- com.google.android.material:*
- androidx.navigation:*
Team2:
- org.jetbrains.kotlin:*
- org.jetbrains.kotlinx:*
```

Pattern matching is evaluated in this order; the first match wins:

1. **Exact coordinate** — e.g. `androidx.core:core-ktx:1.13.1`
2. **Group wildcard** using `:*` — e.g. `androidx.core:*` (matches any artifact under `androidx.core`)
3. **Group wildcard** using `.*` — e.g. `androidx.*` (matches any group beginning with `androidx.`)

Libraries that do not match any pattern are attributed to the `app` module (see [Limitations](./limitation.md)).

### APK Generation

| Property | Description |
Expand Down Expand Up @@ -94,6 +117,7 @@ project-input:
modules-dir-is-project-root: true
r8-mapping-file: "./app/build/outputs/mapping/proDebug/mapping.txt"
owner-mapping-file: "./module-owner.yml"
library-owner-mapping-file: "./library-owner.yml"
version: "1.0.1"
large-file-threshold: 10
project-name: "sample"
Expand Down
2 changes: 1 addition & 1 deletion docs/limitation.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The `resources.arsc` file is a special file in Android APKs containing precompil

### Uncategorized Files
* Any files that cannot be categorized as Java/Kotlin code, resources, native libraries, or assets are automatically distributed to the app module and grouped under the **"Others"** category.
* Any files/classes that cannot find an owner (does not belong to a module or library) are automatically distributed to the app module
* Any files/classes that cannot find an owner — i.e. files that don't belong to a module owned in `module-owner.yml` and libraries that don't match any pattern in `library-owner.yml` — are automatically distributed to the `app` module.

## Inline Functions and Classes

Expand Down
25 changes: 25 additions & 0 deletions docs/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ appSizer {
projectInput {
largeFileThreshold = [your_threshold_in_bytes]
teamMappingFile = file("path/to/your/module-owner.yml")
libraryOwnershipFile = file("path/to/your/library-owner.yml")
enableMatchDebugVariant = [true|false]
variantFilter { variant ->
variant.setIgnore(variant.flavors.contains("your-ignore-flavor"))
Expand All @@ -99,6 +100,7 @@ appSizer {
|----------|----------------------------------------------------------------|
| `largeFileThreshold` | File size threshold (in bytes) for considering a file as large. |
| `teamMappingFile` | YAML file mapping project modules to team owners. |
| `libraryOwnershipFile` | YAML file mapping external libraries (Maven coordinates) to team owners. Optional. |
| `enableMatchDebugVariant` | If true, uses debug AAR files to improve build performance. |
| `variantFilter` | Specifies which variants to exclude from analysis. |

Expand All @@ -114,6 +116,28 @@ Team2:
- sample-group:android-module-level2
```

And example of `libraryOwnershipFile`:

```yaml
Platform:
- androidx.core:* # all artifacts under the androidx.core group
- androidx.lifecycle:*
Team1:
- com.google.android.material:*
- androidx.navigation:*
Team2:
- org.jetbrains.kotlin:*
- org.jetbrains.kotlinx:*
```

Pattern matching is evaluated in this order; the first match wins:

1. **Exact coordinate** — e.g. `androidx.core:core-ktx:1.13.1`
2. **Group wildcard** using `:*` — e.g. `androidx.core:*` (matches any artifact under `androidx.core`)
3. **Group wildcard** using `.*` — e.g. `androidx.*` (matches any group beginning with `androidx.`)

Libraries that do not match any pattern are attributed to the `app` module (see [Limitations](./limitation.md)).

### APK Generation

Configure APK generation settings:
Expand Down Expand Up @@ -199,6 +223,7 @@ appSizer {
enableMatchDebugVariant = true
largeFileThreshold = 10
teamMappingFile = file("${rootProject.rootDir}/module-owner.yml")
libraryOwnershipFile = file("${rootProject.rootDir}/library-owner.yml")
}
metrics {
influxDB {
Expand Down
8 changes: 8 additions & 0 deletions docs/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ Markdown tables provide a convenient format for local analysis. The report is sa
| android-module-level1 | Team1 | 124.042 KB |
| kotlin-module | Team2 | 248.326 KB |

### Example: Library-wise Size Contribution

| Contributor | Owner | Size |
|-------------|-------|------|
| androidx.appcompat:appcompat:1.7.0 | Platform | 166.844 KB |
| com.google.android.material:material:1.4.0-beta01 | Team1 | 164.000 KB |
| org.jetbrains.kotlin:kotlin-stdlib:1.8.22 | Team2 | 58.547 KB |

## JSON Report

JSON reports offer compatibility with other platforms and tools. The report is saved as `[option]-metrics.json` in the configured output folder.
Expand Down
135 changes: 109 additions & 26 deletions grafana/dashboard-to-import.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 3,
"iteration": 1718528153248,
"iteration": 1776832837098,
"links": [],
"liveNow": false,
"panels": [
Expand Down Expand Up @@ -229,8 +229,8 @@
"overrides": []
},
"gridPos": {
"h": 15,
"w": 12,
"h": 13,
"w": 24,
"x": 0,
"y": 17
},
Expand Down Expand Up @@ -260,12 +260,12 @@
},
"targets": [
{
"alias": "$tag_contributor",
"alias": "$tag_owner",
"datasource": {
"type": "influxdb",
"uid": "m2unCvxIk"
},
"query": "SELECT last(\"size\") FROM \"app_size\" WHERE (\"type\"='team' and \"app_version\" =~ /^$app_version$/ and \"device_name\" =~ /^$reference_device$/ AND $timeFilter ) GROUP BY \"contributor\"",
"query": "SELECT last(\"size\")\nFROM \"app_size\"\nWHERE (\n \"type\" = 'team'\n AND \"contributor\" = 'total'\n AND \"app_version\" =~ /^$app_version$/\n AND \"device_name\" =~ /^$reference_device$/\n AND $timeFilter\n)\nGROUP BY \"owner\"",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
Expand All @@ -279,7 +279,76 @@
"type": "influxdb",
"uid": "m2unCvxIk"
},
"description": "A list of module names associated with the selected 'Team Name' filter, accompanied by a graph illustrating the contribution of each module to the app download size.\nYou have the option to filter by App Version, Reference Device and Team Name",
"description": "A compilation of libraries, each denoted with the size it contributes to the overall App Download Size. You have the option to filter by App Version and Reference Device.",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 15,
"w": 24,
"x": 0,
"y": 30
},
"id": 7,
"options": {
"displayLabels": [],
"legend": {
"displayMode": "table",
"placement": "right",
"values": [
"percent",
"value"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "$tag_contributor",
"datasource": {
"type": "influxdb",
"uid": "m2unCvxIk"
},
"query": "SELECT last(\"size\") FROM \"app_size\" WHERE (\"type\" = 'library' AND \"app_version\" =~ /^$app_version$/ AND \"device_name\" =~ /^$reference_device$/ AND $timeFilter ) GROUP BY \"contributor\"\n",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
}
],
"title": "App Download Size Breakdown by Libraries",
"type": "piechart"
},
{
"datasource": {
"type": "influxdb",
"uid": "m2unCvxIk"
},
"description": "A list of module names/libraries associated with the selected 'Team Name' filter, accompanied by a graph illustrating the contribution of each module to the app download size.\nYou have the option to filter by App Version, Reference Device, and Team Name",
"fieldConfig": {
"defaults": {
"color": {
Expand All @@ -300,8 +369,8 @@
"gridPos": {
"h": 15,
"w": 12,
"x": 12,
"y": 17
"x": 0,
"y": 45
},
"id": 6,
"options": {
Expand Down Expand Up @@ -333,21 +402,34 @@
"type": "influxdb",
"uid": "m2unCvxIk"
},
"query": "SELECT last(\"size\") FROM \"app_size\" WHERE (\"type\" = 'module' AND \"app_version\" =~ /^$app_version$/ and \"device_name\" =~ /^$reference_device$/ and \"owner\" =~ /^$tf_name$/ ) GROUP BY \"contributor\"",
"query": "SELECT last(\"size\") FROM \"app_size\"\nWHERE (\"type\" = 'module'\n AND \"app_version\" =~ /^$app_version$/\n AND \"device_name\" =~ /^$reference_device$/\n AND \"owner\" =~ /^$tf_name$/)\nGROUP BY \"contributor\"",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
},
{
"alias": "$tag_contributor",
"datasource": {
"type": "influxdb",
"uid": "m2unCvxIk"
},
"hide": false,
"query": "SELECT last(\"size\") FROM \"app_size\"\nWHERE (\"type\" = 'library'\n AND \"app_version\" =~ /^$app_version$/\n AND \"device_name\" =~ /^$reference_device$/\n AND \"owner\" =~ /^$tf_name$/)\nGROUP BY \"contributor\"",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series"
}
],
"title": "Team Codebase Breakdown (Select the team name to see the detail)",
"title": "Team Breakdown (Select the team name to see the detail)",
"transformations": [],
"type": "piechart"
},
{
"datasource": {
"type": "influxdb",
"uid": "m2unCvxIk"
},
"description": "A compilation of libraries, each denoted with the size it contributes to the overall App Download Size. You have the option to filter by App Version and Reference Device.",
"description": "A graph representation of the breakdown of the Team Download Size by individual components. You have the option to filter by App Version, Reference Device, and Team name",
"fieldConfig": {
"defaults": {
"color": {
Expand All @@ -367,13 +449,12 @@
},
"gridPos": {
"h": 15,
"w": 24,
"x": 0,
"y": 32
"w": 12,
"x": 12,
"y": 45
},
"id": 7,
"id": 11,
"options": {
"displayLabels": [],
"legend": {
"displayMode": "table",
"placement": "right",
Expand Down Expand Up @@ -402,13 +483,14 @@
"type": "influxdb",
"uid": "m2unCvxIk"
},
"query": "SELECT last(\"size\") FROM \"app_size\" WHERE (\"type\" = 'library' AND \"app_version\" =~ /^$app_version$/ AND \"device_name\" =~ /^$reference_device$/ AND $timeFilter ) GROUP BY \"contributor\"\n",
"query": "SELECT last(\"size\")\nFROM \"app_size\"\nWHERE (\n \"type\" = 'team'\n AND \"contributor\" != 'total'\n AND \"app_version\" =~ /^$app_version$/\n AND \"owner\" =~ /^$tf_name$/\n AND \"device_name\" =~ /^$reference_device$/\n AND $timeFilter\n)\nGROUP BY \"contributor\"",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series"
}
],
"title": "App Download Size Breakdown by Libraries",
"title": "Team Breakdown by main Components (Select the team name to see the detail)",
"transformations": [],
"type": "piechart"
},
{
Expand All @@ -433,7 +515,8 @@
"mode": "absolute",
"steps": [
{
"color": "green"
"color": "green",
"value": null
},
{
"color": "red",
Expand All @@ -449,7 +532,7 @@
"h": 9,
"w": 24,
"x": 0,
"y": 47
"y": 60
},
"id": 8,
"options": {
Expand Down Expand Up @@ -505,9 +588,9 @@
"list": [
{
"current": {
"selected": false,
"text": "1.0.2",
"value": "1.0.2"
"selected": true,
"text": "0.0.1",
"value": "0.0.1"
},
"datasource": {
"type": "influxdb",
Expand All @@ -529,7 +612,7 @@
},
{
"current": {
"selected": false,
"selected": true,
"text": "device-1",
"value": "device-1"
},
Expand Down Expand Up @@ -585,6 +668,6 @@
"timezone": "",
"title": "App Download Size Breakdown",
"uid": "FBZO0xxSk",
"version": 51,
"version": 57,
"weekStart": ""
}
}
Loading