Skip to content

Commit

Permalink
Rename Clt to Cli & fix pages issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MinhNguyen-nvm committed Nov 26, 2024
1 parent d995cf8 commit 723e68a
Show file tree
Hide file tree
Showing 33 changed files with 122 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @minkuanlim-grabtaxi @vanminh-grabtaxi @arunsampathkumar-grabtaxi @mohammadkahelghi-grabtaxi @stevenchao-grabtaxi @arnav-grabtaxi @adarsh-grabtaxi
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -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].
Expand All @@ -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.

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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



Expand Down
2 changes: 1 addition & 1 deletion clt/build.gradle → cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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('')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
[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
10 changes: 5 additions & 5 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 723e68a

Please sign in to comment.