Skip to content

CLI Utility

Pre-requisite

This CLI utility just takes care of generating beautified report from generated raw report by Compose compiler. Thus, before using CLI, you'll need to generate compose compiler metrics and reports manually.

How to generate Compose Compiler metric and report?

Make sure to generate Compose compiler metrics and reports as mentioned here or this good read article by Chris Banes. These files are then needed to this CLI utility to feed the data.

To generate the report, provide details related to app, metric and report files and output directory.

Using CLI

CLI utility is available in the two forms:

  1. JAR Distribution
  2. NPM package

1. Install the distribution

Navigate to the releases and download the latest JAR artifact.

Latest: Download JAR

npm install -g compose-report2html

Latest: NPM Package

2. Know usage

Run the command to know the usage of CLI

java -jar composeReport2Html.jar -h
composeReport2Html.jar -h

▶️Output

Usage: Compose Compiler Report to HTML Generator ~ v1.4.1 options_list
Options:
    --applicationName, -app -> Application name (To be displayed in the report) (always required) { String }
    --inputDirectory, -i -> Input directory where composable report and metrics are available { String }
    --overallStatsFile, -overallStatsReport -> Overall Statistics Metrics JSON files (separated by commas) { String }
    --detailedStatsFile, -detailedStatsMetrics -> Detailed Statistics Metrics CSV files (separated by commas) { String }
    --composableMetricsFile, -composableMetrics -> Composable Metrics TXT files (separated by commas) { String }
    --classMetricsFile, -classMetrics -> Class Metrics TXT files (separated by commas) { String }
    --outputDirectory, -o -> Output directory name { String }
    --includeStableComposables [true] -> Whether to include stable Composable functions in the report
    --includeStableClasses [true] -> Whether to include stable classes in the report
    --includeClasses [true] -> Whether to include all the classes in the report
    --showOnlyUnstableComposables [false] -> Whether to ONLY include unstable composables in the report
    --help, -h -> Usage info

3. Generate report

HTML Report can be generated with the following combinations.

3.1 When all metric and report files are available in the same directory

Assuming report and metrics generated by Compose Compiler are available in one directory then you can specify path to that directory only and utility will automatically pick files.

java -jar composeReport2Html.jar \
  -app MyAppName \
  -i path/to/metric/directory \
  -o path/to/html/output
composeReport2Html \
  -app MyAppName \
  -i path/to/metric/directory \
  -o path/to/html/output

Info

In the above command, path provided to -i parameter assumes all metrics and report are present and generates and saves report in the path provided to -o parameter.

3.2 Provide path to individual report and metric files

You can provide each metric/report file individually using separate parameters.

java -jar composeReport2Html.jar \
  -app MyAppName \
  -overallStatsReport app_release-module.json \
  -detailedStatsMetrics app_release-composables.csv \
  -composableMetrics app_release-composables.txt \
  -classMetrics app_release-classes.txt \
  -o htmlReportDir
composeReport2Html \
  -app MyAppName \
  -overallStatsReport app_release-module.json \
  -detailedStatsMetrics app_release-composables.csv \
  -composableMetrics app_release-composables.txt \
  -classMetrics app_release-classes.txt \
  -o htmlReportDir

Info

Multiple metric/report files can be provided as a CLI parameter by providing path separated by comma (,).