Skip to content

Commit b7c61da

Browse files
authored
Merge pull request #692 from freyacodes/support-more-architectures
enable jda nas for more architectures
2 parents 469d1b8 + 862ff61 commit b7c61da

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

LavalinkServer/build.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ dependencies {
4545
// This version of SLF4J does not recognise Logback 1.2.3
4646
exclude(group = "org.slf4j", module = "slf4j-api")
4747
}
48-
implementation(libs.koe.udpqueue)
48+
implementation(libs.koe.udpqueue) {
49+
exclude(module="udp-queue")
50+
}
51+
implementation(libs.bundles.udpqueue.natives)
4952

5053
implementation(libs.lavaplayer)
5154
implementation(libs.lavaplayer.ip.rotator)

LavalinkServer/src/main/java/lavalink/server/config/KoeConfiguration.kt

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package lavalink.server.config
22

3+
import com.sedmelluq.lava.common.natives.architecture.DefaultArchitectureTypes
4+
import com.sedmelluq.lava.common.natives.architecture.DefaultOperatingSystemTypes
5+
import com.sedmelluq.lava.common.natives.architecture.SystemType
36
import moe.kyokobot.koe.KoeOptions
47
import moe.kyokobot.koe.codec.udpqueue.UdpQueueFramePollerFactory
58
import org.slf4j.Logger
@@ -11,16 +14,29 @@ import org.springframework.context.annotation.Configuration
1114
class KoeConfiguration(val serverConfig: ServerConfig) {
1215

1316
private val log: Logger = LoggerFactory.getLogger(KoeConfiguration::class.java)
17+
private val supportedSystems = listOf(
18+
SystemType(DefaultArchitectureTypes.ARM, DefaultOperatingSystemTypes.LINUX),
19+
SystemType(DefaultArchitectureTypes.X86_64, DefaultOperatingSystemTypes.LINUX),
20+
SystemType(DefaultArchitectureTypes.X86_32, DefaultOperatingSystemTypes.LINUX),
21+
SystemType(DefaultArchitectureTypes.ARMv8_64, DefaultOperatingSystemTypes.LINUX),
22+
23+
SystemType(DefaultArchitectureTypes.X86_64, DefaultOperatingSystemTypes.WINDOWS),
24+
SystemType(DefaultArchitectureTypes.X86_32, DefaultOperatingSystemTypes.WINDOWS),
25+
26+
SystemType(DefaultArchitectureTypes.X86_64, DefaultOperatingSystemTypes.DARWIN),
27+
SystemType(DefaultArchitectureTypes.ARMv8_64, DefaultOperatingSystemTypes.DARWIN)
28+
)
1429

1530
@Bean
1631
fun koeOptions(): KoeOptions = KoeOptions.builder().apply {
17-
log.info("OS: " + System.getProperty("os.name") + ", Arch: " + System.getProperty("os.arch"))
18-
val os = System.getProperty("os.name")
19-
val arch = System.getProperty("os.arch")
32+
val systemType: SystemType? = try {
33+
SystemType(DefaultArchitectureTypes.detect(), DefaultOperatingSystemTypes.detect())
34+
} catch (e: IllegalArgumentException) {
35+
null
36+
}
37+
log.info("OS: ${systemType?.osType ?: "unknown"}, Arch: ${systemType?.architectureType ?: "unknown"}")
2038

21-
// Maybe add Windows natives back?
22-
val nasSupported = os.contains("linux", ignoreCase = true)
23-
&& arch.equals("amd64", ignoreCase = true)
39+
val nasSupported = supportedSystems.any { it.osType == systemType?.osType && it.architectureType == systemType?.architectureType }
2440

2541
if (nasSupported) {
2642
log.info("Enabling JDA-NAS")

settings.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ fun VersionCatalogBuilder.voice() {
4444

4545
library("koe", "moe.kyokobot.koe", "core").version("2.0.0-rc1")
4646
library("koe-udpqueue", "moe.kyokobot.koe", "ext-udpqueue").version("2.0.0-rc1")
47+
48+
version("udpqueue", "0.1.6")
49+
val platforms = listOf("linux-x86-64", "linux-x86", "linux-aarch64", "linux-arm", "win-x86-64", "win-x86", "darwin")
50+
platforms.forEach {
51+
library("udpqueue-native-$it", "club.minnced", "udpqueue-native-$it").versionRef("udpqueue")
52+
}
53+
54+
bundle("udpqueue-natives", platforms.map { "udpqueue-native-$it" })
4755
}
4856

4957
fun VersionCatalogBuilder.metrics() {

0 commit comments

Comments
 (0)