Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
StefanOltmann opened this issue Aug 24, 2023 · 7 comments
Open

Comments

@StefanOltmann
Copy link

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 StefanOltmann changed the title Doesn't work with Compose Multiplatform 1.5.0-beta02 Gradle plugin doesn't work with Compose Multiplatform 1.5.0-beta02 Aug 24, 2023
@StefanOltmann
Copy link
Author

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

@PatilShreyas
Copy link
Owner

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

@PatilShreyas
Copy link
Owner

Actually currently it's android specific only

@mikolajefento
Copy link

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

@StefanOltmann
Copy link
Author

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. :)

@PatilShreyas
Copy link
Owner

@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.

@mr3y-the-programmer
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants