From bddd116090fda190794f57912e690d96671199f8 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sat, 25 Nov 2023 21:23:05 -0800 Subject: [PATCH] Added detekt extension --- detekt-baseline.xml | 8 +++++++ lib/bld/bld-wrapper.properties | 1 + pom.xml | 18 +++++++++++++++ .../java/net/thauvin/erik/JokeApiBuild.java | 23 ++++++++++++++++++- 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/detekt-baseline.xml b/detekt-baseline.xml index a53ce7c..50acbf1 100644 --- a/detekt-baseline.xml +++ b/detekt-baseline.xml @@ -18,6 +18,14 @@ MagicNumber:JokeUtil.kt$500 MagicNumber:JokeUtil.kt$523 TooManyFunctions:JokeConfig.kt$JokeConfig$Builder + WildcardImport:ExceptionsTest.kt$import assertk.assertions.* + WildcardImport:GetJokeTest.kt$import assertk.assertions.* + WildcardImport:GetJokeTest.kt$import net.thauvin.erik.jokeapi.models.* + WildcardImport:GetJokesTest.kt$import assertk.assertions.* WildcardImport:JokeApi.kt$import net.thauvin.erik.jokeapi.models.* + WildcardImport:JokeConfig.kt$import net.thauvin.erik.jokeapi.models.* + WildcardImport:JokeConfigTest.kt$import assertk.assertions.* + WildcardImport:JokeConfigTest.kt$import net.thauvin.erik.jokeapi.models.* + WildcardImport:JokeUtil.kt$import net.thauvin.erik.jokeapi.models.* diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 32712c6..d2d7adf 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -2,6 +2,7 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.1 bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT +bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.0-SNAPSHOT bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= bld.sourceDirectories= diff --git a/pom.xml b/pom.xml index ed4ed5d..1930c31 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,24 @@ 1.9.21 compile + + org.jetbrains.kotlin + kotlin-stdlib-common + 1.9.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk7 + 1.9.21 + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + 1.9.21 + compile + org.json json diff --git a/src/bld/java/net/thauvin/erik/JokeApiBuild.java b/src/bld/java/net/thauvin/erik/JokeApiBuild.java index 5469163..c507607 100644 --- a/src/bld/java/net/thauvin/erik/JokeApiBuild.java +++ b/src/bld/java/net/thauvin/erik/JokeApiBuild.java @@ -34,6 +34,7 @@ package net.thauvin.erik; import rife.bld.BuildCommand; import rife.bld.Project; import rife.bld.extension.CompileKotlinOperation; +import rife.bld.extension.DetektOperation; import rife.bld.extension.JacocoReportOperation; import rife.bld.extension.dokka.DokkaOperation; import rife.bld.extension.dokka.LoggingLevel; @@ -64,8 +65,12 @@ public class JokeApiBuild extends Project { autoDownloadPurge = true; repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL); + final var kotlin = version(1, 9, 21); scope(compile) - .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 21))) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-common", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk7", kotlin)) + .include(dependency("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", kotlin)) .include(dependency("org.json", "json", "20231013")) .include(dependency("net.thauvin.erik.urlencoder", "urlencoder-lib-jvm", version(1, 4, 0))); scope(test) @@ -120,6 +125,22 @@ public class JokeApiBuild extends Project { .execute(); } + @BuildCommand(summary = "Checks source with Detekt") + public void detekt() throws ExitStatusException, IOException, InterruptedException { + new DetektOperation() + .fromProject(this) + .execute(); + } + + @BuildCommand(value = "detekt-baseline", summary = "Creates the Detekt baseline") + public void detektBaseline() throws ExitStatusException, IOException, InterruptedException { + new DetektOperation() + .fromProject(this) + .baseline("detekt-baseline.xml") + .createBaseline(true) + .execute(); + } + @BuildCommand(summary = "Generates JaCoCo Reports") public void jacoco() throws IOException { new JacocoReportOperation()