Compare commits

...

5 commits

5 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -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)

View file

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik</groupId>
<artifactId>jokeapi</artifactId>
<version>1.0.0</version>
<version>1.0.1-SNAPSHOT</version>
<name>jokeapi</name>
<description>Retrieve jokes from Sv443&apos;s JokeAPI</description>
<url>https://github.com/ethauvin/jokeapi</url>
@ -18,7 +18,7 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.1.10</version>
<version>2.1.20</version>
<scope>compile</scope>
</dependency>
<dependency>

View file

@ -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();
}

View file

@ -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"