compose-report-to-html icon indicating copy to clipboard operation
compose-report-to-html copied to clipboard

Gradle plugin doesn't work with Compose Multiplatform 1.5.0-beta02

Open StefanOltmann opened this issue 2 years ago • 6 comments

I tried to apply it to Compose Multiplatform 1.5.0-beta02 and got this:

An exception occurred applying plugin request [id: 'org.jetbrains.compose', version: '1.5.0-beta02']
> Failed to apply plugin 'org.jetbrains.compose'.
   > Shared build service 'org.jetbrains.compose.ComposeMultiplatformBuildService' has unexpected type: org.jetbrains.compose.ComposeMultiplatformBuildService$Inject

StefanOltmann avatar Aug 24 '23 05:08 StefanOltmann

Okay, downgrading to 1.4.3 it doesn't work with Multiplatform at all. If I specify it in my android module, this does not help, too.

Please make it compatible with Multiplatform

StefanOltmann avatar Aug 24 '23 05:08 StefanOltmann

Thanks for reporting. Will definitely add a support will update here

PatilShreyas avatar Aug 24 '23 06:08 PatilShreyas

Actually currently it's android specific only

PatilShreyas avatar Aug 24 '23 06:08 PatilShreyas

For now You can use the CLI version. To make compose compiler metrics work with compose multiplatform you need to add something like this to your root build.gradle.kts file:

allprojects {
    tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile::class.java).configureEach {
        kotlinOptions {
            // Trigger this with:
            // ./gradlew assembleRelease -PenableMultiModuleComposeReports=true --rerun-tasks
            if (project.findProperty("enableMultiModuleComposeReports") == "true") {
                freeCompilerArgs += listOf("-P", "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + rootProject.buildDir.absolutePath + "/compose_metrics/")
                freeCompilerArgs += listOf("-P", "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + rootProject.buildDir.absolutePath + "/compose_metrics/")
            }
        }
    }
}

Then you can use CLI version pointing input path to "<YOUR_PROJECT_PATH>\build\compose_metrics

mikolajefento avatar Aug 29 '23 10:08 mikolajefento

Thank you! That worked, I got my report. Awesome!

So it looks like Compose Multiplatform support out of the box shouldn't be too far away. :)

StefanOltmann avatar Aug 31 '23 07:08 StefanOltmann

@mikolajefento thanks for the quick remedy.

@StefanOltmann yep, it's just that we'll need to create a plugin variant for multiplatform and I guess we'll be able to do it.

PatilShreyas avatar Aug 31 '23 08:08 PatilShreyas

Hi @PatilShreyas I've initial implementation here #110 that addresses this issue and can make the plugin work with compose multiplatform, I need to do some more testing. but take a look at the PR and spot any potential issues or something that can be improved, I'm waiting for your review

mr3y-the-programmer avatar Jun 15 '24 15:06 mr3y-the-programmer

Fixed and released in v1.4.0. Thanks @mr3y-the-programmer for the contribution

PatilShreyas avatar Jul 28 '24 09:07 PatilShreyas