Skip to content

Commit

Permalink
update lavalink dependencies (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 authored Jun 19, 2023
1 parent b82dd21 commit 19d7dff
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 13
java-version: 17
cache: gradle

- name: Setup Gradle
Expand Down
24 changes: 12 additions & 12 deletions LavalinkServer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import org.springframework.boot.gradle.tasks.run.BootRun
plugins {
application
`maven-publish`
id("org.springframework.boot")
id("com.gorylenko.gradle-git-properties")
id("org.ajoberstar.grgit")
id("com.adarshr.test-logger")
id("kotlin")
id("kotlin-spring")
}

apply(plugin = "org.springframework.boot")
apply(plugin = "com.gorylenko.gradle-git-properties")
apply(plugin = "org.ajoberstar.grgit")
apply(plugin = "com.adarshr.test-logger")
apply(plugin = "kotlin")
apply(plugin = "kotlin-spring")

val archivesBaseName = "Lavalink-Server"
description = "Play audio to discord voice channels"
group = "dev.arbjerg.lavalink"
Expand All @@ -23,8 +22,8 @@ application {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
Expand Down Expand Up @@ -62,9 +61,10 @@ dependencies {
implementation(libs.kotlin.reflect)
implementation(libs.logback)
implementation(libs.sentry.logback)
implementation(libs.oshi)

compileOnly(libs.spotbugs)
implementation(libs.oshi) {
// This version of SLF4J does not recognise Logback 1.2.3
exclude(group = "org.slf4j", module = "slf4j-api")
}

testImplementation(libs.spring.boot.test)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package lavalink.server.config

import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpStatus
import org.springframework.web.servlet.HandlerInterceptor
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@Configuration
class RequestAuthorizationFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ class SentryConfiguration(sentryConfig: SentryConfigProperties) {
private final fun turnOn(dsn: String, tags: Map<String, String>, environment: String) {
log.info("Turning on sentry")

val sentryClient = Sentry.init(dsn)
if (environment.isNotBlank()) sentryClient.environment = environment

tags.forEach { (name, value) -> sentryClient.addTag(name, value) }

// set the git commit hash this was build on as the release
val gitProps = Properties()
try {
Expand All @@ -42,13 +37,19 @@ class SentryConfiguration(sentryConfig: SentryConfigProperties) {
} catch (e: IOException) {
log.error("Failed to load git repo information", e)
}

val commitHash = gitProps.getProperty("git.commit.id")
if (commitHash != null && commitHash.isNotEmpty()) {
log.info("Setting sentry release to commit hash $commitHash")
sentryClient.release = commitHash
} else {
log.warn("No git commit hash found to set up sentry release")

Sentry.init {options ->
options.dsn = dsn
if (environment.isNotBlank()) options.environment = environment
tags.forEach { (name, value) -> options.tags[name] = value }

if (commitHash != null && commitHash.isNotEmpty()) {
log.info("Setting sentry release to commit hash $commitHash")
options.release = commitHash
} else {
log.warn("No git commit hash found to set up sentry release")
}
}

sentryLogbackAppender.start()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package lavalink.server.io

import jakarta.servlet.http.HttpServletRequest
import lavalink.server.config.RequestLoggingConfig
import org.slf4j.LoggerFactory
import org.springframework.web.filter.AbstractRequestLoggingFilter
import javax.servlet.http.HttpServletRequest

class RequestLoggingFilter(
requestLoggingConfig: RequestLoggingConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package lavalink.server.io

import jakarta.servlet.FilterChain
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.springframework.stereotype.Component
import org.springframework.web.filter.OncePerRequestFilter
import javax.servlet.FilterChain
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse

@Component
class ResponseHeaderFilter : OncePerRequestFilter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package lavalink.server.io
import com.sedmelluq.lava.extensions.youtuberotator.planner.*
import dev.arbjerg.lavalink.protocol.v4.RoutePlannerFreeAddress
import dev.arbjerg.lavalink.protocol.v4.RoutePlannerStatus
import jakarta.servlet.http.HttpServletRequest
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -13,7 +14,6 @@ import org.springframework.web.server.ResponseStatusException
import java.net.InetAddress
import java.net.UnknownHostException
import java.util.*
import javax.servlet.http.HttpServletRequest

@RestController
class RoutePlannerRestHandler(private val routePlanner: AbstractRoutePlanner?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Nullable;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
Expand All @@ -36,12 +35,12 @@ public PrometheusMetricsController() {
}

@GetMapping(produces = TextFormat.CONTENT_TYPE_004)
public ResponseEntity<String> getMetrics(@Nullable @RequestParam(name = "name[]", required = false) String[] includedParam)
public ResponseEntity<String> getMetrics(@RequestParam(name = "name[]", required = false) String[] includedParam)
throws IOException {
return buildAnswer(includedParam);
}

private ResponseEntity<String> buildAnswer(@Nullable String[] includedParam) throws IOException {
private ResponseEntity<String> buildAnswer(String[] includedParam) throws IOException {
Set<String> params;
if (includedParam == null) {
params = Collections.emptySet();
Expand All @@ -50,11 +49,9 @@ private ResponseEntity<String> buildAnswer(@Nullable String[] includedParam) thr
}

Writer writer = new StringWriter();
try {
try (writer) {
TextFormat.write004(writer, this.registry.filteredMetricFamilySamples(params));
writer.flush();
} finally {
writer.close();
}

return new ResponseEntity<>(writer.toString(), HttpStatus.OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import dev.arbjerg.lavalink.protocol.v4.EncodedTracks
import dev.arbjerg.lavalink.protocol.v4.LoadResult
import dev.arbjerg.lavalink.protocol.v4.Track
import dev.arbjerg.lavalink.protocol.v4.Tracks
import jakarta.servlet.http.HttpServletRequest
import lavalink.server.util.decodeTrack
import lavalink.server.util.toTrack
import org.slf4j.LoggerFactory
Expand All @@ -35,7 +36,6 @@ import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.web.server.ResponseStatusException
import java.util.concurrent.CompletionStage
import javax.servlet.http.HttpServletRequest

@RestController
class AudioLoaderRestHandler(
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ A [basic example bot](Testbot) is available.

## Requirements

* Java 11 LTS or newer required. (we recommend running the latest LTS version or newer)
* Java 17 LTS or newer required. (we recommend running the latest LTS version or newer)
* OpenJDK or Zulu running on Linux AMD64 is officially supported.

Support for Darwin (Mac), Windows AMD64, and Linux ARM (Raspberry Pi) is provided on a best-effort basis. This is dependent on Lavaplayer's native libraries.
Expand All @@ -58,8 +58,6 @@ JDA-NAS(Native Audio Buffer) & the Timescale filter are currently not supported

Support for other JVMs is also best-effort. Periodic CPU utilization stats are prone not to work everywhere.

**\*Java 11 appears to have some issues with Discord's TLS 1.3. Java 14 has other undiagnosed HTTPS problems. Use Java 13. Docker images have been updated.** See [#258](https://github.com/lavalink-devs/Lavalink/issues/258), [#260](https://github.com/lavalink-devs/Lavalink/issues/260)

## Changelog

Please see [here](CHANGELOG.md)
Expand Down
5 changes: 0 additions & 5 deletions Testbot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ plugins {
group = "dev.arbjerg.lavalink"
version = "1.0"

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

application {
mainClass.set("lavalink.testbot.TestbotKt")
}
Expand Down
33 changes: 11 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import org.ajoberstar.grgit.Grgit
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
mavenLocal()
maven("https://plugins.gradle.org/m2/")
maven("https://repo.spring.io/plugins-release")
maven("https://jitpack.io")
maven("https://m2.dv8tion.net/releases")
}

dependencies {
classpath("gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.5.2")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.6")
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2")
classpath("com.adarshr:gradle-test-logger-plugin:1.6.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
classpath("org.jetbrains.kotlin:kotlin-allopen:1.8.21")
}
plugins {
id("org.jetbrains.dokka") version "1.8.20" apply false
id("com.gorylenko.gradle-git-properties") version "2.4.1"
id("org.ajoberstar.grgit") version "5.2.0"
id("org.springframework.boot") version "3.1.0" apply false
id("org.sonarqube") version "4.2.0.3129"
id("com.adarshr.test-logger") version "3.2.0"
id("org.jetbrains.kotlin.jvm") version "1.8.22"
id("org.jetbrains.kotlin.plugin.allopen") version "1.8.22"
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.22" apply false
}

allprojects {
Expand All @@ -33,18 +26,14 @@ allprojects {
}
}

plugins {
id("org.jetbrains.dokka") version "1.8.10"
}

subprojects {
if (project.hasProperty("includeAnalysis")) {
project.logger.lifecycle("applying analysis plugins")
apply(from = "../analysis.gradle")
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = "17"
}

tasks.withType<JavaCompile> {
Expand Down
4 changes: 2 additions & 2 deletions plugin-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
}

tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
jvmTarget.set(JvmTarget.JVM_17)
freeCompilerArgs.add("-Xjvm-default=all")
}
}
Expand Down
6 changes: 3 additions & 3 deletions protocol/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest

plugins {
`maven-publish`
signing
`maven-publish`
kotlin("multiplatform")
kotlin("plugin.serialization") version "1.8.21"
kotlin("plugin.serialization")
}

val archivesBaseName = "protocol"
Expand All @@ -16,7 +16,7 @@ kotlin {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion protocol/src/commonTest/kotlin/OmissibleTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dev.arbjerg.lavalink.protocol.v4.Omissible
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import kotlin.js.JsName
Expand Down
1 change: 0 additions & 1 deletion protocol/src/commonTest/kotlin/PlayerSerializerTest.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dev.arbjerg.lavalink.protocol.v4.Omissible
import dev.arbjerg.lavalink.protocol.v4.Player
import dev.arbjerg.lavalink.protocol.v4.PlayerUpdate
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlin.js.JsName
import kotlin.test.Test
Expand Down
1 change: 0 additions & 1 deletion protocol/src/commonTest/kotlin/Utils.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import dev.arbjerg.lavalink.protocol.v4.Omissible
import dev.arbjerg.lavalink.protocol.v4.json
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.encodeToString
import kotlin.test.assertEquals
import kotlin.test.assertIs
Expand Down
Loading

0 comments on commit 19d7dff

Please sign in to comment.