mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
Merge pull request #217 from amir1376/change/add-arch-name-to-releases
add arch name in output release binaries
This commit is contained in:
commit
5a31c66716
@ -2,8 +2,8 @@ package buildlogic
|
|||||||
|
|
||||||
import io.github.z4kn4fein.semver.Version
|
import io.github.z4kn4fein.semver.Version
|
||||||
import ir.amirab.installer.InstallerTargetFormat
|
import ir.amirab.installer.InstallerTargetFormat
|
||||||
|
import ir.amirab.util.platform.Arch
|
||||||
import ir.amirab.util.platform.Platform
|
import ir.amirab.util.platform.Platform
|
||||||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object CiUtils {
|
object CiUtils {
|
||||||
@ -35,7 +35,8 @@ object CiUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.name.lowercase()
|
}.name.lowercase()
|
||||||
return "${packageName}_${appVersion}_${platformName}.${fileExtension}"
|
val archName = Arch.getCurrentArch().name
|
||||||
|
return "${packageName}_${appVersion}_${platformName}_${archName}.${fileExtension}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFileOfPackagedTarget(
|
fun getFileOfPackagedTarget(
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package ir.amirab.util.platform
|
||||||
|
|
||||||
|
sealed class Arch(val name: String) {
|
||||||
|
data object X64 : Arch("x64")
|
||||||
|
data object Arm64 : Arch("arm64")
|
||||||
|
data object X32 : Arch("x32")
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object : ArchFinder by JvmArchFinder() {
|
||||||
|
private val DefinedArchStrings = mapOf(
|
||||||
|
X64 to listOf(
|
||||||
|
"amd64", "x64"
|
||||||
|
),
|
||||||
|
Arm64 to listOf(
|
||||||
|
"arm64", "aarch64"
|
||||||
|
),
|
||||||
|
X32 to listOf(
|
||||||
|
"x86",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
fun fromString(archName: String): Arch? {
|
||||||
|
val a = archName.lowercase()
|
||||||
|
return DefinedArchStrings.entries.firstOrNull {
|
||||||
|
a in it.value
|
||||||
|
}?.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ArchFinder {
|
||||||
|
fun getCurrentArch(): Arch
|
||||||
|
}
|
||||||
|
|
||||||
|
private class JvmArchFinder : ArchFinder {
|
||||||
|
private val _arch by lazy {
|
||||||
|
getCurrentArchFromJVMProperty()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getCurrentArchFromJVMProperty(): Arch {
|
||||||
|
val osString = System.getProperty("os.arch").lowercase()
|
||||||
|
return requireNotNull(Arch.fromString(osString)) {
|
||||||
|
"this arch is not recognized: $osString"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getCurrentArch(): Arch {
|
||||||
|
return _arch
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user