Skip to content

Commit

Permalink
Add support for generating Compose compiler reports
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Oct 3, 2023
1 parent b02da72 commit 733a8bd
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.compose.ComposeExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
// this is necessary to avoid the plugins to be loaded multiple times
Expand Down Expand Up @@ -62,4 +63,26 @@ allprojects {
val compose = extensions.getByName("compose") as ComposeExtension
compose.kotlinCompilerPlugin.set(libs.versions.compose.compiler)
}

tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true

if (project.providers.gradleProperty("twine.enableComposeCompilerReports").isPresent) {
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
layout.buildDirectory.asFile.get().absolutePath +
"/compose_metrics",
)
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
layout.buildDirectory.asFile.get().absolutePath +
"/compose_metrics",
)
}
}
}
}

0 comments on commit 733a8bd

Please sign in to comment.