diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 007e63a..08a73b4 100644 --- a/.github/workflows/bld.yml +++ b/.github/workflows/bld.yml @@ -1,20 +1,20 @@ name: bld-ci -on: [ push, pull_request, workflow_dispatch ] +on: [push, pull_request, workflow_dispatch] env: COVERAGE_JDK: "21" - COVERAGE_KOTLIN: "2.1.20" + COVERAGE_KOTLIN: "2.0.0" + KOTLIN_HOME: /usr/share/kotlinc jobs: build-bld-project: + runs-on: ubuntu-latest + strategy: matrix: - java-version: [ 17, 21, 24 ] - kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ] - os: [ ubuntu-latest, windows-latest, macos-latest ] - - runs-on: ${{ matrix.os }} + java-version: [17, 21, 23] + kotlin-version: [1.9.25, 2.1.10] steps: - name: Checkout source repository @@ -39,13 +39,11 @@ jobs: - name: Remove pom.xml if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN - && matrix.os == 'ubuntu-latest' run: rm -rf pom.xml - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@master if: success() && matrix.java-version == env.COVERAGE_JDK && matrix.kotlin-version == env.COVERAGE_KOTLIN - && matrix.os == 'ubuntu-latest' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/README.md b/README.md index bb86972..a4e6631 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.20-7f52ff)](https://kotlinlang.org/) +[![Kotlin](https://img.shields.io/badge/kotlin-2.1.10-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) @@ -98,7 +98,7 @@ To use with [bld](https://rife2.com/bld), include the following dependency in yo repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY); scope(compile) - .include(dependency("net.thauvin.erik", "jokeapi", "1.0.0")); + .include(dependency("net.thauvin.erik", "jokeapi", "1.0.0-SNAPSHOT")); ``` Be sure to use the [bld Kotlin extension](https://github.com/rife2/bld-kotlin) in your project. @@ -112,7 +112,7 @@ repositories { } dependencies { - implementation("net.thauvin.erik:jokeapi:1.0.0") + implementation("net.thauvin.erik:jokeapi:1.0.0-SNAPSHOT") } ``` @@ -127,7 +127,7 @@ For example for YAML: var jokes = getRawJokes(format = Format.YAML, idRange = IdRange(22)) println(jokes.data) ``` - +``` ```yaml error: false category: "Programming" @@ -143,8 +143,8 @@ flags: id: 22 safe: true lang: "en" -``` +``` - View more [examples](https://github.com/ethauvin/jokeapi/blob/master/src/test/kotlin/net/thauvin/erik/jokeapi/GetRawJokesTest.kt#L46)... ## Extending diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index fc9463a..154abb0 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,10 +1,10 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT -bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.4-SNAPSHOT -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10-SNAPSHOT -bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT +bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.9 +bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.3 +bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.9 +bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.4 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= bld.version=2.2.1 diff --git a/pom.xml b/pom.xml index e480d48..52e318e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 net.thauvin.erik jokeapi - 1.0.1-SNAPSHOT + 1.0.0 jokeapi Retrieve jokes from Sv443's JokeAPI https://github.com/ethauvin/jokeapi @@ -18,7 +18,7 @@ org.jetbrains.kotlin kotlin-stdlib - 2.1.20 + 2.1.10 compile diff --git a/src/bld/java/net/thauvin/erik/JokeApiBuild.java b/src/bld/java/net/thauvin/erik/JokeApiBuild.java index 62b9d9a..1d01225 100644 --- a/src/bld/java/net/thauvin/erik/JokeApiBuild.java +++ b/src/bld/java/net/thauvin/erik/JokeApiBuild.java @@ -39,7 +39,6 @@ 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; @@ -50,9 +49,6 @@ import rife.tools.exceptions.FileUtilsErrorException; import java.io.File; import java.io.IOException; import java.util.List; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Scope.compile; @@ -64,14 +60,14 @@ public class JokeApiBuild extends Project { public JokeApiBuild() { pkg = "net.thauvin.erik"; name = "jokeapi"; - version = version(1, 0, 1, "SNAPSHOT"); + version = version(1, 0, 0); javaRelease = 11; downloadSources = true; autoDownloadPurge = true; repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); - final var kotlin = version(2, 1, 20); + final var kotlin = version(2, 1, 10); scope(compile) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) .include(dependency("org.json", "json", "20250107")) @@ -80,7 +76,6 @@ public class JokeApiBuild extends Project { .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin)) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1))) - .include(dependency("org.junit.platform", "junit-platform-launcher", version(1, 12, 1))) .include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1))); publishOperation() @@ -119,16 +114,6 @@ public class JokeApiBuild extends Project { } public static void main(String[] args) { - // Enable detailed logging for the extensions - var level = Level.ALL; - var logger = Logger.getLogger("rife.bld.extension"); - var consoleHandler = new ConsoleHandler(); - - consoleHandler.setLevel(level); - logger.addHandler(consoleHandler); - logger.setLevel(level); - logger.setUseParentHandlers(false); - new JokeApiBuild().start(args); } @@ -137,7 +122,6 @@ public class JokeApiBuild extends Project { public void compile() throws Exception { new CompileKotlinOperation() .fromProject(this) - .compileOptions(new CompileOptions().verbose(true)) .execute(); } diff --git a/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt b/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt index 651844c..9bd8ac1 100644 --- a/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt +++ b/src/main/kotlin/net/thauvin/erik/jokeapi/JokeUtil.kt @@ -39,7 +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 +50,7 @@ internal fun fetchUrl(url: String, auth: String = ""): JokeResponse { JokeApi.logger.fine(url) } - val connection = URI(url).toURL().openConnection() as HttpURLConnection + val connection = URL(url).openConnection() as HttpURLConnection try { connection.setRequestProperty( "User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0"