Skip to content

Commit

Permalink
Merge pull request #2680 from HenrikJannsen/add-support-for-macos-aar…
Browse files Browse the repository at this point in the history
…ch64-tor-binary

Prepare support for macos aarch64 tor binary
  • Loading branch information
HenrikJannsen authored Aug 28, 2024
2 parents 46286f8 + 4a432b9 commit ffe07fa
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package bisq.gradle.bitcoin_core

import bisq.gradle.tasks.PerOsUrlProvider
import bisq.gradle.tasks.PerPlatformUrlProvider

class BitcoinCoreHashFileUrlProvider(private val version: String) : PerOsUrlProvider {
class BitcoinCoreHashFileUrlProvider(private val version: String) : PerPlatformUrlProvider {
override val urlPrefix: String
get() = "https://bitcoincore.org/bin/bitcoin-core-$version/SHA256SUMS"

override val linuxUrl: String
override val LINUX_X86_64_URL: String
get() = ""

override val macOsUrl: String
override val MACOS_X86_64_URL: String
get() = ""

override val windowsUrl: String
override val MACOS_ARM_64_URL: String
get() = ""

override val WIN_X86_64_URL: String
get() = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BitcoinCorePlugin : Plugin<Project> {
binaryName = "BitcoinCoreSha256Sums",
version = extension.version,

perOsUrlProvider = { version -> BitcoinCoreHashFileUrlProvider(version) },
perPlatformUrlProvider = { version -> BitcoinCoreHashFileUrlProvider(version) },
downloadDirectory = DOWNLOADS_DIR,

pgpFingerprintToKeyUrlMap = mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BisqElectrumPlugin : Plugin<Project> {
binaryName = "Electrum",
version = extension.version,

perOsUrlProvider = { version -> ElectrumBinaryUrlProvider(version) },
perPlatformUrlProvider = { version -> ElectrumBinaryUrlProvider(version) },
downloadDirectory = DOWNLOADS_DIR,

pgpFingerprintToKeyUrlMap = mapOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package bisq.gradle.electrum

import bisq.gradle.tasks.PerOsUrlProvider
import bisq.gradle.tasks.PerPlatformUrlProvider

class ElectrumBinaryUrlProvider(private val version: String) : PerOsUrlProvider {
class ElectrumBinaryUrlProvider(private val version: String) : PerPlatformUrlProvider {
override val urlPrefix: String
get() = "https://download.electrum.org/$version/"

override val linuxUrl: String
override val LINUX_X86_64_URL: String
get() = "electrum-$version-x86_64.AppImage"

override val macOsUrl: String
override val MACOS_X86_64_URL: String
get() = "electrum-$version.dmg"

override val windowsUrl: String
override val MACOS_ARM_64_URL: String
get() = "electrum-$version.dmg" // No ARM_64 version provided

override val WIN_X86_64_URL: String
get() = "electrum-$version.exe"
}
1 change: 1 addition & 0 deletions build-logic/gradle-tasks/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ repositories {
}

dependencies {
implementation(project(":commons"))
implementation(libs.bouncycastle.pg)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package bisq.gradle.tasks

import bisq.gradle.common.Platform.*
import bisq.gradle.common.getPlatform

interface PerPlatformUrlProvider {
val urlPrefix: String

val LINUX_X86_64_URL: String
val MACOS_X86_64_URL: String
val MACOS_ARM_64_URL: String
val WIN_X86_64_URL: String

val url: String
get() = urlPrefix + getUrlSuffix()

private fun getUrlSuffix() =
when (getPlatform()) {
LINUX_X86_64 -> LINUX_X86_64_URL
LINUX_ARM_64 -> LINUX_X86_64_URL // No ARM_64 provided
MACOS_X86_64 -> MACOS_X86_64_URL
MACOS_ARM_64 -> MACOS_ARM_64_URL
WIN_X86_64 -> WIN_X86_64_URL
WIN_ARM_64 -> WIN_X86_64_URL // No ARM_64 provided
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package bisq.gradle.tasks.download

import bisq.gradle.tasks.PerOsUrlProvider
import bisq.gradle.tasks.PerPlatformUrlProvider
import bisq.gradle.tasks.signature.SignatureVerificationTask
import org.gradle.api.Project
import org.gradle.api.provider.Property
Expand All @@ -14,7 +14,7 @@ class SignedBinaryDownloader(
private val binaryName: String,
private val version: Property<String>,

private val perOsUrlProvider: (String) -> PerOsUrlProvider,
private val perPlatformUrlProvider: (String) -> PerPlatformUrlProvider,
private val downloadDirectory: String,

private val pgpFingerprintToKeyUrlMap: Map<String, URL>
Expand All @@ -23,7 +23,7 @@ class SignedBinaryDownloader(
private val downloadTaskFactory = DownloadTaskFactory(project, downloadDirectory)

fun registerTasks() {
val binaryDownloadUrl: Provider<String> = version.map { perOsUrlProvider(it).url }
val binaryDownloadUrl: Provider<String> = version.map { perPlatformUrlProvider(it).url }
val binaryDownloadTask =
downloadTaskFactory.registerDownloadTask("download${binaryName}Binary", binaryDownloadUrl)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BisqTorBinaryPlugin : Plugin<Project> {
binaryName = "Tor",
version = extension.version,

perOsUrlProvider = { version -> TorBinaryUrlProvider(version) },
perPlatformUrlProvider = { version -> TorBinaryUrlProvider(version) },
downloadDirectory = DOWNLOADS_DIR,

pgpFingerprintToKeyUrlMap = mapOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
package bisq.gradle.tor_binary

import bisq.gradle.tasks.PerOsUrlProvider
import bisq.gradle.tasks.PerPlatformUrlProvider

class TorBinaryUrlProvider(private val version: String) : PerOsUrlProvider {
class TorBinaryUrlProvider(private val version: String) : PerPlatformUrlProvider {
override val urlPrefix: String
get() = "https://archive.torproject.org/tor-package-archive/torbrowser/$version/"

override val linuxUrl: String
override val LINUX_X86_64_URL: String
get() = "tor-expert-bundle-linux-x86_64-$version.tar.gz"

override val macOsUrl: String
override val MACOS_X86_64_URL: String
get() = "tor-expert-bundle-macos-x86_64-$version.tar.gz"

override val windowsUrl: String
override val MACOS_ARM_64_URL: String
// Currently the Tor version for aarch64 does not work, thus we use the x64 version.
// See: https://github.com/bisq-network/bisq2/issues/2679
// Once resolved we can use the line below.
// get() = "tor-expert-bundle-macos-aarch64-$version.tar.gz"
get() = "tor-expert-bundle-macos-x86_64-$version.tar.gz"

override val WIN_X86_64_URL: String
get() = "tor-expert-bundle-windows-x86_64-$version.tar.gz"
}

0 comments on commit ffe07fa

Please sign in to comment.