Hello everyone! I'm facing an issue when trying t...
# compose
d
Hello everyone! I'm facing an issue when trying to run Compose Compiler Metrics 👇
Copy code
./gradlew assembleRelease -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true
But I get this error:
Copy code
e: Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:metricsDestination
I've configured it as NowInAndroid repository but I had no luck. I saw some related threads like this one and even read that the Kotlin team said that it should be fixed in Kotlin 1.9.x but I'm using Kotlin 1.9.10 Any clue? please 🙇
a
This is what I do, which works. I'm not sure if it's fundamentally different from
tasks.withType<KotlinCompile>().configureEach
.
Copy code
kotlin {
    compilerOptions {
        // Requires a fresh build to show all outputs
        val composeMetrics = project.layout.buildDirectory.dir("composeMetrics").get().asFile.path
        freeCompilerArgs.addAll(
            "-P", "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$composeMetrics",
            "-P", "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$composeMetrics",
        )
    }
}
It's not a multimodule project, and of course this snippet doesn't allow controlling it via flags.
I wonder if you get a similar error for
reportsDestination
? As a temporary solution for your method, perhaps you could dedupe
freeCompilerArgs
before appending to it.