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

Move gradle-tasks module to bitcoind module #2824

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
2 changes: 1 addition & 1 deletion build-logic/bitcoin-core-binaries/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ gradlePlugin {
}

dependencies {
implementation(project(":gradle-tasks"))
implementation("bitcoind-build-logic:gradle-tasks")
implementation(libs.google.guava)
}
2 changes: 1 addition & 1 deletion build-logic/electrum-binaries/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ gradlePlugin {
}

dependencies {
implementation(project(":gradle-tasks"))
implementation("bitcoind-build-logic:gradle-tasks")
}
2 changes: 1 addition & 1 deletion build-logic/packaging/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gradlePlugin {
}

dependencies {
implementation(project(":gradle-tasks"))
implementation(project(":commons"))
implementation("bitcoind-build-logic:gradle-tasks")
implementation(libs.commons.codec)
}
5 changes: 4 additions & 1 deletion build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ dependencyResolutionManagement {
}
}

includeBuild("../wallets/bitcoind/build-logic") {
name = "bitcoind-build-logic"
}

include("commons")
include("bitcoin-core-binaries")
include("desktop-regtest")
include("gradle-tasks")
include("electrum-binaries")
include("packaging")
include("tor-binary")
Expand Down
2 changes: 1 addition & 1 deletion build-logic/tor-binary/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ gradlePlugin {
}

dependencies {
implementation(project(":gradle-tasks"))
implementation("bitcoind-build-logic:gradle-tasks")
}
2 changes: 1 addition & 1 deletion build-logic/webcam-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ gradlePlugin {
}

dependencies {
implementation(project(":gradle-tasks"))
implementation("bitcoind-build-logic:gradle-tasks")
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ repositories {
}

dependencies {
implementation(project(":commons"))
implementation(libs.bouncycastle.pg)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package bisq.gradle.common

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
@@ -0,0 +1,38 @@
package bisq.gradle.common

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
@@ -0,0 +1,44 @@
package bisq.gradle.common

import bisq.gradle.common.Architecture.ARM_64
import bisq.gradle.common.Architecture.X86_64
import bisq.gradle.common.OS.*
import bisq.gradle.common.Platform.*

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) {
LINUX -> {
return when (architecture) {
X86_64 -> LINUX_X86_64
ARM_64 -> LINUX_ARM_64
}
}

MAC_OS -> {
return when (architecture) {
X86_64 -> MACOS_X86_64
ARM_64 -> MACOS_ARM_64
}
}

WINDOWS -> {
return when (architecture) {
X86_64 -> WIN_X86_64
ARM_64 -> WIN_ARM_64
}
}
}
}
1 change: 1 addition & 0 deletions wallets/bitcoind/build-logic/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.caching=true
11 changes: 11 additions & 0 deletions wallets/bitcoind/build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../../../gradle/libs.versions.toml"))
}
}
}

include("gradle-tasks")

rootProject.name = "bitcoind-build-logic"
5 changes: 4 additions & 1 deletion wallets/bitcoind/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ pluginManagement {
repositories {
gradlePluginPortal()
}
includeBuild("../../build-logic")
includeBuild("build-logic")
includeBuild("../../build-logic") {
name = "root-build-logic"
}
}

dependencyResolutionManagement {
Expand Down
Loading