From 7ccb203bb54b4c50023967819d332995226c3137 Mon Sep 17 00:00:00 2001 From: Alva Swanson Date: Mon, 24 Jun 2024 16:59:15 +0000 Subject: [PATCH] packaging: Rename jpackage output to GitHub binary names --- .../bisq/gradle/packaging/PackagingPlugin.kt | 2 ++ .../packaging/ReleaseBinariesTaskFactory.kt | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/PackagingPlugin.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/PackagingPlugin.kt index 97fea2f35b..597fadf62a 100644 --- a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/PackagingPlugin.kt +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/PackagingPlugin.kt @@ -63,6 +63,8 @@ class PackagingPlugin @Inject constructor(private val javaToolchainService: Java outputDirectory.set(project.layout.buildDirectory.dir("packaging/jpackage/packages")) } + + ReleaseBinariesTaskFactory.registerCopyReleaseBinariesTask(project) } private fun getHashFileForOs(project: Project): Provider { diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt new file mode 100644 index 0000000000..0fe4cf220f --- /dev/null +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt @@ -0,0 +1,29 @@ +package bisq.gradle.packaging + +import org.gradle.api.Project +import org.gradle.api.file.Directory +import org.gradle.api.provider.Provider +import org.gradle.api.tasks.Copy +import org.gradle.kotlin.dsl.register + +class ReleaseBinariesTaskFactory { + companion object { + fun registerCopyReleaseBinariesTask(project: Project) { + val inputBinariesProperty: Provider = project.providers + .gradleProperty("bisq.release.binaries_path") + val releaseDir: Provider = project.layout.buildDirectory.dir("packaging/release") + + project.tasks.register("copyReleaseBinaries") { + from(inputBinariesProperty) + into(releaseDir) + rename { fileName: String -> + fileName.replace("Bisq 2", "Bisq") // "Bisq 2-2.0.4.exe", "Bisq 2-2.0.4.dmg" + .replace("bisq2_", "Bisq-") // "bisq2_2.0.4-1_amd64.deb" + .replace("bisq2-", "Bisq-") // "bisq2-2.0.4-1.x86_64.rpm" + .replace("-1_amd64", "") + .replace("-1.x86_64", "") + } + } + } + } +} \ No newline at end of file