diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/FileAssociation.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/FileAssociation.kt index 925b8988617..a9e2bbff22c 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/FileAssociation.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/FileAssociation.kt @@ -3,7 +3,7 @@ package org.jetbrains.compose.desktop.application.dsl import java.io.File import java.io.Serializable -data class FileAssociation( +internal data class FileAssociation( val mimeType: String, val extension: String, val description: String, diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/InfoPlistBuilder.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/InfoPlistBuilder.kt index 8fd0f19ef04..aca1d8e8588 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/InfoPlistBuilder.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/InfoPlistBuilder.kt @@ -14,42 +14,37 @@ private fun indentForLevel(level: Int) = indent.repeat(level) internal class InfoPlistBuilder(private val extraPlistKeysRawXml: String? = null) { internal sealed class InfoPlistValue { - abstract fun toString(nestingLevel: Int): String - override fun toString(): String = toString(0) + abstract fun asPlistEntry(nestingLevel: Int): String data class InfoPlistListValue(val elements: List) : InfoPlistValue() { - override fun toString(nestingLevel: Int): String = + override fun asPlistEntry(nestingLevel: Int): String = if (elements.isEmpty()) "${indentForLevel(nestingLevel)}" else elements.joinToString( separator = "\n", prefix = "${indentForLevel(nestingLevel)}\n", postfix = "\n${indentForLevel(nestingLevel)}" ) { - it.toString(nestingLevel + 1) + it.asPlistEntry(nestingLevel + 1) } - override fun toString(): String = super.toString() - constructor(vararg elements: InfoPlistValue) : this(elements.asList()) } data class InfoPlistMapValue(val elements: Map) : InfoPlistValue() { - override fun toString(nestingLevel: Int): String = + override fun asPlistEntry(nestingLevel: Int): String = if (elements.isEmpty()) "${indentForLevel(nestingLevel)}" else elements.entries.joinToString( separator = "\n", prefix = "${indentForLevel(nestingLevel)}\n", postfix = "\n${indentForLevel(nestingLevel)}", ) { (key, value) -> - "${indentForLevel(nestingLevel + 1)}${key.name}\n${value.toString(nestingLevel + 1)}" + "${indentForLevel(nestingLevel + 1)}${key.name}\n${value.asPlistEntry(nestingLevel + 1)}" } - override fun toString() = super.toString() constructor(vararg elements: Pair) : this(elements.toMap()) } data class InfoPlistStringValue(val value: String) : InfoPlistValue() { - override fun toString(nestingLevel: Int): String = if (value.isEmpty()) "${indentForLevel(nestingLevel)}" else "${indentForLevel(nestingLevel)}$value" - override fun toString() = super.toString() + override fun asPlistEntry(nestingLevel: Int): String = if (value.isEmpty()) "${indentForLevel(nestingLevel)}" else "${indentForLevel(nestingLevel)}$value" } } @@ -78,7 +73,7 @@ internal class InfoPlistBuilder(private val extraPlistKeysRawXml: String? = null appendLine("${indentForLevel(1)}") for ((k, v) in values) { appendLine("${indentForLevel(2)}${k.name}") - appendLine(v.toString(2)) + appendLine(v.asPlistEntry(2)) } extraPlistKeysRawXml?.let { appendLine(it) } appendLine("${indentForLevel(1)}") diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt index b4af732fc75..83d51089ef6 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt @@ -375,7 +375,7 @@ internal fun JvmApplicationContext.configurePlatformSettings( packageTask.linuxRpmLicenseType.set(provider { linux.rpmLicenseType }) packageTask.iconFile.set(linux.iconFile.orElse(defaultResources.get { linuxIcon })) packageTask.installationPath.set(linux.installationPath) - packageTask.fileAssociations.set(linux.fileAssociations) + packageTask.fileAssociations.set(provider { linux.fileAssociations }) } } OS.Windows -> { @@ -389,7 +389,7 @@ internal fun JvmApplicationContext.configurePlatformSettings( packageTask.winUpgradeUuid.set(provider { win.upgradeUuid }) packageTask.iconFile.set(win.iconFile.orElse(defaultResources.get { windowsIcon })) packageTask.installationPath.set(win.installationPath) - packageTask.fileAssociations.set(win.fileAssociations) + packageTask.fileAssociations.set(provider { win.fileAssociations }) } } OS.MacOS -> { @@ -416,7 +416,7 @@ internal fun JvmApplicationContext.configurePlatformSettings( packageTask.nonValidatedMacSigningSettings = app.nativeDistributions.macOS.signing packageTask.iconFile.set(mac.iconFile.orElse(defaultResources.get { macIcon })) packageTask.installationPath.set(mac.installationPath) - packageTask.fileAssociations.set(mac.fileAssociations) + packageTask.fileAssociations.set(provider { mac.fileAssociations }) } } } diff --git a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt index 3a2e338453c..e342fb3ab4d 100644 --- a/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt +++ b/gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt @@ -250,7 +250,7 @@ abstract class AbstractJPackageTask @Inject constructor( @get:Input @get:Optional - val fileAssociations: SetProperty = objects.setProperty(FileAssociation::class.java) + internal val fileAssociations: SetProperty = objects.setProperty(FileAssociation::class.java) private val iconMapping by lazy { val icons = fileAssociations.orNull.orEmpty().mapNotNull { it.iconFile }