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
16.24k stars 1.18k forks source link

Strict dependency locking broken with Compose Desktop #4198

Closed ccjernigan closed 1 month ago

ccjernigan commented 9 months ago

Describe the bug When I generate locks on my Mac desktop, they have the suffix macos-arm64. But on GitHub Actions the suffix would be linux-x64.

Affected platforms Select one of the platforms below:

Versions

To Reproduce

  1. Configure a compose desktop application
  2. Enable strict Gradle dependency locking
  3. Generate and commit locks on one type of computer
  4. Then try to build on another type of computer (e.g. Mac/Linux/Windows)

Locking fails because of org.jetbrains.compose.desktop:desktop-jvm-macos-arm64:1.6.0-beta01=allSourceSetsCompileDependenciesMetadata,commonTestApiDependenciesMetadata,commonTestCompileOnlyDependenciesMetadata,commonTestImplementationDependenciesMetadata,commonTestResolvableDependenciesMetadata,compileClasspath,jvmCompileClasspath,jvmMainApiDependenciesMetadata,jvmMainCompileOnlyDependenciesMetadata,jvmMainImplementationDependenciesMetadata,jvmMainResolvableDependenciesMetadata,jvmRuntimeClasspath,jvmTestApiDependenciesMetadata,jvmTestCompileClasspath,jvmTestCompileOnlyDependenciesMetadata,jvmTestImplementationDependenciesMetadata,jvmTestResolvableDependenciesMetadata,jvmTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath

versus

org.jetbrains.compose.desktop:desktop-jvm-linux-x64:1.6.0-beta01=allSourceSetsCompileDependenciesMetadata,commonTestApiDependenciesMetadata,commonTestCompileOnlyDependenciesMetadata,commonTestImplementationDependenciesMetadata,commonTestResolvableDependenciesMetadata,compileClasspath,jvmCompileClasspath,jvmMainApiDependenciesMetadata,jvmMainCompileOnlyDependenciesMetadata,jvmMainImplementationDependenciesMetadata,jvmMainResolvableDependenciesMetadata,jvmRuntimeClasspath,jvmTestApiDependenciesMetadata,jvmTestCompileClasspath,jvmTestCompileOnlyDependenciesMetadata,jvmTestImplementationDependenciesMetadata,jvmTestResolvableDependenciesMetadata,jvmTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath

mazunin-v-jb commented 9 months ago

Hello, thank you for submitting the issue. I'll pass it on to the team.

This happens due to the current realization of the implementation(compose.desktop.currentOs)

As a temporary workaround, I suggest adding required targets explicitly (instead of using just currentOs):

if (System.getPropery("bundle.all.targets") == "true") {
    implementation(compose.desktop.linux_x64)
    implementation(compose.desktop.linux_arm64)
    implementation(compose.desktop.windows_x64)
    implementation(compose.desktop.macos_x64)
    implementation(compose.desktop.macos_arm64)
} else {
    implementation(compose.desktop.currentOs)
}

Then, lock dependencies: gradlew dependencies --write-locks -Dbundle.all.targets=true

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.