🔀 Merge branch 'website/epic-games' into next
[rhynodge.git] / build.gradle
index a3d02ab..9e286ff 100644 (file)
@@ -1,71 +1,82 @@
-apply plugin: "java"
-apply plugin: "kotlin"
-apply plugin: "war"
-apply plugin: "jacoco"
-apply plugin: "idea"
-
-idea {
-       project {
-               languageLevel = "1.8"
-       }
-}
-
-group = "net.pterodactylus"
-version = "0.1"
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
 buildscript {
-    ext.kotlinVersion = '1.0.2'
+    ext.kotlinVersion = '1.9.20'
 
     repositories {
         mavenCentral()
     }
     dependencies {
         classpath group: "org.ajoberstar", name: "gradle-git", version: "1.1.0"
-        classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: "$kotlinVersion"
     }
 }
 
+plugins {
+    id 'java'
+    id('org.jetbrains.kotlin.jvm') version '1.9.20'
+}
+
+apply plugin: "jacoco"
+apply plugin: "idea"
+
+kotlin {
+    jvmToolchain(17)
+}
+
+java {
+    toolchain {
+        languageVersion.set(JavaLanguageVersion.of(17))
+    }
+}
+
+idea {
+    project {
+        languageLevel = "17"
+    }
+}
+
+group = "net.pterodactylus"
+version = "0.1"
+
 repositories {
     mavenCentral()
-    maven {
-        url "http://dl.bintray.com/kotlinx/kotlinx"
-    }
 }
 
 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.7.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-core", version: "2.1.2"
-    compile group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.1.2"
-    compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.1.2"
-    compile group: "com.google.inject", name: "guice", version: "4.0"
-    compile group: "org.jetbrains.kotlinx", name: "kotlinx.html", version: "0.5.8"
-    compile group: "org.jetbrains.kotlinx", name: "kotlinx.html.jvm", version: "0.5.8"
-
-    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: "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", version: "2.2"
+    testImplementation group: "org.mockito", name: "mockito-core", version: "5.11.0"
+    testImplementation group: "com.spotify", name: "hamcrest-jackson", version: "1.3.2"
 }
 
 task fatJar(type: Jar) {
-       baseName = project.name + "-all"
-       manifest {
-               attributes(
-                       "Main-Class": "net.pterodactylus.rhynodge.engine.Starter"
-               )
-       }
-       from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
-       from { sourceSets.generated.resources.srcDirs }
-       with jar
-       dependsOn test
+    archiveBaseName.set(project.name + "-all")
+    manifest {
+        attributes(
+                "Main-Class": "net.pterodactylus.rhynodge.engine.Starter"
+        )
+    }
+    duplicatesStrategy = DuplicatesStrategy.INCLUDE
+    from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
+    from { sourceSets.generated.resources.srcDirs }
+    with jar
+    dependsOn test
+}
+
+tasks.named('test') {
+    jvmArgs += "--add-opens=java.base/java.lang=ALL-UNNAMED"
+    jvmArgs += "--add-opens=java.base/java.util=ALL-UNNAMED"
 }
 
 task createVersion() {
@@ -79,20 +90,22 @@ task createVersion() {
     processResources.dependsOn(createVersion)
 }
 
+tasks.named("processGeneratedResources") {
+    duplicatesStrategy = DuplicatesStrategy.INCLUDE
+}
 
 import org.ajoberstar.grgit.Grgit
-createVersion << {
-    def gitRepo = Grgit.open(".")
-    version = gitRepo.describe()
-    new File("src/generated/resources").mkdirs()
-    new File("src/generated/resources/version.txt").withWriter() { it.write(version) }
+createVersion {
+    doLast {
+        def gitRepo = Grgit.open(projectDir)
+        version = gitRepo.describe()
+        new File("src/generated/resources").mkdirs()
+        new File("src/generated/resources/version.txt").withWriter() { it.write(version) }
+    }
 }
 
-war {
-    classpath sourceSets.generated.output
-    dependsOn(test)
+jacoco {
+    toolVersion = "0.8.11"
 }
 
-apply plugin: "jacoco"
-
 /* vim: set ts=4 sw=4 et: */