Using utility as a library¶
This utility is also published as a maven artifact on Maven Central so that you can make use of it as you want to use it (For example: automation in CI).
Add dependency¶
Declare the following dependencies in the project:
repositories {
mavenCentral()
}
dependencies {
implementation("dev.shreyaspatil.compose-compiler-report-generator:core:$version")
implementation("dev.shreyaspatil.compose-compiler-report-generator:report-generator:$version")
}
Refer to the latest release on GitHub Releases or maven central:
Usage¶
// Create a report specification with application name
val reportSpec = ReportSpec(
name = "Your Application Name",
options = ReportOptions() // Customize it as per need
)
// Get provider for raw reports (generated by compose compiler)
val rawReportProvider = ComposeCompilerRawReportProvider.FromDirectory("path/to/raw-reports")
// Provide metric files to generator
val htmlGenerator = HtmlReportGenerator(
reportSpec = reportSpec,
metricsProvider = ComposeCompilerMetricsProvider(rawReportProvider)
)
// Generate HTML (String)
val html = htmlGenerator.generateHtml()