Upgraded to Kotlin 1.9.21

This commit is contained in:
Erik C. Thauvin 2023-11-23 17:56:29 -08:00
parent f850dbb51c
commit b4194b765a
10 changed files with 36 additions and 88 deletions

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) [![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-1.9.20-7f52ff)](https://kotlinlang.org/) [![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-7f52ff)](https://kotlinlang.org/)
[![Release](https://img.shields.io/github/release/ethauvin/akismet-kotlin.svg)](https://github.com/ethauvin/akismet-kotlin/releases/latest) [![Release](https://img.shields.io/github/release/ethauvin/akismet-kotlin.svg)](https://github.com/ethauvin/akismet-kotlin/releases/latest)
[![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/akismet-kotlin?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/akismet-kotlin/) [![Nexus Snapshot](https://img.shields.io/nexus/s/net.thauvin.erik/akismet-kotlin?label=snapshot&server=https%3A%2F%2Foss.sonatype.org%2F)](https://oss.sonatype.org/content/repositories/snapshots/net/thauvin/erik/akismet-kotlin/)
[![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/akismet-kotlin.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/akismet-kotlin) [![Maven Central](https://img.shields.io/maven-central/v/net.thauvin.erik/akismet-kotlin.svg?color=blue)](https://central.sonatype.com/artifact/net.thauvin.erik/akismet-kotlin)

View file

@ -1,7 +1,7 @@
## Kotlin Example ## Kotlin Example
To compile & run the Kotlin example: To compile & run the Kotlin example:
```text ```console
./bld compile ./bld compile
./bld run --args=API_KEY ./bld run --args=API_KEY
@ -11,7 +11,7 @@ To compile & run the Kotlin example:
cd cd
To compile & run the Java example: To compile & run the Java example:
```text ```console
./bld compile ./bld compile
./bld run-java --args=API_KEY ./bld run-java --args=API_KEY

View file

@ -1,12 +1,10 @@
package com.example; package com.example;
import rife.bld.BaseProject;
import rife.bld.BuildCommand; import rife.bld.BuildCommand;
import rife.bld.extension.CompileKotlinOperation; import rife.bld.extension.CompileKotlinOperation;
import rife.bld.extension.CompileKotlinOptions;
import rife.bld.operations.RunOperation; import rife.bld.operations.RunOperation;
import rife.bld.BaseProject;
import java.util.List;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile; import static rife.bld.dependencies.Scope.compile;
@ -37,11 +35,6 @@ public class ExampleBuild extends BaseProject {
public void compile() throws Exception { public void compile() throws Exception {
new CompileKotlinOperation() new CompileKotlinOperation()
.fromProject(this) .fromProject(this)
.compileOptions(
new CompileKotlinOptions()
.jdkRelease(javaRelease)
.verbose(true)
)
.execute(); .execute();
// Also compile the Java source code // Also compile the Java source code

View file

@ -1 +1 @@
akismet-examples-gradle akismet-examples

View file

@ -1,7 +1,7 @@
## Kotlin Example ## Kotlin Example
To compile & run the Kotlin example: To compile & run the Kotlin example:
```text ```console
./gradlew run --args=API_KEY ./gradlew run --args=API_KEY
``` ```
@ -9,6 +9,6 @@ To compile & run the Kotlin example:
To compile & run the Java example: To compile & run the Java example:
```text ```console
./gradlew runJava --args=API_KEY ./gradlew runJava --args=API_KEY
``` ```

View file

@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("application") id("application")
id("com.github.ben-manes.versions") version "0.49.0" id("com.github.ben-manes.versions") version "0.50.0"
kotlin("jvm") version "1.9.20" kotlin("jvm") version "1.9.21"
} }
defaultTasks(ApplicationPlugin.TASK_RUN_NAME) defaultTasks(ApplicationPlugin.TASK_RUN_NAME)

View file

@ -2,7 +2,7 @@ bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1 bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1
bld.extensions-kotlin=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT bld.extensions-kotlin=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT
bld.extensions=com.uwyn.rife2:bld-generated-version:0.9.3-SNAPSHOT bld.extensions=com.uwyn.rife2:bld-generated-version:0.9.3
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation= bld.downloadLocation=
bld.sourceDirectories= bld.sourceDirectories=

View file

@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId> <artifactId>kotlin-stdlib</artifactId>
<version>1.9.20</version> <version>1.9.21</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -42,7 +42,7 @@
<dependency> <dependency>
<groupId>org.jetbrains.kotlinx</groupId> <groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-json-jvm</artifactId> <artifactId>kotlinx-serialization-json-jvm</artifactId>
<version>1.6.0</version> <version>1.6.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -55,7 +55,7 @@
</developer> </developer>
</developers> </developers>
<scm> <scm>
<connection>scm:git:https://github.com/ethauvin/akismet-kotlin</connection> <connection>scm:git:https://github.com/ethauvin/akismet-kotlin.git</connection>
<developerConnection>scm:git:git@github.com:ethauvin/akismet-kotlin.git</developerConnection> <developerConnection>scm:git:git@github.com:ethauvin/akismet-kotlin.git</developerConnection>
<url>https://github.com/ethauvin/akismet-kotlin</url> <url>https://github.com/ethauvin/akismet-kotlin</url>
</scm> </scm>

View file

@ -65,16 +65,16 @@ public class AkismetBuild extends Project {
var okHttp = version(4, 12, 0); var okHttp = version(4, 12, 0);
scope(compile) scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 20))) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 21)))
.include(dependency("com.squareup.okhttp3", "okhttp", okHttp)) .include(dependency("com.squareup.okhttp3", "okhttp", okHttp))
.include(dependency("com.squareup.okhttp3", "logging-interceptor", okHttp)) .include(dependency("com.squareup.okhttp3", "logging-interceptor", okHttp))
.include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0))) .include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0)))
.include(dependency("org.jetbrains.kotlinx", "kotlinx-serialization-json-jvm", version(1, 6, 0))); .include(dependency("org.jetbrains.kotlinx", "kotlinx-serialization-json-jvm", version(1, 6, 1)));
scope(provided) scope(provided)
.include(dependency("org.jetbrains.kotlin:kotlin-serialization-compiler-plugin:1.9.20")); .include(dependency("org.jetbrains.kotlin", "kotlin-serialization-compiler-plugin", version(1, 9, 21)));
scope(test) scope(test)
.include(dependency("org.mockito", "mockito-core", version(5, 6, 0))) .include(dependency("org.mockito", "mockito-core", version(5, 7, 0)))
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", version(1, 9, 20))) .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", version(1, 9, 21)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
.include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 27, 0))); .include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 27, 0)));
@ -89,18 +89,24 @@ public class AkismetBuild extends Project {
.artifactId(name) .artifactId(name)
.description("A client library for accessing the Automattic Kismet (Akismet) spam comments filtering service.") .description("A client library for accessing the Automattic Kismet (Akismet) spam comments filtering service.")
.url("https://github.com/ethauvin/" + name) .url("https://github.com/ethauvin/" + name)
.developer(new PublishDeveloper() .developer(
.id("ethauvin") new PublishDeveloper()
.name("Erik C. Thauvin") .id("ethauvin")
.email("erik@thauvin.net") .name("Erik C. Thauvin")
.url("https://erik.thauvin.net/")) .email("erik@thauvin.net")
.license(new PublishLicense() .url("https://erik.thauvin.net/")
.name("BSD 3-Clause") )
.url("https://opensource.org/licenses/BSD-3-Clause")) .license(
.scm(new PublishScm()
.connection("scm:git:https://github.com/ethauvin/" + name) new PublishLicense()
.developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git") .name("BSD 3-Clause")
.url("https://github.com/ethauvin/" + name)) .url("https://opensource.org/licenses/BSD-3-Clause"))
.scm(
new PublishScm()
.connection("scm:git:https://github.com/ethauvin/" + name + ".git")
.developerConnection("scm:git:git@github.com:ethauvin/" + name + ".git")
.url("https://github.com/ethauvin/" + name))
.signKey(property("sign.key")) .signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase")); .signPassphrase(property("sign.passphrase"));
@ -118,11 +124,6 @@ public class AkismetBuild extends Project {
new CompileKotlinOperation() new CompileKotlinOperation()
.fromProject(this) .fromProject(this)
.plugins(libCompileDirectory(), CompileKotlinPlugin.KOTLIN_SERIALIZATION) .plugins(libCompileDirectory(), CompileKotlinPlugin.KOTLIN_SERIALIZATION)
.compileOptions(
new CompileKotlinOptions()
.jdkRelease(javaRelease)
.verbose(true)
)
.execute(); .execute();
} }

View file

@ -1,46 +0,0 @@
/*
* AkismetTest.java
*
* Copyright 2019-2023 Erik C. Thauvin (erik@thauvin.net)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of this project nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.thauvin.erik;
public class AkismetTest {
public static void main(String[] args) {
new AkismetTest().verifyHello();
}
void verifyHello() {
if (!"Hello World!".equals(new AkismetLib().getMessage())) {
throw new AssertionError();
} else {
System.out.println("Succeeded");
}
}
}