I want to enable compose metrics by this official docs.
In root gradle I added this:
subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
if (project.findProperty("composeCompilerReports") == "true") {
kotlinOptions.freeCompilerArgs = kotlinOptions.freeCompilerArgs + listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_reports"
)
kotlinOptions.freeCompilerArgs = kotlinOptions.freeCompilerArgs + listOf(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics"
)
}
}
}
}
and start the building by this command:
./gradlew assembleRelease -PcomposeCompilerReports=true --rerun-tasks
the building starts and even one report for one application module in its build folder created. But as I understand the further process stuck with an error:
> Task :core-common-feature-utils:kaptGenerateStubsReleaseKotlin FAILED
e: Multiple values are not allowed for plugin option androidx.compose.compiler.plugins.kotlin:metricsDestination
Plugin "androidx.compose.compiler.plugins.kotlin" usage:
liveLiterals <true|false> Enable Live Literals code generation
liveLiteralsEnabled <true|false>
Enable Live Literals code generation (with per-file enabled flags)
generateFunctionKeyMetaClasses <true|false>
Generate function key meta classes with annotations indicating the functions and their group keys. Generally used for tooling.
sourceInformation <true|false>
Include source information in generated code
metricsDestination <path> Save compose build metrics to this folder
reportsDestination <path> Save compose build reports to this folder
intrinsicRemember <true|false>
Include source information in generated code
suppressKotlinVersionCompatibilityCheck <true|false>
Suppress Kotlin version compatibility check
generateDecoys <true|false>
Generate decoy methods in IR transform
FAILURE: Build completed with 2 failures.
Also, I noticed that every time the process give the error with different module after one successful and can give my 2 same errors or three - and finally stackoverflow error. please, help with idea how to overcome this
gradle plugin ver 7.4.1
P.S. As I understand from investigations, the modules without in their gradle
kotlin("kapt")
id("dagger.hilt.android.plugin")
creates the report. The using of kotlin("kapt") gives that error. But I do not know how to compile the project without it, because I am using hilt.
P.P.S. As I am trying more, I have managed to make reports after deleting hilt from build.gradle in modules. In this case the command runs till 100%. But application will not run of course. This is a little "inconvenient" to make report in such a way. Please, if you have an idea..