-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packaging: Remove dependency to Bisq 2 commons module
- Loading branch information
Showing
8 changed files
with
114 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Architecture.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
2 changes: 0 additions & 2 deletions
2
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/JPackageTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/OS.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
3 changes: 0 additions & 3 deletions
3
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/PackagingPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}") | ||
} |
2 changes: 0 additions & 2 deletions
2
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/ReleaseBinariesTaskFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
build-logic/packaging/src/main/kotlin/bisq/gradle/packaging/Sha256HashTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters