diff --git a/build-logic/packaging/build.gradle.kts b/build-logic/packaging/build.gradle.kts index 056be44659..18223b3d71 100644 --- a/build-logic/packaging/build.gradle.kts +++ b/build-logic/packaging/build.gradle.kts @@ -17,7 +17,6 @@ gradlePlugin { } dependencies { - implementation(project(":commons")) implementation("bitcoind-build-logic:gradle-tasks") implementation(libs.commons.codec) } diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Architecture.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Architecture.kt new file mode 100644 index 0000000000..6a02f3629d --- /dev/null +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Architecture.kt @@ -0,0 +1,36 @@ +package bisq.gradle.packaging + +import java.util.* + +enum class Architecture(val architectureName: String) { + X86_64("x86_64"), + ARM_64("arm64"), +} + +fun getArchitecture(): Architecture { + val architectureName = getArchitectureName() + if (isX86_64(architectureName)) { + return Architecture.X86_64 + } else if (isArm64(architectureName)) { + return Architecture.ARM_64 + } + + throw IllegalStateException("Running on unsupported Architecture: $architectureName") +} + +fun isX86_64(archName: String): Boolean { + return is64Bit(archName) && (archName.contains("x86") || archName.contains("amd")) +} + +fun isArm64(archName: String): Boolean { + return is64Bit(archName) && (archName.contains("aarch") || archName.contains("arm")) +} + +fun is64Bit(archName: String): Boolean { + return archName.contains("64") +} + +fun getArchitectureName(): String { + return System.getProperty("os.arch").lowercase(Locale.US) +} + diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/JPackageTask.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/JPackageTask.kt index 26a17f8ca3..dad4565b92 100644 --- a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/JPackageTask.kt +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/JPackageTask.kt @@ -1,7 +1,5 @@ package bisq.gradle.packaging -import bisq.gradle.common.OS -import bisq.gradle.common.getOS import bisq.gradle.packaging.jpackage.JPackageAppConfig import bisq.gradle.packaging.jpackage.JPackageConfig import bisq.gradle.packaging.jpackage.PackageFactory diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/OS.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/OS.kt new file mode 100644 index 0000000000..6752253ee4 --- /dev/null +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/OS.kt @@ -0,0 +1,38 @@ +package bisq.gradle.packaging + +import java.util.* + +enum class OS(val osName: String) { + LINUX("linux"), + MAC_OS("macos"), + WINDOWS("win") +} + +fun getOS(): OS { + val osName = getOSName() + if (isLinux(osName)) { + return OS.LINUX + } else if (isMacOs(osName)) { + return OS.MAC_OS + } else if (isWindows(osName)) { + return OS.WINDOWS + } + + throw IllegalStateException("Running on unsupported OS: $osName") +} + +private fun isLinux(osName: String): Boolean { + return osName.contains("linux") +} + +private fun isMacOs(osName: String): Boolean { + return osName.contains("mac") || osName.contains("darwin") +} + +private fun isWindows(osName: String): Boolean { + return osName.contains("win") +} + +fun getOSName(): String { + return System.getProperty("os.name").lowercase(Locale.US) +} 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 6ccab14611..a2ffed7df7 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 @@ -1,8 +1,5 @@ package bisq.gradle.packaging -import bisq.gradle.common.OS -import bisq.gradle.common.getOS -import bisq.gradle.common.getPlatform import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.file.Directory diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Platform.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Platform.kt new file mode 100644 index 0000000000..e4bede8b5c --- /dev/null +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Platform.kt @@ -0,0 +1,40 @@ +package bisq.gradle.packaging + +enum class Platform(val platformName: String) { + LINUX_X86_64("linux_x86_64"), + LINUX_ARM_64("linux_arm64"), + + MACOS_X86_64("macos_x86_64"), + MACOS_ARM_64("macos_arm64"), + + WIN_X86_64("win_x86_64"), + WIN_ARM_64("win_arm64") +} + +fun getPlatform(): Platform { + val os = getOS() + val architecture = getArchitecture() + when (os) { + OS.LINUX -> { + return when (architecture) { + Architecture.X86_64 -> Platform.LINUX_X86_64 + Architecture.ARM_64 -> Platform.LINUX_ARM_64 + } + } + + OS.MAC_OS -> { + return when (architecture) { + Architecture.X86_64 -> Platform.MACOS_X86_64 + Architecture.ARM_64 -> Platform.MACOS_ARM_64 + } + } + + OS.WINDOWS -> { + return when (architecture) { + Architecture.X86_64 -> Platform.WIN_X86_64 + Architecture.ARM_64 -> Platform.WIN_ARM_64 + } + } + } + throw IllegalStateException("Running on unsupported Platform: ${os.osName} / ${architecture.architectureName}") +} \ No newline at end of file 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 index cd4c1a1248..9b8f42447e 100644 --- a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt @@ -1,7 +1,5 @@ package bisq.gradle.packaging -import bisq.gradle.common.Platform -import bisq.gradle.common.getPlatform import org.gradle.api.Project import org.gradle.api.file.Directory import org.gradle.api.file.RegularFile diff --git a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Sha256HashTask.kt b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Sha256HashTask.kt index 1db33a9436..c9428c747c 100644 --- a/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Sha256HashTask.kt +++ b/build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Sha256HashTask.kt @@ -1,7 +1,5 @@ package bisq.gradle.packaging -import bisq.gradle.common.OS -import bisq.gradle.common.getOS import org.apache.commons.codec.binary.Hex import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty diff --git a/wallets/bitcoind/build-logic/bitcoin-core-binaries/build.gradle.kts b/wallets/bitcoind/build-logic/bitcoin-core-binaries/build.gradle.kts index 2babd94703..0551f6241d 100644 --- a/wallets/bitcoind/build-logic/bitcoin-core-binaries/build.gradle.kts +++ b/wallets/bitcoind/build-logic/bitcoin-core-binaries/build.gradle.kts @@ -17,6 +17,6 @@ gradlePlugin { } dependencies { - implementation("bitcoind-build-logic:gradle-tasks") + implementation(project(":gradle-tasks")) implementation(libs.google.guava) } \ No newline at end of file diff --git a/wallets/bitcoind/build-logic/commons/build.gradle.kts b/wallets/bitcoind/build-logic/commons/build.gradle.kts index d1cb3cf918..8156a89be2 100644 --- a/wallets/bitcoind/build-logic/commons/build.gradle.kts +++ b/wallets/bitcoind/build-logic/commons/build.gradle.kts @@ -4,8 +4,4 @@ plugins { repositories { gradlePluginPortal() -} - -dependencies { - implementation(libs.protobuf.gradle.plugin) } \ No newline at end of file diff --git a/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/OS.kt b/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/OS.kt index 0c275e7365..aa8fdc8e76 100644 --- a/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/OS.kt +++ b/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/OS.kt @@ -7,7 +7,7 @@ enum class OS { } fun getOS(): OS { - val osName = System.getProperty("os.name").lowercase(Locale.US) + val osName = System.getProperty("os.name").toLowerCase(Locale.US) if (isLinux(osName)) { return OS.LINUX } else if (isMacOs(osName)) { diff --git a/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/PgpFingerprint.kt b/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/PgpFingerprint.kt index c50594032c..3c08588cf6 100644 --- a/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/PgpFingerprint.kt +++ b/wallets/bitcoind/build-logic/gradle-tasks/src/main/kotlin/bisq/gradle/tasks/PgpFingerprint.kt @@ -3,5 +3,5 @@ package bisq.gradle.tasks object PgpFingerprint { fun normalize(fingerprint: String): String = fingerprint.filterNot { it.isWhitespace() } // Remove all spaces - .lowercase() + .toLowerCase() } \ No newline at end of file diff --git a/wallets/bitcoind/build-logic/settings.gradle.kts b/wallets/bitcoind/build-logic/settings.gradle.kts index 327da1202d..0677609843 100644 --- a/wallets/bitcoind/build-logic/settings.gradle.kts +++ b/wallets/bitcoind/build-logic/settings.gradle.kts @@ -1,7 +1,7 @@ dependencyResolutionManagement { versionCatalogs { create("libs") { - from(files("../../../gradle/libs.versions.toml")) + from(files("../gradle/libs.versions.toml")) } } } diff --git a/wallets/bitcoind/core/build.gradle.kts b/wallets/bitcoind/core/build.gradle.kts index f823833d48..bf4869f4a8 100644 --- a/wallets/bitcoind/core/build.gradle.kts +++ b/wallets/bitcoind/core/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("bisq.java-library") - id("bisq.protobuf") } dependencies { diff --git a/wallets/bitcoind/gradle/libs.versions.toml b/wallets/bitcoind/gradle/libs.versions.toml new file mode 100644 index 0000000000..752099c50f --- /dev/null +++ b/wallets/bitcoind/gradle/libs.versions.toml @@ -0,0 +1,26 @@ +[versions] +assertj-core-lib = { strictly = '3.22.0' } +bouncycastle-lib = { strictly = '1.69' } # Oldest version without known CVEs +google-guava-lib = { strictly = '31.1-jre' } +jeromq-lib = { strictly = '0.5.2' } +junit-jupiter-lib = { strictly = '5.8.2' } +logback-lib = { strictly = '1.2.11' } +lombok-lib = { strictly = '1.18.34' } +mockito-lib = { strictly = '4.11.0' } +slf4j-lib = { strictly = '1.7.36' } +square-moshi-lib = { strictly = '1.14.0' } +square-okhttp-libs = { strictly = '4.10.0' } + +[libraries] +assertj-core = { module = 'org.assertj:assertj-core', version.ref = 'assertj-core-lib' } +bouncycastle-pg = { module = 'org.bouncycastle:bcpg-jdk15on', version.ref = 'bouncycastle-lib' } +google-guava = { module = 'com.google.guava:guava', version.ref = 'google-guava-lib' } +jeromq = { module = 'org.zeromq:jeromq', version.ref = 'jeromq-lib' } +junit-jupiter = { module = 'org.junit.jupiter:junit-jupiter', version.ref = 'junit-jupiter-lib' } +logback-classic = { module = 'ch.qos.logback:logback-classic', version.ref = 'logback-lib' } +logback-core = { module = 'ch.qos.logback:logback-core', version.ref = 'logback-lib' } +lombok = { module = 'org.projectlombok:lombok', version.ref = 'lombok-lib' } +mockito = { module = 'org.mockito:mockito-core', version.ref = 'mockito-lib' } +slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j-lib' } +square-moshi = { module = 'com.squareup.moshi:moshi', version.ref = 'square-moshi-lib' } +square-okhttp-bom = { module = 'com.squareup.okhttp3:okhttp-bom', version.ref = 'square-okhttp-libs' } \ No newline at end of file diff --git a/wallets/bitcoind/json-rpc/build.gradle.kts b/wallets/bitcoind/json-rpc/build.gradle.kts index e844a57206..56d79488b7 100644 --- a/wallets/bitcoind/json-rpc/build.gradle.kts +++ b/wallets/bitcoind/json-rpc/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("bisq.java-library") - id("bisq.protobuf") } dependencies { diff --git a/wallets/bitcoind/settings.gradle.kts b/wallets/bitcoind/settings.gradle.kts index a929012067..b36c5a98da 100644 --- a/wallets/bitcoind/settings.gradle.kts +++ b/wallets/bitcoind/settings.gradle.kts @@ -3,17 +3,6 @@ pluginManagement { gradlePluginPortal() } includeBuild("build-logic") - includeBuild("../../build-logic") { - name = "root-build-logic" - } -} - -dependencyResolutionManagement { - versionCatalogs { - create("libs") { - from(files("../../gradle/libs.versions.toml")) - } - } } include("core") diff --git a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumConfig.java b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumConfig.java index 6cde238bf2..9aa5c96823 100644 --- a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumConfig.java +++ b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumConfig.java @@ -18,7 +18,7 @@ package bisq.wallets.electrum; import bisq.common.util.NetworkUtils; -import bisq.wallets.json_rpc.RpcConfig; +import bisq.wallets.bitcoind.RpcConfig; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; import lombok.Getter; diff --git a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumRegtestProcess.java b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumRegtestProcess.java index ee548148f6..075ea6f2a3 100644 --- a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumRegtestProcess.java +++ b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumRegtestProcess.java @@ -75,7 +75,7 @@ public void start() { logFilePath = findNewLogFile(); super.start(); rpcConfig = electrumProcessConfig.getElectrumConfig() - .toRpcConfig(); + .toRpcConfig().toJsonRpcConfig(); } public void stopOld() { @@ -151,7 +151,7 @@ protected Set getIsSuccessfulStartUpLogLines() { } private ElectrumDaemon createElectrumDaemon() { - RpcConfig rpcConfig = electrumProcessConfig.getElectrumConfig().toRpcConfig(); + RpcConfig rpcConfig = electrumProcessConfig.getElectrumConfig().toRpcConfig().toJsonRpcConfig(); JsonRpcClient jsonRpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig); return new ElectrumDaemon(jsonRpcClient); } diff --git a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumWalletService.java b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumWalletService.java index 33b8116b3e..53a69cd060 100644 --- a/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumWalletService.java +++ b/wallets/electrum/src/main/java/bisq/wallets/electrum/ElectrumWalletService.java @@ -97,13 +97,7 @@ public ElectrumWalletService(Config config, Path bisqDataDir) { @Override public CompletableFuture initialize() { log.info("initialize"); - bisq.wallets.json_rpc.RpcConfig jsonRpcConfig = processConfig.getElectrumConfig().toRpcConfig(); - bisq.wallets.bitcoind.RpcConfig rpcConfig = RpcConfig.builder() - .hostname(jsonRpcConfig.getHostname()) - .port(jsonRpcConfig.getPort()) - .user(jsonRpcConfig.getUser()) - .password(jsonRpcConfig.getPassword()) - .build(); + RpcConfig rpcConfig = processConfig.getElectrumConfig().toRpcConfig(); return initializeWallet(rpcConfig, Optional.empty()); }