From 723e68a2e078ea9395593e3b631974d82a3e5b2a Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Wed, 27 Nov 2024 00:05:14 +0800 Subject: [PATCH] Rename Clt to Cli & fix pages issues --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 10 ++--- .gitlab-ci.yml | 2 +- CODEOWNERS | 1 + README.md | 43 ++++++++++--------- {clt => cli}/build.gradle | 2 +- .../kotlin/com/grab/sizer/AnalyzerCommand.kt | 8 ++-- .../kotlin/com/grab/sizer/ApkGenerator.kt | 0 .../kotlin/com/grab/sizer/CliInputProvider.kt | 2 +- .../com/grab/sizer/CliOutputProvider.kt | 2 +- .../grab/sizer/config/ApkGenerationConfig.kt | 0 .../kotlin/com/grab/sizer/config/Config.kt | 0 .../com/grab/sizer/config/ProjectInput.kt | 0 .../kotlin/com/grab/sizer/config/Report.kt | 0 .../src/main/kotlin/com/grab/sizer/main.kt | 0 .../kotlin/com/grab/sizer/utils/CliLogger.kt | 2 +- .../kotlin/com/grab/sizer/utils/FileQuery.kt | 0 .../com/grab/sizer/CliInputProviderTest.kt | 26 +++++------ .../kotlin/com/grab/sizer/TestingProject1.kt | 2 +- docs/cli.md | 8 ++-- docs/docker.md | 10 ++--- docs/index.md | 29 +++++++------ docs/limitation.md | 10 ++--- docs/plugin.md | 14 +++--- docs/report.md | 13 +++--- gradle-plugin/build.gradle | 2 +- gradle/libs.versions.toml | 4 +- mkdocs.yml | 8 ++-- sample/README.md | 2 +- sample/app-size-config/app-size-settings.yml | 24 +++++------ sample/app/build.gradle | 2 +- sample/{exec-clt.sh => exec-cli.sh} | 6 +-- settings.gradle | 5 ++- 33 files changed, 122 insertions(+), 117 deletions(-) create mode 100644 CODEOWNERS rename {clt => cli}/build.gradle (97%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt (94%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/ApkGenerator.kt (100%) rename clt/src/main/kotlin/com/grab/sizer/CltInputProvider.kt => cli/src/main/kotlin/com/grab/sizer/CliInputProvider.kt (99%) rename clt/src/main/kotlin/com/grab/sizer/CltOutputProvider.kt => cli/src/main/kotlin/com/grab/sizer/CliOutputProvider.kt (99%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/config/ApkGenerationConfig.kt (100%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/config/Config.kt (100%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/config/ProjectInput.kt (100%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/config/Report.kt (100%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/main.kt (100%) rename clt/src/main/kotlin/com/grab/sizer/utils/CltLogger.kt => cli/src/main/kotlin/com/grab/sizer/utils/CliLogger.kt (98%) rename {clt => cli}/src/main/kotlin/com/grab/sizer/utils/FileQuery.kt (100%) rename clt/src/test/kotlin/com/grab/sizer/CltInputProviderTest.kt => cli/src/test/kotlin/com/grab/sizer/CliInputProviderTest.kt (88%) rename {clt => cli}/src/test/kotlin/com/grab/sizer/TestingProject1.kt (99%) rename sample/{exec-clt.sh => exec-cli.sh} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71728e1..fd5acf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: name: build-artifacts path: | gradle-plugin/build/libs/*.jar - clt/build/libs/*.jar + cli/build/libs/*.jar retention-days: 7 test: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c6b7d7..b0a6d85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,12 +28,12 @@ jobs: run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Build CLI JAR - run: ./gradlew clt:shadowJar + run: ./gradlew cli:shadowJar - name: Rename and prepare assets run: | - cd ./clt/build/libs - mv clt-all.jar app-sizer-cli-${{ env.VERSION }}.jar + cd ./cli/build/libs + mv cli-all.jar app-sizer-cli-${{ env.VERSION }}.jar sha256sum app-sizer-cli-${{ env.VERSION }}.jar > app-sizer-cli-${{ env.VERSION }}.jar.sha256 - name: Upload CLI JAR @@ -42,7 +42,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./clt/build/libs/app-sizer-cli-${{ env.VERSION }}.jar + asset_path: ./cli/build/libs/app-sizer-cli-${{ env.VERSION }}.jar asset_name: app-sizer-cli-${{ env.VERSION }}.jar asset_content_type: application/java-archive @@ -52,7 +52,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} - asset_path: ./clt/build/libs/app-sizer-cli-${{ env.VERSION }}.jar.sha256 + asset_path: ./cli/build/libs/app-sizer-cli-${{ env.VERSION }}.jar.sha256 asset_name: app-sizer-cli-${{ env.VERSION }}.jar.sha256 asset_content_type: text/plain diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 829b267..d87509f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ build: artifacts: paths: - gradle-plugin/build/libs/*.jar - - clt/build/libs/*.jar + - cli/build/libs/*.jar expire_in: 1 week test: diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..3cba715 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @minkuanlim-grabtaxi @vanminh-grabtaxi @arunsampathkumar-grabtaxi @mohammadkahelghi-grabtaxi @stevenchao-grabtaxi @arnav-grabtaxi @adarsh-grabtaxi diff --git a/README.md b/README.md index 50f4587..28e16ec 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # App Sizer -See the [project website][app-sizer-website] for documentation and APIs. +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. @@ -21,7 +21,7 @@ App Sizer offers comprehensive analysis including: 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 +Reports are generated based on the provided Android device specifications. Our [blogpost][blog_post] introduce the tool features ## Quick Start @@ -70,7 +70,7 @@ For plugin configuration options, see [Plugin Configuration][plugin_doc]. To run analysis using the command line tool, execute ```text -java -jar clt-all.jar --config-file ./path/to/config/app-size-settings.yml +java -jar cli-all.jar --config-file ./path/to/config/app-size-settings.yml ``` For command line configuration options, see [Commandline Configuration][cli_doc]. @@ -79,7 +79,7 @@ For command line configuration options, see [Commandline Configuration][cli_doc] App Sizer currently supports three types of reports: -* InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our [Docker Setup Guide][grafana-docker]. +* InfluxDB database (1.x) - It is suitable for CI tracking and enabling the creation of customized dashboards (with visualization tools like Grafana). We provide an InfluxDB and Grafana setup; see our [Docker Setup Guide][grafana_docker_doc]. * Markdown table for convenient local analysis. * JSON data for compatibility with other platforms. @@ -92,11 +92,11 @@ For more detail on reports, see [Report Detail][report_doc] 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. + - 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. + - 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 @@ -105,9 +105,9 @@ App Sizer approximates class download sizes due to Dex structure complexity, and 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] +* [Gradle Plugin][gradle_plugin] +* [Command line tool][commandline_tool] +* [InfluxDb & Grafana Docker][grafana_docker] ## Contributing @@ -143,16 +143,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE ``` -[app-sizer-website]: https://grab.github.io/App-Sizer/ -[report_doc]: https://engineering.grab.com/App-Sizer/report/ -[plugin_doc]: https://engineering.grab.com/App-Sizer/plugin/ -[cli_doc]: https://engineering.grab.com/App-Sizer/cli/ -[limitation_doc]:https://engineering.grab.com/App-Sizer/limitation/ -[gradle-plugin]: ./gradle-plugin -[commandline-tool]: ./clt -[grafana-docker]: ./docker -[blog-post]: https://engineering.grab.com/project-bonsai -[latest_release_link]: https://github.com/grab/App-Sizer/releases +[app_sizer_website]: https://grab.github.io/app-sizer/ +[report_doc]: https://engineering.grab.com/app-sizer/report/ +[plugin_doc]: https://engineering.grab.com/app-sizer/plugin/ +[cli_doc]: https://engineering.grab.com/app-sizer/cli/ +[grafana_docker_doc]: https://engineering.grab.com/app-sizer/docker/ +[limitation_doc]:https://engineering.grab.com/app-sizer/limitation/ +[gradle_plugin]: ./gradle-plugin +[commandline_tool]: ./cli +[grafana_docker]: ./docker +[blog_post]: https://engineering.grab.com/project-bonsai +[latest_release_link]: https://github.com/grab/app-sizer/releases diff --git a/clt/build.gradle b/cli/build.gradle similarity index 97% rename from clt/build.gradle rename to cli/build.gradle index 05675c1..c713ce3 100644 --- a/clt/build.gradle +++ b/cli/build.gradle @@ -37,7 +37,7 @@ shadowJar { attributes 'Main-Class': 'com.grab.sizer.MainKt' } - archiveBaseName.set('clt-app-sizer') + archiveBaseName.set('cli-app-sizer') archiveClassifier.set('') archiveVersion.set('') diff --git a/clt/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt b/cli/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt similarity index 94% rename from clt/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt rename to cli/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt index c3da054..56118fa 100644 --- a/clt/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt +++ b/cli/src/main/kotlin/com/grab/sizer/AnalyzerCommand.kt @@ -31,7 +31,7 @@ import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.* import com.grab.sizer.config.Config import com.grab.sizer.config.ConfigYmlLoader -import com.grab.sizer.utils.CltLogger +import com.grab.sizer.utils.CliLogger import com.grab.sizer.utils.DefaultFileQuery import com.grab.sizer.utils.Logger import java.io.File @@ -70,17 +70,17 @@ class AnalyzerCommand : CliktCommand() { .also { it.validateInput() } - val logger: Logger = CltLogger() + val logger: Logger = CliLogger() DefaultApkGenerator.create(config) .generate(config.apkGeneration.deviceSpecs) .forEach { apkDirectory -> AppSizer( - inputProvider = CltInputProvider( + inputProvider = CliInputProvider( fileQuery = DefaultFileQuery(), config = config, apksDirectory = apkDirectory ), - outputProvider = CltOutputProvider(config, apkDirectory.nameWithoutExtension), + outputProvider = CliOutputProvider(config, apkDirectory.nameWithoutExtension), libName = libName, logger = logger ).process(reportOption) diff --git a/clt/src/main/kotlin/com/grab/sizer/ApkGenerator.kt b/cli/src/main/kotlin/com/grab/sizer/ApkGenerator.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/ApkGenerator.kt rename to cli/src/main/kotlin/com/grab/sizer/ApkGenerator.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/CltInputProvider.kt b/cli/src/main/kotlin/com/grab/sizer/CliInputProvider.kt similarity index 99% rename from clt/src/main/kotlin/com/grab/sizer/CltInputProvider.kt rename to cli/src/main/kotlin/com/grab/sizer/CliInputProvider.kt index 79a0311..fe4807b 100644 --- a/clt/src/main/kotlin/com/grab/sizer/CltInputProvider.kt +++ b/cli/src/main/kotlin/com/grab/sizer/CliInputProvider.kt @@ -50,7 +50,7 @@ class DefaultFileSystem : FileSystem { override fun create(parent: File, path: String): File = File(parent, path) } -class CltInputProvider constructor( +class CliInputProvider constructor( private val fileQuery: FileQuery, private val config: Config, private val apksDirectory: File, diff --git a/clt/src/main/kotlin/com/grab/sizer/CltOutputProvider.kt b/cli/src/main/kotlin/com/grab/sizer/CliOutputProvider.kt similarity index 99% rename from clt/src/main/kotlin/com/grab/sizer/CltOutputProvider.kt rename to cli/src/main/kotlin/com/grab/sizer/CliOutputProvider.kt index a5edb20..2ead692 100644 --- a/clt/src/main/kotlin/com/grab/sizer/CltOutputProvider.kt +++ b/cli/src/main/kotlin/com/grab/sizer/CliOutputProvider.kt @@ -35,7 +35,7 @@ import com.grab.sizer.report.db.InfluxDBConfig import com.grab.sizer.utils.OutputProvider import java.io.File -class CltOutputProvider( +class CliOutputProvider( private val config: Config, private val deviceName: String ) : OutputProvider { diff --git a/clt/src/main/kotlin/com/grab/sizer/config/ApkGenerationConfig.kt b/cli/src/main/kotlin/com/grab/sizer/config/ApkGenerationConfig.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/config/ApkGenerationConfig.kt rename to cli/src/main/kotlin/com/grab/sizer/config/ApkGenerationConfig.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/config/Config.kt b/cli/src/main/kotlin/com/grab/sizer/config/Config.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/config/Config.kt rename to cli/src/main/kotlin/com/grab/sizer/config/Config.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/config/ProjectInput.kt b/cli/src/main/kotlin/com/grab/sizer/config/ProjectInput.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/config/ProjectInput.kt rename to cli/src/main/kotlin/com/grab/sizer/config/ProjectInput.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/config/Report.kt b/cli/src/main/kotlin/com/grab/sizer/config/Report.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/config/Report.kt rename to cli/src/main/kotlin/com/grab/sizer/config/Report.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/main.kt b/cli/src/main/kotlin/com/grab/sizer/main.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/main.kt rename to cli/src/main/kotlin/com/grab/sizer/main.kt diff --git a/clt/src/main/kotlin/com/grab/sizer/utils/CltLogger.kt b/cli/src/main/kotlin/com/grab/sizer/utils/CliLogger.kt similarity index 98% rename from clt/src/main/kotlin/com/grab/sizer/utils/CltLogger.kt rename to cli/src/main/kotlin/com/grab/sizer/utils/CliLogger.kt index 8ae9ab4..3e2d9dc 100644 --- a/clt/src/main/kotlin/com/grab/sizer/utils/CltLogger.kt +++ b/cli/src/main/kotlin/com/grab/sizer/utils/CliLogger.kt @@ -27,7 +27,7 @@ package com.grab.sizer.utils -class CltLogger : Logger { +class CliLogger : Logger { override fun log(tag: String, message: String) { println("$tag : $message") } diff --git a/clt/src/main/kotlin/com/grab/sizer/utils/FileQuery.kt b/cli/src/main/kotlin/com/grab/sizer/utils/FileQuery.kt similarity index 100% rename from clt/src/main/kotlin/com/grab/sizer/utils/FileQuery.kt rename to cli/src/main/kotlin/com/grab/sizer/utils/FileQuery.kt diff --git a/clt/src/test/kotlin/com/grab/sizer/CltInputProviderTest.kt b/cli/src/test/kotlin/com/grab/sizer/CliInputProviderTest.kt similarity index 88% rename from clt/src/test/kotlin/com/grab/sizer/CltInputProviderTest.kt rename to cli/src/test/kotlin/com/grab/sizer/CliInputProviderTest.kt index 7690951..195d60e 100644 --- a/clt/src/test/kotlin/com/grab/sizer/CltInputProviderTest.kt +++ b/cli/src/test/kotlin/com/grab/sizer/CliInputProviderTest.kt @@ -32,7 +32,7 @@ import org.junit.Assert import org.junit.Test import java.io.File -class CltInputProviderTest { +class CliInputProviderTest { private val fileQuery = DefaultFileQuery() private val testingProject1 = TestingProject1() private val config = testingProject1.config @@ -44,13 +44,13 @@ class CltInputProviderTest { projectInput = config.projectInput.copy(projectRoot = File("./abc")) ) - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val moduleAars = cltInputProvider.provideModuleAar() + val moduleAars = cliInputProvider.provideModuleAar() .toList() .sortedBy { it.file } .toTypedArray() @@ -67,13 +67,13 @@ class CltInputProviderTest { projectInput = config.projectInput.copy(projectRoot = File("./abc")) ) - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val moduleJars = cltInputProvider.provideModuleJar() + val moduleJars = cliInputProvider.provideModuleJar() .toList() .sortedBy { it.file } .toTypedArray() @@ -86,13 +86,13 @@ class CltInputProviderTest { @Test fun provideModuleAarShouldGetCorrectAarFromProjectFolderWhenModulesDirIsProjectRoot() { - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val moduleAars = cltInputProvider.provideModuleAar() + val moduleAars = cliInputProvider.provideModuleAar() .toList() .sortedBy { it.file } .toTypedArray() @@ -106,13 +106,13 @@ class CltInputProviderTest { @Test fun provideModuleJarShouldGetCorrectJarFromProjectFolderWhenModulesDirIsProjectRoot() { - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val moduleJars = cltInputProvider.provideModuleJar() + val moduleJars = cliInputProvider.provideModuleJar() .toList() .sortedBy { it.tag } .toTypedArray() @@ -125,13 +125,13 @@ class CltInputProviderTest { @Test fun provideLibraryAarShouldGetAllAarFromFolder() { - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val libraryAar = cltInputProvider.provideLibraryAar().toList() + val libraryAar = cliInputProvider.provideLibraryAar().toList() .sortedBy { it.tag } .toTypedArray() val expectingLibAars = testingProject1.expectingLibAars @@ -143,13 +143,13 @@ class CltInputProviderTest { @Test fun provideLibraryJarShouldGetAllAarFromFolder() { - val cltInputProvider = CltInputProvider( + val cliInputProvider = CliInputProvider( fileQuery = fileQuery, config = config, apksDirectory = File("FakeDir"), fileSystem = testingProject1 ) - val libraryJars = cltInputProvider.provideLibraryJar() + val libraryJars = cliInputProvider.provideLibraryJar() .toList() .sortedBy { it.tag } .toTypedArray() diff --git a/clt/src/test/kotlin/com/grab/sizer/TestingProject1.kt b/cli/src/test/kotlin/com/grab/sizer/TestingProject1.kt similarity index 99% rename from clt/src/test/kotlin/com/grab/sizer/TestingProject1.kt rename to cli/src/test/kotlin/com/grab/sizer/TestingProject1.kt index 1ecfa6f..4213fb7 100644 --- a/clt/src/test/kotlin/com/grab/sizer/TestingProject1.kt +++ b/cli/src/test/kotlin/com/grab/sizer/TestingProject1.kt @@ -49,7 +49,7 @@ internal const val WORK_MULTIPROCESS_AAR = "work-multiprocess-2.8.0.aar" internal const val WORK_MULTIPROCESS_POM = "work-multiprocess-2.8.0.pom" /** - * This class contain a project files & folders for testing the [CltInputProvider] + * This class contain a project files & folders for testing the [CliInputProvider] * It build a project with this structure: * ``` * ./user-folder/root-project diff --git a/docs/cli.md b/docs/cli.md index 0db428c..6fa154a 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -11,12 +11,12 @@ App Sizer provides a Command Line Interface (CLI) to cater to non-Gradle build s 3. Run the analysis using the command line tool: ``` - java -jar clt-all.jar --config-file ./path/to/config/your-config-file.yml + java -jar cli-all.jar --config-file ./path/to/config/your-config-file.yml ``` *Note, by any reason the download Jar does not work. You could check out the repo and generate the command line binary file* ``` - ./gradlew clt:shadowJar + ./gradlew cli:shadowJar ``` ## Configuration @@ -133,5 +133,5 @@ report: - [InfluxDB Documentation](https://www.influxdata.com/time-series-platform/) -[cli-template-link]: https://github.com/grab/App-Sizer/blob/master/cli-config-template.yml -[latest_release_link]: https://github.com/grab/App-Sizer/releases \ No newline at end of file +[cli-template-link]: https://github.com/grab/app-sizer/blob/master/cli-config-template.yml +[latest_release_link]: https://github.com/grab/app-sizer/releases \ No newline at end of file diff --git a/docs/docker.md b/docs/docker.md index 9c71df0..8a52328 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -27,10 +27,10 @@ The Docker image includes a pre-configured dashboard in Grafana: To use the dashboard, you either to: -- **Default Configuration**: Uses database name `sizer` and measurement (table) named `app_size`. (They are default values configured in the App Sizer tool) -- **Custom Configuration**: - - For a different database name: Update the [Grafana Data Sources](https://grafana.com/docs/grafana/latest/datasources/) named InfluxDB. - - For a different measurement name: Update all [queries](https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/) and [variables](https://grafana.com/docs/grafana/latest/dashboards/variables/) in the dashboard. +1. **Default Configuration**: Uses database name `sizer` and measurement (table) named `app_size`. (They are default values configured in the App Sizer tool) +2. **Custom Configuration**: + - For a different database name: Update the [Grafana Data Sources](https://grafana.com/docs/grafana/latest/datasources/) named InfluxDB. + - For a different measurement name: Update all [queries](https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/) and [variables](https://grafana.com/docs/grafana/latest/dashboards/variables/) in the dashboard. To import the dashboard into an existing setup: @@ -74,7 +74,7 @@ docker run -d \ - Default Password: `root` -[json-dashboard-file]: https://github.com/grab/App-Sizer/blob/master/grafana/dashboard-to-import.json +[json-dashboard-file]: https://github.com/grab/app-sizer/blob/master/grafana/dashboard-to-import.json [app-sizer-page]: ./index.md [grafana-version]: https://img.shields.io/badge/Grafana-9.0.0-brightgreen [influx-version]: https://img.shields.io/badge/Influx-1.8.2-brightgreen diff --git a/docs/index.md b/docs/index.md index eb8479f..ceec2a3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ App Sizer offers comprehensive analysis including: 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 +Reports are generated based on the provided Android device specifications. Our [blogpost][blog_post] introduce the tool features ## Quick Start @@ -69,7 +69,7 @@ For plugin configuration options, see [Plugin Configuration][plugin_doc]. To run analysis using the command line tool, execute ```text -java -jar clt-all.jar --config-file ./path/to/config/app-size-settings.yml +java -jar cli-all.jar --config-file ./path/to/config/app-size-settings.yml ``` For command line configuration options, see [Commandline Configuration][cli_doc]. @@ -91,11 +91,11 @@ For more detail on reports, see [Report Detail][report_doc] 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. + - 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. + - 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 @@ -104,9 +104,9 @@ App Sizer approximates class download sizes due to Dex structure complexity, and 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] +* [Gradle Plugin][gradle_plugin] +* [Command line tool][commandline_tool] +* [InfluxDb & Grafana Docker][grafana_docker] ## Contributing @@ -145,12 +145,13 @@ SOFTWARE [report_doc]: ./report.md [plugin_doc]: ./plugin.md [cli_doc]: ./cli.md +[grafana_docker_doc]: ./docker.md [limitation_doc]:./limitation.md -[gradle-plugin]: ../gradle-plugin -[commandline-tool]: ../clt -[grafana-docker]: ../docker -[blog-post]: https://engineering.grab.com/project-bonsai -[latest_release_link]: https://github.com/grab/App-Sizer/releases +[gradle_plugin]: https://github.com/grab/app-sizer/tree/master/gradle-plugin +[commandline_tool]: https://github.com/grab/app-sizer/tree/master/cli +[grafana_docker]: https://github.com/grab/app-sizer/tree/master/docker +[blog_post]: https://engineering.grab.com/project-bonsai +[latest_release_link]: https://github.com/grab/app-sizer/releases diff --git a/docs/limitation.md b/docs/limitation.md index 7525f48..a13d0d9 100644 --- a/docs/limitation.md +++ b/docs/limitation.md @@ -6,7 +6,7 @@ App Sizer is a powerful tool, but it has some limitations that users should be a Calculating the exact download size of a class from an APK is challenging. App Sizer uses an approximation method: -1. We obtain a relative [size of the class definition][class-size] (termed 'raw size'). +1. We obtain a relative [size of the class definition][class_size] (termed 'raw size'). 2. We use the Dex file download size that the class belongs to. 3. We derive a relative value for the class's download size using the formula: @@ -31,7 +31,7 @@ The `resources.arsc` file is a special file in Android APKs containing precompil ## Inline Functions and Classes -The nature of [inline functions][inline-functions] and [inline value classes][inline-class] in Kotlin presents a unique challenge: +The nature of [inline functions][inline_functions] and [inline value classes][inline_class] in Kotlin presents a unique challenge: - The size contributed by inline elements is calculated and distributed to where they are used, not where the inline methods/classes are created. - Build systems or optimization tools like R8 might rewrite code for efficiency, including inlining methods, which can result in similar outcomes to inline functions. @@ -48,6 +48,6 @@ These limitations mean that App Sizer's results should be interpreted as close a Users should keep these limitations in mind when making decisions based on App Sizer's output, especially for small projects or when dealing with inline-heavy codebases. -[class-size]: https://github.com/JesusFreke/smali/blob/master/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/DexBackedClassDef.java#L505 -[inline-functions]: https://kotlinlang.org/docs/inline-functions.html -[inline-class]: https://kotlinlang.org/docs/inline-classes.html \ No newline at end of file +[class_size]: https://github.com/JesusFreke/smali/blob/master/dexlib2/src/main/java/org/jf/dexlib2/dexbacked/DexBackedClassDef.java#L505 +[inline_functions]: https://kotlinlang.org/docs/inline-functions.html +[inline_class]: https://kotlinlang.org/docs/inline-classes.html \ No newline at end of file diff --git a/docs/plugin.md b/docs/plugin.md index ba58add..5dc515c 100644 --- a/docs/plugin.md +++ b/docs/plugin.md @@ -54,11 +54,11 @@ Configure the input for the project: ```groovy appSizer { projectInput { - largeFileThreshold = 10 - teamMappingFile = file("${rootProject.rootDir}/module-owner.yml") - enableMatchDebugVariant = true + largeFileThreshold = [your_threshold_in_bytes] + teamMappingFile = file("path/to/your/module-owner.yml") + enableMatchDebugVariant = [true|false] variantFilter { variant -> - variant.setIgnore(variant.flavors.contains("ignore-flavor")) + variant.setIgnore(variant.flavors.contains("your-ignore-flavor")) } apk { // APK Generation @@ -97,10 +97,10 @@ appSizer { ... apk { deviceSpecs = [ - file("${rootProject.rootDir}/app-size-config/device-1.json"), - file("${rootProject.rootDir}/app-size-config/device-2.json") + file("path/to/device-1.json"), + file("path/to/device-2.json"), ] - bundleToolFile = file("${rootProject.rootDir}/binary/bundletool-all-1.15.4.jar") + bundleToolFile = file("path/to/bundletool.jar") } } ... diff --git a/docs/report.md b/docs/report.md index 8138dd2..7677317 100644 --- a/docs/report.md +++ b/docs/report.md @@ -23,12 +23,12 @@ docker run -d \ mikenguyen/sizer-influx-grafana:latest ``` -For more details on the Docker setup, see our [Docker guide][grafana-docker]. +For more details on the Docker setup, see our [Docker guide][grafana_docker_doc]. ### Grafana Dashboard -A default **App Download Size Breakdown** dashboard is included in the Grafana docker instance. If you have an existing InfluxDB and Grafana setup, you can import our dashboard using this [JSON file][json-dashboard-file]. -Our [blogpost][blog-post] introduce the provided dashboards +A default **App Download Size Breakdown** dashboard is included in the Grafana docker instance. If you have an existing InfluxDB and Grafana setup, you can import our dashboard using this [JSON file][json_dashboard_file]. +Our [blogpost][blog_post] introduce the provided dashboards ## Markdown Tables @@ -123,11 +123,10 @@ You can parse this JSON data using any standard JSON library in your preferred p You can customize the reports by modifying the configuration in your Gradle plugin or CLI tool setup. For more details, refer to the [Plugin Configuration][plugin_doc] or [CLI Configuration][cli_doc] guides. -[grafana-docker]: ../docker -[grafana-dashboard]: ../grafana/dashboard-to-import.json +[grafana_docker_doc]: ./docker.md [plugin_doc]: ./plugin.md [cli_doc]: ./cli.md -[json-dashboard-file]: https://github.com/grab/App-Sizer/blob/master/grafana/dashboard-to-import.json -[blog-post]: https://engineering.grab.com/project-bonsai +[json_dashboard_file]: https://github.com/grab/app-sizer/blob/master/grafana/dashboard-to-import.json +[blog_post]: https://engineering.grab.com/project-bonsai diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 05b3c56..d891d4c 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -58,7 +58,7 @@ dependencies { gradlePlugin { plugins { appSizerPlugin { - id = 'com.grab.app-sizer' + id = 'com.grab.sizer' implementationClass = 'com.grab.plugin.sizer.AppSizerPlugin' displayName = "app-sizer-plugin" } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 19a3db8..829c215 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -gradle-plugin-publish = "0.14.0" +gradle-plugin-publish = "1.2.1" android-gradle-plugin = "8.5.1" kotlin = "1.9.22" kotlin-dsl = "4.3.1" @@ -44,4 +44,4 @@ kotlin-dsl = { id = "org.gradle.kotlin.kotlin-dsl", version.ref = "kotlin-dsl" } gradle-plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-plugin-publish" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } -johnrengelman-shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-jar" } \ No newline at end of file +johnrengelman-shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-jar" } diff --git a/mkdocs.yml b/mkdocs.yml index dab9875..fdff079 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,11 +1,11 @@ site_name: App Sizer site_description: "App Sizer is a tool designed to analyze the download size of Android applications" site_author: "Grab, Inc" -site_url: "https://grab.github.io/App-Sizer/" +site_url: "https://grab.github.io/app-sizer/" remote_branch: gh-pages -repo_name: "App-Sizer" -repo_url: "https://github.com/grab/App-Sizer" +repo_name: "app-sizer" +repo_url: "https://github.com/grab/app-sizer" copyright: "Copyright 2024 Grabtaxi Holdings PTE LTE (GRAB)" @@ -71,4 +71,4 @@ extra_css: extra: social: - icon: fontawesome/brands/github - link: https://github.com/grab/App-Sizer \ No newline at end of file + link: https://github.com/grab/app-sizer \ No newline at end of file diff --git a/sample/README.md b/sample/README.md index 96160aa..ad8774f 100644 --- a/sample/README.md +++ b/sample/README.md @@ -53,7 +53,7 @@ This sample project also includes a configuration for the App Sizer CLI tool. 2. To execute the CLI analysis, run the following command from the project root: ``` - sh exec-clt.sh + sh exec-cli.sh ``` This script will build & run the App Sizer CLI tool using the configuration specified in `app-size-settings.yml`. diff --git a/sample/app-size-config/app-size-settings.yml b/sample/app-size-config/app-size-settings.yml index cfcc311..043a305 100644 --- a/sample/app-size-config/app-size-settings.yml +++ b/sample/app-size-config/app-size-settings.yml @@ -22,16 +22,16 @@ report: output-directory: "./build/app-sizer" custom-attributes: pipelineId: "100" - influx-db-config: - db-name: "sizer" - url: "http://localhost:8086" - username: "root" - password: "root" - report-table-name: "app_size" - retention-policy: - name: "app_sizer" - duration: "360d" - shard-duration: "0m" - replication-factor: 2 - is-default: true +# influx-db-config: +# db-name: "sizer" +# url: "http://localhost:8086" +# username: "root" +# password: "root" +# report-table-name: "app_size" +# retention-policy: +# name: "app_sizer" +# duration: "360d" +# shard-duration: "0m" +# replication-factor: 2 +# is-default: true diff --git a/sample/app/build.gradle b/sample/app/build.gradle index 547d1b7..4c810db 100644 --- a/sample/app/build.gradle +++ b/sample/app/build.gradle @@ -99,7 +99,7 @@ dependencies { testImplementation libs.junit } -apply plugin: "com.grab.app-sizer" +apply plugin: "com.grab.sizer" appSizer { enabled = true diff --git a/sample/exec-clt.sh b/sample/exec-cli.sh similarity index 93% rename from sample/exec-clt.sh rename to sample/exec-cli.sh index ac3f309..0f67464 100755 --- a/sample/exec-clt.sh +++ b/sample/exec-cli.sh @@ -39,7 +39,7 @@ cd .. # Build the command-line tool echo "Building App Sizer command-line tool..." -./gradlew clean clt:shadowJar +./gradlew clean cli:shadowJar # Change back to the sample project directory echo "Changing back to sample project directory..." @@ -51,11 +51,11 @@ echo "Building Android app bundle..." # Make the CLI tool executable echo "Making CLI tool executable..." -chmod +x ../clt/build/libs/clt-app-sizer.jar +chmod +x ../cli/build/libs/cli-app-sizer.jar # Run the App Sizer CLI tool echo "Running App Sizer CLI tool..." -java -jar ../clt/build/libs/clt-app-sizer.jar --config-file "./app-size-config/app-size-settings.yml" +java -jar ../cli/build/libs/cli-app-sizer.jar --config-file "./app-size-config/app-size-settings.yml" # Print completion message echo "App Sizer CLI execution completed successfully!" diff --git a/settings.gradle b/settings.gradle index d4da8fa..f3962ec 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,6 +31,9 @@ pluginManagement { gradlePluginPortal() mavenCentral() google() + maven { + url = uri("https://plugins.gradle.org/m2/") + } } } @@ -46,5 +49,5 @@ rootProject.name = "app-sizer" include 'app-sizer' include 'gradle-plugin' -include 'clt' +include 'cli'