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

Support explicit dist names

Open Goooler opened this issue 1 year ago • 1 comments

Now I configure the macOS output dist name like:

compose.desktop {
    application {
        ...
        nativeDistributions {
            targetFormats(TargetFormat.Dmg)

            packageName = "Foo"
            packageVersion = "1.0"
        }
    }
}

This will generate the output dmg files like Foo-1.0.dmg, if I want to rename the dist will set packageName to something like foo-x64, but this will lead the extracted app name to foo-x64-1.0.app, which is not what I expected. Seems I don't find any direct way to leave the dist name and the app name different. It would be great to support this feature.

Goooler avatar Jun 16 '24 09:06 Goooler

Workaround:

/**
 * TODO: workaround for https://github.com/JetBrains/compose-multiplatform/issues/4976.
 */
val renameDmg by tasks.registering(Copy::class) {
    group = "distribution"
    description = "Rename the DMG file"

    val packageReleaseDmg = tasks.named<AbstractJPackageTask>("packageReleaseDmg")
    // build/compose/binaries/main-release/dmg/Foo*.dmg
    val fromFile = packageReleaseDmg.map { task ->
        task.destinationDir.asFile.get().toPath().listDirectoryEntries("Foo*.dmg").single()
    }

    from(fromFile)
    into(fromFile.map { it.parent })
    rename {
        "foo-bar.dmg"
    }
}

Goooler avatar Jun 16 '24 11:06 Goooler

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