Browse Source

Added support to add files to jpackage resources argument.

pull/3647/head
Justin Rajewski 1 year ago
parent
commit
b8db03b70b
  1. 2
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/PlatformSettings.kt
  2. 3
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt
  3. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt

2
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/dsl/PlatformSettings.kt

@ -6,6 +6,7 @@
package org.jetbrains.compose.desktop.application.dsl package org.jetbrains.compose.desktop.application.dsl
import org.gradle.api.Action import org.gradle.api.Action
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty import org.gradle.api.file.RegularFileProperty
import org.gradle.api.model.ObjectFactory import org.gradle.api.model.ObjectFactory
import javax.inject.Inject import javax.inject.Inject
@ -17,6 +18,7 @@ abstract class AbstractPlatformSettings {
val iconFile: RegularFileProperty = objects.fileProperty() val iconFile: RegularFileProperty = objects.fileProperty()
var packageVersion: String? = null var packageVersion: String? = null
var installationPath: String? = null var installationPath: String? = null
val jpackageResourceDir: DirectoryProperty = objects.directoryProperty()
} }
abstract class AbstractMacOSPlatformSettings : AbstractPlatformSettings() { abstract class AbstractMacOSPlatformSettings : AbstractPlatformSettings() {

3
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/internal/configureJvmApplication.kt

@ -377,6 +377,7 @@ internal fun JvmApplicationContext.configurePlatformSettings(
packageTask.linuxRpmLicenseType.set(provider { linux.rpmLicenseType }) packageTask.linuxRpmLicenseType.set(provider { linux.rpmLicenseType })
packageTask.iconFile.set(linux.iconFile.orElse(defaultResources.get { linuxIcon })) packageTask.iconFile.set(linux.iconFile.orElse(defaultResources.get { linuxIcon }))
packageTask.installationPath.set(linux.installationPath) packageTask.installationPath.set(linux.installationPath)
packageTask.jpackageResourcesDir.set(linux.jpackageResourceDir)
} }
} }
OS.Windows -> { OS.Windows -> {
@ -390,6 +391,7 @@ internal fun JvmApplicationContext.configurePlatformSettings(
packageTask.winUpgradeUuid.set(provider { win.upgradeUuid }) packageTask.winUpgradeUuid.set(provider { win.upgradeUuid })
packageTask.iconFile.set(win.iconFile.orElse(defaultResources.get { windowsIcon })) packageTask.iconFile.set(win.iconFile.orElse(defaultResources.get { windowsIcon }))
packageTask.installationPath.set(win.installationPath) packageTask.installationPath.set(win.installationPath)
packageTask.jpackageResourcesDir.set(win.jpackageResourceDir)
} }
} }
OS.MacOS -> { OS.MacOS -> {
@ -415,6 +417,7 @@ internal fun JvmApplicationContext.configurePlatformSettings(
packageTask.nonValidatedMacSigningSettings = app.nativeDistributions.macOS.signing packageTask.nonValidatedMacSigningSettings = app.nativeDistributions.macOS.signing
packageTask.iconFile.set(mac.iconFile.orElse(defaultResources.get { macIcon })) packageTask.iconFile.set(mac.iconFile.orElse(defaultResources.get { macIcon }))
packageTask.installationPath.set(mac.installationPath) packageTask.installationPath.set(mac.installationPath)
packageTask.jpackageResourcesDir.set(mac.jpackageResourceDir)
} }
} }
} }

5
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/desktop/application/tasks/AbstractJPackageTask.kt

@ -276,6 +276,9 @@ abstract class AbstractJPackageTask @Inject constructor(
@get:Internal @get:Internal
val appResourcesDir: DirectoryProperty = objects.directoryProperty() val appResourcesDir: DirectoryProperty = objects.directoryProperty()
@get:Internal
val jpackageResourcesDir: DirectoryProperty = objects.directoryProperty()
/** /**
* Gradle runtime verification fails, * Gradle runtime verification fails,
* if InputDirectory is not null, but a directory does not exist. * if InputDirectory is not null, but a directory does not exist.
@ -509,6 +512,8 @@ abstract class AbstractJPackageTask @Inject constructor(
.writeToFile(jpackageResources.ioFile.resolve("product-def.plist")) .writeToFile(jpackageResources.ioFile.resolve("product-def.plist"))
} }
} }
jpackageResourcesDir.ioFileOrNull?.copyRecursively(jpackageResources.ioFile, overwrite = true)
} }
override fun jvmToolEnvironment(): MutableMap<String, String> = override fun jvmToolEnvironment(): MutableMap<String, String> =

Loading…
Cancel
Save