From d176fca28f0db80c67c7eb2cbb60638d213b9917 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 24 Feb 2024 23:11:54 +0100 Subject: [PATCH] =?utf8?q?=E2=AC=86=EF=B8=8F=20Update=20a=20bunch=20of=20d?= =?utf8?q?ependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This also requires Java 17 to run rhynodge. --- build.gradle | 42 +++++++++++----------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../net/pterodactylus/rhynodge/engine/Engine.java | 4 +-- .../net/pterodactylus/rhynodge/engine/Starter.java | 2 +- .../rhynodge/loader/ChainWatcher.java | 4 +-- .../rhynodge/states/StateManager.java | 13 +++++-- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index 04c938d..b8c2653 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlinVersion = '1.4.10' + ext.kotlinVersion = '1.9.20' repositories { mavenCentral() @@ -11,7 +11,7 @@ buildscript { plugins { id 'java' - id('org.jetbrains.kotlin.jvm') version '1.4.10' + id('org.jetbrains.kotlin.jvm') version '1.9.20' } apply plugin: "war" @@ -19,9 +19,9 @@ apply plugin: "jacoco" apply plugin: "idea" idea { - project { - languageLevel = "1.8" - } + project { + languageLevel = "17" + } } group = "net.pterodactylus" @@ -36,21 +36,23 @@ repositories { } dependencies { - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "$kotlinVersion" - compile group: "com.google.guava", name: "guava", version: "14.0-rc1" - compile group: "log4j", name: "log4j", version: "1.2.17" - compile group: "org.apache.httpcomponents", name: "httpclient", version: "4.4" - compile group: "org.jsoup", name: "jsoup", version: "1.16.1" - compile group: "javax.mail", name: "mail", version: "1.4.6-rc1" - compile group: "org.apache.commons", name: "commons-lang3", version: "3.1" - compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.15.1" - compile group: "com.google.inject", name: "guice", version: "4.0" - compile group: "org.jetbrains.kotlinx", name: "kotlinx-html-jvm", version: "0.7.1" - compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' - - testCompile group: "junit", name: "junit", version:"4.12" - testCompile group: "org.hamcrest", name: "hamcrest-library", version:"1.3" - testCompile group: "org.mockito", name: "mockito-core", version:"1.9.5" + implementation group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlinVersion + implementation group: "com.google.guava", name: "guava", version: "14.0-rc1" + implementation group: "log4j", name: "log4j", version: "1.2.17" + implementation group: "org.apache.httpcomponents", name: "httpclient", version: "4.4" + implementation group: "org.jsoup", name: "jsoup", version: "1.16.1" + implementation group: "javax.mail", name: "mail", version: "1.4.6-rc1" + implementation group: "org.apache.commons", name: "commons-lang3", version: "3.1" + implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.16.1" + implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.16.1' + implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: '2.16.1' + implementation group: "com.google.inject", name: "guice", version: "7.0.0" + implementation group: "org.jetbrains.kotlinx", name: "kotlinx-html-jvm", version: "0.11.0" + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' + + testImplementation group: "junit", name: "junit", version: "4.13.2" + testImplementation group: "org.hamcrest", name: "hamcrest-library", version: "1.3" + testImplementation group: "org.mockito", name: "mockito-core", version: "1.9.5" } task fatJar(type: Jar) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4bcb004..111cb7b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip diff --git a/src/main/java/net/pterodactylus/rhynodge/engine/Engine.java b/src/main/java/net/pterodactylus/rhynodge/engine/Engine.java index 8ff7020..99eff2f 100644 --- a/src/main/java/net/pterodactylus/rhynodge/engine/Engine.java +++ b/src/main/java/net/pterodactylus/rhynodge/engine/Engine.java @@ -28,8 +28,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; -import javax.inject.Inject; -import javax.inject.Singleton; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; import net.pterodactylus.rhynodge.Reaction; import net.pterodactylus.rhynodge.actions.EmailAction; diff --git a/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java b/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java index bed4935..2908ddd 100644 --- a/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java +++ b/src/main/java/net/pterodactylus/rhynodge/engine/Starter.java @@ -56,7 +56,7 @@ public class Starter { /* start a watcher. */ ChainWatcher chainWatcher = injector.getInstance(ChainWatcher.class); - chainWatcher.start(); + chainWatcher.startAsync().awaitTerminated(); } private static EmailAction createErrorEmailAction(String smtpHostname, String errorEmailSender, String errorEmailRecipient) { diff --git a/src/main/java/net/pterodactylus/rhynodge/loader/ChainWatcher.java b/src/main/java/net/pterodactylus/rhynodge/loader/ChainWatcher.java index 411e137..2dc071d 100644 --- a/src/main/java/net/pterodactylus/rhynodge/loader/ChainWatcher.java +++ b/src/main/java/net/pterodactylus/rhynodge/loader/ChainWatcher.java @@ -27,8 +27,8 @@ import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.TimeUnit; -import javax.inject.Inject; -import javax.inject.Singleton; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; import net.pterodactylus.rhynodge.Reaction; import net.pterodactylus.rhynodge.engine.Engine; diff --git a/src/main/java/net/pterodactylus/rhynodge/states/StateManager.java b/src/main/java/net/pterodactylus/rhynodge/states/StateManager.java index 8e0c72e..9b46feb 100644 --- a/src/main/java/net/pterodactylus/rhynodge/states/StateManager.java +++ b/src/main/java/net/pterodactylus/rhynodge/states/StateManager.java @@ -24,8 +24,11 @@ import java.io.File; import java.io.IOException; import java.util.Optional; -import javax.inject.Inject; -import javax.inject.Singleton; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.module.kotlin.KotlinModule; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; import net.pterodactylus.rhynodge.State; @@ -50,6 +53,12 @@ public class StateManager { /** Jackson object mapper. */ private final ObjectMapper objectMapper = new ObjectMapper(); + { + objectMapper.registerModule(new KotlinModule.Builder().build()); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + } + /** The directory in which to store states. */ private final String directory; -- 2.7.4