Error from packageReleaseDistributionForCurrentOS on macOS when including TargetFormat.AppImage
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.
me to
me to
Is there a workaround for this? It seems like it has pretty low priority.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
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
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)