JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

[Gradle] tryGetSkikoRuntimeIfNeeded() eagerly resolves KMP runtime configuration on task creation #4886

Closed Tapchicoma closed 3 weeks ago

Tapchicoma commented 4 weeks ago

Describe the bug

We've got following report in Kotlin issues where jvmRuntimeClasspath configuration could not be further modified as it was already resolved:

Cannot change dependencies of dependency configuration ':micro_utils.android.pickers:jvmMainImplementation' after it has been included in dependency resolution.

The problem comes from both user repository and JB Compose Gradle plugin:

Affected platforms

Versions

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/InsanusMokrassar/MicroUtils repository
  2. Checkout 0.21.0 branch
  3. Run ./gradlew :micro_utils.android.pickers:help -i -s
  4. See error

Expected behavior

Configurations should not be resolved on Gradle configuration phase.

InsanusMokrassar commented 4 weeks ago

Commit with incorrect work of plugin

InsanusMokrassar commented 3 weeks ago

Hello, could you say if there is some progress on this issue? It is currently blocking me from upgrade allmy projects up to kotlin 2.0 and the lates compose :(

eymar commented 3 weeks ago

@InsanusMokrassar the proper fix is in progress.

In the meantime, your project doesn't seem to use js legacy target. So you can remove this part:

 tasks.whenTaskAdded { task ->
            if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
                task.enabled = false
            }
        }

and it starts to work.

InsanusMokrassar commented 3 weeks ago

@InsanusMokrassar the proper fix is in progress.

In the meantime, your project doesn't seem to use js legacy target. So you can remove this part:

 tasks.whenTaskAdded { task ->
            if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
                task.enabled = false
            }
        }

and it starts to work.

Your advice working, thank you :)