Compare commits

..

No commits in common. "7720a93d0ab8c63a1b1bff335ac4e955671fa904" and "f823e5a0fedfcff3108a6e6bac368f66fe10523b" have entirely different histories.

17 changed files with 99 additions and 105 deletions

11
.idea/kotlinc.xml generated
View file

@ -1,18 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="Kotlin2JvmCompilerArguments">
<option name="jvmTarget" value="1.8" />
</component>
<component name="KotlinCommonCompilerArguments"> <component name="KotlinCommonCompilerArguments">
<option name="apiVersion" value="1.9" />
<option name="languageVersion" value="1.9" />
<option name="pluginClasspaths"> <option name="pluginClasspaths">
<array> <array>
<option value="$KOTLIN_BUNDLED$/lib/kotlin-serialization-compiler-plugin.jar" /> <option value="$KOTLIN_BUNDLED$/lib/kotlinx-serialization-compiler-plugin.jar" />
</array> </array>
</option> </option>
</component> </component>
<component name="KotlinJpsPluginSettings"> <component name="Kotlin2JvmCompilerArguments">
<option name="version" value="2.0.0" /> <option name="jvmTarget" value="1.8" />
</component> </component>
</project> </project>

View file

@ -2,12 +2,12 @@
<library name="bld"> <library name="bld">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.0-SNAPSHOT.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.9.1.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.0-SNAPSHOT-sources.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-1.9.1-sources.jar!/" />
</SOURCES> </SOURCES>
<excluded> <excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" /> <root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.example.ExampleTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

Binary file not shown.

View file

@ -1,8 +1,7 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.8
bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.0-SNAPSHOT
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories= bld.sourceDirectories=
bld.version=1.9.1 bld.version=1.9.1

View file

@ -25,7 +25,7 @@ public class ExampleBuild extends BaseProject {
scope(compile) scope(compile)
.include(dependency("net.thauvin.erik:akismet-kotlin:1.1.0-SNAPSHOT")) .include(dependency("net.thauvin.erik:akismet-kotlin:1.1.0-SNAPSHOT"))
.include(dependency("jakarta.servlet:jakarta.servlet-api:6.1.0")); .include(dependency("jakarta.servlet:jakarta.servlet-api:6.0.0"));
} }
public static void main(String[] args) { public static void main(String[] args) {

View file

@ -5,6 +5,7 @@
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View file

@ -12,7 +12,7 @@ repositories {
} }
dependencies { dependencies {
implementation("jakarta.servlet:jakarta.servlet-api:6.1.0") implementation("jakarta.servlet:jakarta.servlet-api:6.0.0")
implementation("net.thauvin.erik:akismet-kotlin:1.1.0-SNAPSHOT") implementation("net.thauvin.erik:akismet-kotlin:1.1.0-SNAPSHOT")
} }

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -86,8 +84,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View file

@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################

Binary file not shown.

View file

@ -1,11 +1,10 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5
bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.4 bld.extensions-kotlin=com.uwyn.rife2:bld-kotlin:0.9.8
#bld.extension-dokka=com.uwyn.rife2:bld-dokka:1.0.0-SNAPSHOT bld.extensions-detekt=com.uwyn.rife2:bld-detekt:0.9.4
bld.extension-gv=com.uwyn.rife2:bld-generated-version:0.9.8-SNAPSHOT bld.extensions=com.uwyn.rife2:bld-generated-version:0.9.6
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.6
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.0.0-SNAPSHOT bld.version=1.9.1

View file

@ -33,11 +33,11 @@ package net.thauvin.erik;
import rife.bld.BuildCommand; import rife.bld.BuildCommand;
import rife.bld.Project; import rife.bld.Project;
import rife.bld.extension.CompileKotlinOperation; import rife.bld.extension.*;
import rife.bld.extension.DetektOperation; import rife.bld.extension.dokka.DokkaOperation;
import rife.bld.extension.GeneratedVersionOperation; import rife.bld.extension.dokka.LoggingLevel;
import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.dokka.OutputFormat;
import rife.bld.extension.kotlin.CompilerPlugin; import rife.bld.extension.dokka.SourceSet;
import rife.bld.operations.exceptions.ExitStatusException; import rife.bld.operations.exceptions.ExitStatusException;
import rife.bld.publish.PomBuilder; import rife.bld.publish.PomBuilder;
import rife.bld.publish.PublishDeveloper; import rife.bld.publish.PublishDeveloper;
@ -48,9 +48,6 @@ import rife.tools.exceptions.FileUtilsErrorException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.List; 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.Repository.*;
import static rife.bld.dependencies.Scope.*; import static rife.bld.dependencies.Scope.*;
@ -65,27 +62,25 @@ public class AkismetBuild extends Project {
version = version(1, 1, 0, "SNAPSHOT"); version = version(1, 1, 0, "SNAPSHOT");
javaRelease = 11; javaRelease = 11;
downloadSources = true; downloadSources = true;
autoDownloadPurge = true; autoDownloadPurge = true;
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
var okHttp = version(4, 12, 0); var okHttp = version(4, 12, 0);
final var kotlin = version(2, 0, 0); final var kotlin = version(1, 9, 24);
scope(compile) scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk7", kotlin))
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", kotlin))
.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("org.jetbrains.kotlinx", "kotlinx-serialization-json", version(1, 7, 1))); .include(dependency("org.jetbrains.kotlinx", "kotlinx-serialization-json-jvm", version(1, 6, 3)));
scope(provided) scope(provided)
.include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 1, 0))); .include(dependency("jakarta.servlet", "jakarta.servlet-api", version(6, 0, 0)))
.include(dependency("org.jetbrains.kotlin", "kotlin-serialization-compiler-plugin", kotlin));
scope(test) scope(test)
.include(dependency("org.mockito", "mockito-core", version(5, 12, 0))) .include(dependency("org.mockito", "mockito-core", version(5, 12, 0)))
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin)) .include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 3))) .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 3))) .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 2)))
.include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1))); .include(dependency("com.willowtreeapps.assertk", "assertk-jvm", version(0, 28, 1)));
publishOperation() publishOperation()
@ -124,27 +119,26 @@ public class AkismetBuild extends Project {
public static void main(String[] args) { public static void main(String[] args) {
// Enable detailed logging for the Kotlin extension // Enable detailed logging for the Kotlin extension
var level = Level.ALL; // var level = Level.ALL;
var logger = Logger.getLogger("rife.bld.extension"); // var logger = Logger.getLogger("rife.bld.extension");
var consoleHandler = new ConsoleHandler(); // var consoleHandler = new ConsoleHandler();
consoleHandler.setLevel(level); // consoleHandler.setLevel(level);
logger.addHandler(consoleHandler); // logger.addHandler(consoleHandler);
logger.setLevel(level); // logger.setLevel(level);
logger.setUseParentHandlers(false); // logger.setUseParentHandlers(false);
new AkismetBuild().start(args); new AkismetBuild().start(args);
} }
@BuildCommand(summary = "Compiles the Kotlin project") @BuildCommand(summary = "Compiles the Kotlin project")
@Override @Override
public void compile() throws Exception { public void compile() throws IOException {
genver(); genver();
var op = new CompileKotlinOperation() new CompileKotlinOperation()
.fromProject(this) .fromProject(this)
.plugins(CompilerPlugin.KOTLIN_SERIALIZATION); .plugins(libProvidedDirectory(), CompileKotlinPlugin.KOTLIN_SERIALIZATION)
op.compileOptions().verbose(true); .execute();
op.execute();
} }
@BuildCommand(summary = "Checks source with Detekt") @BuildCommand(summary = "Checks source with Detekt")
@ -164,69 +158,63 @@ public class AkismetBuild extends Project {
.execute(); .execute();
} }
// @BuildCommand(summary = "Generates documentation in HTML format") @BuildCommand(summary = "Generates documentation in HTML format")
// public void docs() throws ExitStatusException, IOException, InterruptedException { public void docs() throws ExitStatusException, IOException, InterruptedException {
// new DokkaOperation() new DokkaOperation()
// .fromProject(this) .fromProject(this)
// .loggingLevel(LoggingLevel.INFO) .loggingLevel(LoggingLevel.INFO)
// .moduleName("Akismet Kotlin") .moduleName("Akismet Kotlin")
// .moduleVersion(version.toString()) .moduleVersion(version.toString())
// .outputDir("docs") .outputDir("docs")
// .outputFormat(OutputFormat.HTML) .outputFormat(OutputFormat.HTML)
// .sourceSet( .sourceSet(
// new SourceSet() new SourceSet()
// .src(srcMainKotlin) .src(srcMainKotlin.getAbsolutePath())
// .classpath(compileClasspathJars()) .classpath(compileClasspathJars())
// .classpath(providedClasspathJars()) .classpath(providedClasspathJars())
// .srcLink(srcMainKotlin, "https://github.com/ethauvin/" + name .srcLink(srcMainKotlin.getAbsolutePath(), "https://github.com/ethauvin/" + name
// + "/tree/master/src/main/kotlin/", "#L") + "/tree/master/src/main/kotlin/", "#L")
// .includes("config/dokka/packages.md") .includes("config/dokka/packages.md")
// .jdkVersion(javaRelease) .jdkVersion(javaRelease)
// .externalDocumentationLinks("https://jakarta.ee/specifications/platform/9/apidocs/", .externalDocumentationLinks("https://jakarta.ee/specifications/platform/9/apidocs/",
// "https://jakarta.ee/specifications/platform/9/apidocs/package-list") "https://jakarta.ee/specifications/platform/9/apidocs/package-list")
//
// ) )
// .execute(); .execute();
// } }
@BuildCommand(summary = "Generates version class") @BuildCommand(summary = "Generates version class")
public void genver() throws Exception { public void genver() {
new GeneratedVersionOperation() new GeneratedVersionOperation()
.fromProject(this) .fromProject(this)
.projectName("Akismet Kotlin") .projectName("Akismet Kotlin")
.packageName(pkg + ".akismet") .packageName(pkg + ".akismet")
.classTemplate("version.txt") .classTemplate(new File(workDirectory(), "version.txt"))
.directory(srcMainKotlin) .directory(srcMainKotlin)
.extension(".kt") .extension(".kt")
.execute(); .execute();
} }
@BuildCommand(summary = "Generates JaCoCo Reports") @BuildCommand(summary = "Generates JaCoCo Reports")
public void jacoco() throws Exception { public void jacoco() throws IOException {
new JacocoReportOperation() new JacocoReportOperation()
.fromProject(this) .fromProject(this)
.sourceFiles(srcMainKotlin) .sourceFiles(srcMainKotlin)
.execute(); .execute();
} }
// @Override @Override
// public void javadoc() throws ExitStatusException, IOException, InterruptedException { public void javadoc() throws ExitStatusException, IOException, InterruptedException {
// new DokkaOperation() new DokkaOperation()
// .fromProject(this) .fromProject(this)
// .loggingLevel(LoggingLevel.INFO) .loggingLevel(LoggingLevel.INFO)
// .moduleName("Bitly Shorten") .moduleName("Bitly Shorten")
// .moduleVersion(version.toString()) .moduleVersion(version.toString())
// .outputDir(new File(buildDirectory(), "javadoc")) .outputDir(new File(buildDirectory(), "javadoc"))
// .outputFormat(OutputFormat.JAVADOC) .outputFormat(OutputFormat.JAVADOC)
// .globalLinks("https://jakarta.ee/specifications/platform/9/apidocs/", .globalLinks("https://jakarta.ee/specifications/platform/9/apidocs/",
// "https://jakarta.ee/specifications/platform/9/apidocs/package-list") "https://jakarta.ee/specifications/platform/9/apidocs/package-list")
// .execute(); .execute();
// }
@BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
public void pomRoot() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),
new File(workDirectory, "pom.xml"));
} }
@Override @Override
@ -234,4 +222,10 @@ public class AkismetBuild extends Project {
super.publish(); super.publish();
pomRoot(); pomRoot();
} }
@BuildCommand(value = "pom-root", summary = "Generates the POM file in the root directory")
public void pomRoot() throws FileUtilsErrorException {
PomBuilder.generateInto(publishOperation().fromProject(this).info(), dependencies(),
new File(workDirectory, "pom.xml"));
}
} }

View file

@ -61,7 +61,7 @@ open class Akismet(apiKey: String) {
*/ */
@JvmStatic @JvmStatic
fun jsonComment(json: String): AkismetComment { fun jsonComment(json: String): AkismetComment {
return Json.decodeFromString<AkismetComment>(json) return Json.decodeFromString(AkismetComment.serializer(), json)
} }
/** /**

View file

@ -31,6 +31,8 @@
package net.thauvin.erik.akismet package net.thauvin.erik.akismet
import net.thauvin.erik.akismet.AkismetComment.Companion.ADMIN_ROLE
/** /**
* Provides a comment configuration. * Provides a comment configuration.
*/ */
@ -167,7 +169,7 @@ class CommentConfig private constructor(builder: Builder) {
/** /**
* Set the user role of the user who submitted the comment. This is an optional parameter. * Set the user role of the user who submitted the comment. This is an optional parameter.
* *
* If you set it to [AkismetComment.ADMIN_ROLE], Akismet will always return `false`. * If you set it to [ADMIN_ROLE], Akismet will always return `false`.
*/ */
fun userRole(userRole: String): Builder = apply { this.userRole = userRole } fun userRole(userRole: String): Builder = apply { this.userRole = userRole }