79410702

Date: 2025-02-04 06:06:37
Score: 0.5
Natty:
Report link

Through trial and error, I found a solution that seems to work for configuring desktop settings:

class DesktopApplicationConventionPlugin : Plugin<Project> {
    override fun apply(target: Project) {
        with(target) {
            afterEvaluate {
                extensions.configure<ComposeExtension> {
                    this.extensions.configure<DesktopExtension> {
                        application {
                            mainClass = "com.app.MainKt"

                            nativeDistributions {
                                targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
                                packageName = "com.app"
                                packageVersion = "1.0.0"
                            }
                        }

                    }
                }
            }
        }
    }
}

What I've observed:

This solution works for my use case, but I haven't found any documentation explaining why this specific structure is necessary. Would appreciate insights from others who understand Gradle plugin development better.

Reasons:
  • Blacklisted phrase (1.5): Would appreciate
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: GreatTusk