Skip to content

Commit

Permalink
packaging: Add JPackage arguments override support
Browse files Browse the repository at this point in the history
Bisq 2 requires a different `--description` on Windows for the OS
notification.
  • Loading branch information
alvasw committed Jun 24, 2024
1 parent bddb71f commit defb288
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ class PackageFactory(private val jPackagePath: Path, private val jPackageConfig:
val processBuilder = ProcessBuilder(absoluteBinaryPath)
.inheritIO()

var commonArgs: Map<String, String> = jPackageCommonArgs

val osSpecificOverrideArgs = getOsSpecificOverrideArgs(filetypeAndCustomCommands.first)
if (osSpecificOverrideArgs.isNotEmpty()) {
val mutableMap: MutableMap<String, String> = jPackageCommonArgs.toMutableMap()
mutableMap.putAll(osSpecificOverrideArgs)
commonArgs = mutableMap
}

val allCommands = processBuilder.command()
jPackageCommonArgs.forEach { (key, value) ->
commonArgs.forEach { (key, value) ->
allCommands.add(key)
allCommands.add(value)
}
Expand All @@ -44,6 +53,7 @@ class PackageFactory(private val jPackagePath: Path, private val jPackageConfig:
"--dest" to jPackageConfig.outputDirPath.toAbsolutePath().toString(),

"--name" to appConfig.name,
"--description" to "A decentralized bitcoin exchange network.",
"--copyright" to "Copyright © 2013-${Year.now()} - The Bisq developers",
"--vendor" to "Bisq",
"--license-file" to appConfig.licenceFilePath,
Expand All @@ -58,6 +68,14 @@ class PackageFactory(private val jPackagePath: Path, private val jPackageConfig:
"--runtime-image" to jPackageConfig.runtimeImageDirPath.toAbsolutePath().toString()
)

private fun getOsSpecificOverrideArgs(fileType: String): Map<String, String> =
if (jPackageConfig.appConfig.name == "Bisq" && fileType == "exe") {
// Needed for Windows OS notification support
mutableMapOf("--description" to "Bisq 2")
} else {
emptyMap()
}

private fun deleteFileOrDirectory(dir: File) {
val files = dir.listFiles()
if (files != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class LinuxPackages(private val resourcesPath: Path, private val appName: String
resourcesPath.resolve("icon.png")
.toAbsolutePath().toString(),

"--description", "A decentralized bitcoin exchange network.",

"--linux-package-name", appName.toLowerCase().replace(" ", ""),
"--linux-app-release", "1",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ class MacPackage(private val resourcesPath: Path, private val appName: String) :
"--resource-dir", resourcesPath.toAbsolutePath().toString(),
"--mac-package-name", appName,
"--icon", resourcesPath.resolve("Bisq2.icns").toAbsolutePath().toString(),
"--description", "A decentralized bitcoin exchange network.",
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class WindowsPackage(private val resourcesPath: Path) : JPackagePackageFormatCon
mutableListOf(
// "--resource-dir", resourcesPath.toAbsolutePath().toString(),
"--icon", resourcesPath.resolve("Bisq2.ico").toAbsolutePath().toString(),
"--description", "Bisq 2",

"--win-dir-chooser",
"--win-per-user-install",
Expand Down

0 comments on commit defb288

Please sign in to comment.