diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 36e3f2b..64fbb4d 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: java-version: [17, 21, 24] - kotlin-version: [1.9.25, 2.1.10] + kotlin-version: [1.9.25, 2.1.20] steps: - name: Checkout source repository diff --git a/README.md b/README.md index 0539e27..bb86972 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](https://opensource.org/licenses/BSD-3-Clause) -[![Kotlin](https://img.shields.io/badge/kotlin-2.1.10-7f52ff)](https://kotlinlang.org/) +[![Kotlin](https://img.shields.io/badge/kotlin-2.1.20-7f52ff)](https://kotlinlang.org/) [![bld](https://img.shields.io/badge/2.2.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![Release](https://img.shields.io/github/release/ethauvin/jokeapi.svg)](https://github.com/ethauvin/jokeapi/releases/latest) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/jokeapi?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/jokeapi) diff --git a/pom.xml b/pom.xml index 52e318e..e480d48 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik jokeapi - 1.0.0 + 1.0.1-SNAPSHOT jokeapi Retrieve jokes from Sv443's JokeAPI https://github.com/ethauvin/jokeapi @@ -18,7 +18,7 @@ org.jetbrains.kotlin kotlin-stdlib - 2.1.10 + 2.1.20 compile diff --git a/src/bld/java/net/thauvin/erik/JokeApiBuild.java b/src/bld/java/net/thauvin/erik/JokeApiBuild.java index dfb9478..ac5db7c 100644 --- a/src/bld/java/net/thauvin/erik/JokeApiBuild.java +++ b/src/bld/java/net/thauvin/erik/JokeApiBuild.java @@ -39,6 +39,7 @@ import rife.bld.extension.DokkaOperation; import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.dokka.LoggingLevel; import rife.bld.extension.dokka.OutputFormat; +import rife.bld.extension.kotlin.CompileOptions; import rife.bld.operations.exceptions.ExitStatusException; import rife.bld.publish.PomBuilder; import rife.bld.publish.PublishDeveloper; @@ -60,14 +61,14 @@ public class JokeApiBuild extends Project { public JokeApiBuild() { pkg = "net.thauvin.erik"; name = "jokeapi"; - version = version(1, 0, 0); + version = version(1, 0, 1, "SNAPSHOT"); javaRelease = 11; downloadSources = true; autoDownloadPurge = true; repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); - final var kotlin = version(2, 1, 10); + final var kotlin = version(2, 1, 20); scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) .include(dependency("org.json", "json", "20250107")) @@ -121,8 +122,11 @@ public class JokeApiBuild extends Project { @BuildCommand(summary = "Compiles the Kotlin project") @Override public void compile() throws Exception { + final var options = new CompileOptions(); + options.jvmOptions().add("--enable-native-access=ALL-UNNAMED"); new CompileKotlinOperation() .fromProject(this) + .compileOptions(options) .execute(); } diff --git a/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt b/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt index 9bd8ac1..8315010 100644 --- a/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt +++ b/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt @@ -39,6 +39,7 @@ import net.thauvin.erik.jokeapi.models.* import org.json.JSONObject import java.io.IOException import java.net.HttpURLConnection +import java.net.URI import java.net.URL import java.util.logging.Level @@ -50,7 +51,7 @@ internal fun fetchUrl(url: String, auth: String = ""): JokeResponse { JokeApi.logger.fine(url) } - val connection = URL(url).openConnection() as HttpURLConnection + val connection = URI(url).toURL().openConnection() as HttpURLConnection try { connection.setRequestProperty( "User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0"