-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init public repo by sqash all commits
- Loading branch information
0 parents
commit 5a9115f
Showing
427 changed files
with
32,293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Proposed Changes | ||
|
||
## Testing | ||
|
||
<!--- Please describe how you tested your changes. --> | ||
|
||
## Issues Fixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: App Sizer CI | ||
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: 'Trigger a release build' | ||
required: false | ||
default: '' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | ||
TERM: dumb | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
- name: Build | ||
run: ./gradlew assemble | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: | | ||
gradle-plugin/build/libs/*.jar | ||
clt/build/libs/*.jar | ||
retention-days: 7 | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
- name: Run tests | ||
run: ./gradlew test | ||
|
||
build-sample-app: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
- name: Build sample app | ||
run: | | ||
cd ./sample | ||
./gradlew app:appSizeAnalysisProRelease --stacktrace -Dorg.gradle.debug=false --no-daemon | ||
publish-artifact: | ||
runs-on: ubuntu-latest | ||
if: github.event.inputs.release == 'publish' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: "zulu" | ||
java-version: "17" | ||
- name: Publish to Artifactory | ||
run: ./gradlew artifactoryPublish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.iml | ||
.gradle/ | ||
local.properties | ||
.idea/* | ||
!.idea/copyright | ||
sample/.idea/* | ||
.DS_Store | ||
/build/ | ||
build/ | ||
/captures | ||
|
||
|
||
# Windows thumbnail db | ||
# Idea non-crucial project fileS | ||
*.iws | ||
.java-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
default: | ||
image: gitlab.myteksi.net:4567/mobile/platform/mobile-tooling/base-android:34.0.0 | ||
tags: | ||
- 2xlarge | ||
variables: | ||
GRADLE_OPTS: "-Dorg.gradle.daemon=false" | ||
|
||
stages: | ||
- build | ||
- test | ||
- publish | ||
|
||
build: | ||
stage: build | ||
script: | ||
- ./gradlew assemble | ||
artifacts: | ||
paths: | ||
- gradle-plugin/build/libs/*.jar | ||
- clt/build/libs/*.jar | ||
expire_in: 1 week | ||
|
||
test: | ||
stage: test | ||
script: | ||
- ./gradlew test | ||
|
||
build_sample_app: | ||
stage: test | ||
script: | ||
- cd ./sample | ||
- ./gradlew app:appSizeAnalysisProRelease --stacktrace -Dorg.gradle.debug=false --no-daemon | ||
|
||
publish_artifact: | ||
stage: build | ||
rules: | ||
- if: $RELEASE == "publish" | ||
script: | ||
- ./gradlew artifactoryPublish |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MIT License | ||
|
||
|
||
Copyright 2024 Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved. | ||
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# App Sizer | ||
See the [project website][app-sizer-website] for documentation and APIs. | ||
|
||
## Overview | ||
App Sizer is a tool designed to analyze the download size of Android applications. By providing detailed insights into the composition of your app's binary, App Sizer helps developers identify areas for size reduction, ultimately improving user acquisition and retention rates. | ||
|
||
*The app download size in Android refers to the amount of data a user needs to download from an app store (typically Google Play Store) to install an application on their Android device* | ||
|
||
<p align="center"> | ||
<img src="./docs/images/dashboard.gif" width="95%"> | ||
</p> | ||
|
||
## Key Features | ||
App Sizer offers comprehensive analysis including: | ||
1. Total app download size | ||
2. Detailed size breakdown | ||
3. Size contribution by teams | ||
4. Module-wise size contribution | ||
5. Size contribution by libraries | ||
6. List of large files | ||
|
||
Reports are generated based on the provided Android device specifications. Our [blogpost][blog-post] introduce the tool features | ||
|
||
## Quick Start | ||
|
||
App Sizer provides two flexible integration methods: | ||
|
||
* A Gradle plugin that seamlessly integrates with your Android Gradle project. | ||
* A command-line tool to cater to non-Gradle build systems, offering the same comprehensive features. | ||
|
||
*Note: The command-line option was the original implementation and remains supported for broader compatibility.* | ||
|
||
### Gradle Plugin Integration | ||
In root `build.gradle`: | ||
|
||
```groovy | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath "com.grab:app-sizer:SNAPSHOT" | ||
} | ||
} | ||
``` | ||
In the app module 's `build.gradle` | ||
```groovy | ||
apply plugin: "com.grab.app-sizer" | ||
// AppSizer configuration | ||
appSizer { | ||
// DSL | ||
} | ||
``` | ||
|
||
To run analysis, execute | ||
|
||
``` | ||
./gradlew app:appSizeAnalysisRelease --no-configure-on-demand | ||
``` | ||
|
||
For plugin configuration options, see [Plugin Configuration][plugin_doc]. | ||
|
||
### Cli Tool Integration | ||
To generate the command line binary file, execute | ||
```text | ||
./gradlew clt:shadowJar | ||
``` | ||
|
||
To run analysis using the command line tool, execute | ||
```text | ||
java -jar clt-all.jar --config-file ./path/to/config/app-size-settings.yml | ||
``` | ||
|
||
For command line configuration options, see [Commandline Configuration][cli_doc]. | ||
|
||
## Report Types | ||
|
||
App Sizer currently supports three types of reports: | ||
|
||
* InfluxDB database (1.x) - suitable for CI tracking and enabling the creation of customized dashboards. For InfluxDB and Grafana setup, see our [Docker Setup Guide][grafana-docker]. | ||
* Markdown table for convenient local analysis. | ||
* JSON data for compatibility with other platforms. | ||
|
||
For more detail on reports, see [Report Detail][report_doc] | ||
|
||
## How it works | ||
App Sizer functions as a mapping tool to generate the report. It takes APK, AAR, and JAR files as inputs. | ||
1. **Input parsing**: | ||
- The tool parses the APK down to file and class levels. It calculates the contribution of each component to the total app download size. | ||
- Similarly, App Sizer parses AAR and JAR files. | ||
2. **Mapping and Report Generation**: | ||
- The tool then maps the APK components to their corresponding elements in the AAR and JAR files. | ||
- Based on this analysis and other metadata, App Sizer generates comprehensive reports detailing size contributions. | ||
|
||
## Limitations | ||
|
||
App Sizer approximates class download sizes due to Dex structure complexity, and may not accurately attribute sizes for inline functions or uncategorized files. Results should be interpreted as close estimates, best used for identifying trends and relative size comparisons rather than exact measurements. | ||
|
||
For more details on limitations, see the [Limitation][limitation_doc]. | ||
|
||
## Components | ||
* [Gradle Plugin][gradle-plugin] | ||
* [Command line tool][commandline-tool] | ||
* [InfluxDb & Grafana Docker][grafana-docker] | ||
|
||
## License | ||
|
||
``` | ||
MIT License | ||
Copyright 2024 Grabtaxi Holdings Pte Ltd (GRAB), All rights reserved. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE | ||
``` | ||
[app-sizer-website]: TBA | ||
[report_doc]: ./docs/report.md | ||
[plugin_doc]: ./docs/plugin.md | ||
[cli_doc]: ./docs/cli.md | ||
[limitation_doc]:./docs/limitation.md | ||
[gradle-plugin]: ./gradle-plugin | ||
[commandline-tool]: ./clt | ||
[grafana-docker]: ./docker | ||
[blog-post]: https://engineering.grab.com/project-bonsai | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.