compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Error from packageReleaseDistributionForCurrentOS on macOS when including TargetFormat.AppImage

Open dzirbel opened this issue 2 years ago • 3 comments

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:

  • Desktop

Versions

  • Kotlin version*: 1.9.10
  • Compose Multiplatform version*: 1.5.3
  • OS version(s)* (required for Desktop and iOS issues): macOS (via Github actions macos-latest)
  • OS architecture (x86 or arm64): N/A
  • JDK (for desktop issues): N/A

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.

dzirbel avatar Oct 12 '23 18:10 dzirbel

me to

springeye avatar Jan 06 '24 07:01 springeye

me to

springeye avatar Jan 06 '24 07:01 springeye

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

vladcudoidem avatar Jun 25 '24 14:06 vladcudoidem

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

okushnikov avatar Aug 26 '24 13:08 okushnikov

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 avatar Sep 05 '24 15:09 EugenMayer

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)

EugenMayer avatar Sep 23 '24 11:09 EugenMayer