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

Error from packageReleaseDistributionForCurrentOS on macOS when including TargetFormat.AppImage #3814

Closed dzirbel closed 1 month ago

dzirbel commented 1 year ago

Describe the bug Running packageReleaseDistributionForCurrentOS on macOS with a build configuration that includes TargetFormat.AppImage throws IllegalStateException: Unexpected target format for MacOS: AppImage.

The cause is fairly clear: the AppImage enum value uses currentOS as its targetOS here, while the task configuration checks explicitly for DMG or PKG here, when creating notarization tasks. Since AppImages are generally only used by Linux I wouldn't expect them to be built by packageReleaseDistributionForCurrentOS on macOS.

As a related note, using TargetFormat.AppImage doesn't seem to actually produce an app image file (which should be a single executable file), instead just the app directory without any packaging. Since it's also produced on every OS it seems to be used for a different purpose than actually packaging an AppImage, but I might be missing something here.

Affected platforms Select one of the platforms below:

Versions

To Reproduce Include targetFormats(TargetFormat.AppImage) in any project and run packageReleaseDistributionForCurrentOS from macOS.

Expected behavior packageReleaseDistributionForCurrentOS runs and does not attempt to package an AppImage on macOS.

Additional context I believe the notarization task logic is also flawed due to https://github.com/JetBrains/compose-multiplatform/issues/2233 - it attempts (and fails) to add two notarize tasks when both DMG and PKG formats are included. It's likely both issues can be resolved by some refactoring of the creating of the notarize tasks.

springeye commented 10 months ago

me to

springeye commented 10 months ago

me to

vladcudoidem commented 4 months ago

Is there a workaround for this? It seems like it has pretty low priority.

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.

EugenMayer commented 2 months ago

Same here with the following setup

compose.desktop {
    application {
        mainClass = "com.example.MainKt"

        nativeDistributions {
            macOS {
                // macOS specific options
                targetFormats(TargetFormat.Dmg)
            }
            windows {
                // Windows specific options
                targetFormats(TargetFormat.Msi, TargetFormat.Exe)
            }
            linux {
                // Linux specific options
                targetFormats(TargetFormat.AppImage)
            }

            packageName = "Example"
            packageVersion = "1.0.0"
        }
    }
}

When running

./gradlew composeApp:packageDmg
A problem occurred configuring project ':composeApp'.
> Unexpected target format for MacOS: AppImage
EugenMayer commented 1 month ago

did that get fixed? if yes, which commit? (we tried this on 2 weeks ago and it was still causing trouble, even with the windows build)