Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitcoind-build-logic: Remove unused protobuf dependency #2913

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build-logic/packaging/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ gradlePlugin {
}

dependencies {
implementation(project(":commons"))
implementation("bitcoind-build-logic:gradle-tasks")
implementation(libs.commons.codec)
}
Original file line number Diff line number Diff line change
@@ -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)
}

Original file line number Diff line number Diff line change
@@ -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
Expand Down
38 changes: 38 additions & 0 deletions build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/OS.kt
Original file line number Diff line number Diff line change
@@ -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)
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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}")
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions wallets/bitcoind/build-logic/commons/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,4 @@ plugins {

repositories {
gradlePluginPortal()
}

dependencies {
implementation(libs.protobuf.gradle.plugin)
}
1 change: 0 additions & 1 deletion wallets/bitcoind/core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("bisq.java-library")
id("bisq.protobuf")
}

dependencies {
Expand Down
1 change: 0 additions & 1 deletion wallets/bitcoind/json-rpc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id("bisq.java-library")
id("bisq.protobuf")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void start() {
logFilePath = findNewLogFile();
super.start();
rpcConfig = electrumProcessConfig.getElectrumConfig()
.toRpcConfig();
.toRpcConfig().toJsonRpcConfig();
}

public void stopOld() {
Expand Down Expand Up @@ -151,7 +151,7 @@ protected Set<String> getIsSuccessfulStartUpLogLines() {
}

private ElectrumDaemon createElectrumDaemon() {
RpcConfig rpcConfig = electrumProcessConfig.getElectrumConfig().toRpcConfig();
RpcConfig rpcConfig = electrumProcessConfig.getElectrumConfig().toRpcConfig().toJsonRpcConfig();
JsonRpcClient jsonRpcClient = RpcClientFactory.createDaemonRpcClient(rpcConfig);
return new ElectrumDaemon(jsonRpcClient);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,7 @@ public ElectrumWalletService(Config config, Path bisqDataDir) {
@Override
public CompletableFuture<Boolean> 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());
}

Expand Down
Loading