diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
index 2d50ee7..bacdbae 100644
--- a/.github/workflows/bld.yml
+++ b/.github/workflows/bld.yml
@@ -1,14 +1,16 @@
name: bld-ci
-on: [push, pull_request, workflow_dispatch]
+on: [ push, pull_request, workflow_dispatch ]
jobs:
build-bld-project:
- runs-on: ubuntu-latest
-
strategy:
matrix:
- java-version: [17, 21, 22]
+ 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 }}
steps:
- name: Checkout source repository
@@ -22,12 +24,16 @@ jobs:
distribution: "zulu"
java-version: ${{ matrix.java-version }}
- - name: Download dependencies
- run: ./bld download
-
- name: Download dependencies [examples]
working-directory: examples
run: ./bld download
+ - name: Run Detekt [examples]
+ working-directory: examples
+ run: ./bld compile test-ci
+
+ - name: Download dependencies
+ run: ./bld download
+
- name: Run tests
- run: ./bld compile test
+ run: ./bld compile test
\ No newline at end of file
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index e191f6d..88c2cd6 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -47,11 +47,11 @@ jobs:
uses: actions/configure-pages@v3
- name: Upload artifact
- uses: actions/upload-pages-artifact@v1
+ uses: actions/upload-pages-artifact@v3
with:
# Upload generated Javadocs repository
path: "build/javadoc/"
- name: Deploy to GitHub Pages
id: deployment
- uses: actions/deploy-pages@v1
+ uses: actions/deploy-pages@v4
diff --git a/.idea/icon.svg b/.idea/icon.svg
new file mode 100644
index 0000000..81220b4
--- /dev/null
+++ b/.idea/icon.svg
@@ -0,0 +1,13 @@
+
+
+
diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml
index 5c4010c..153a060 100644
--- a/.idea/libraries/bld.xml
+++ b/.idea/libraries/bld.xml
@@ -2,12 +2,12 @@
-
+
-
+
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 4c33beb..ba429d0 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -9,7 +9,7 @@
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-2.1.0.jar",
+ "${HOME}/.bld/dist/bld-2.2.1.jar",
"lib/**/*.jar"
]
}
diff --git a/README.md b/README.md
index e7170d4..cdcb0a0 100755
--- a/README.md
+++ b/README.md
@@ -3,12 +3,20 @@
[](https://opensource.org/licenses/Apache-2.0)
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
-[](https://rife2.com/bld)
+[](https://rife2.com/bld)
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-detekt)
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-detekt)
[](https://github.com/rife2/bld-detekt/actions/workflows/bld.yml)
-To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
+To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file:
+
+```properties
+bld.extension-detekt=com.uwyn.rife2:bld-detekt
+```
+
+For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation.
+
+## Check Source Code with Detekt
To check all Kotlin source code located in the project, add the following to your build file:
```java
diff --git a/config/pmd.xml b/config/pmd.xml
index 3d3203c..2641880 100644
--- a/config/pmd.xml
+++ b/config/pmd.xml
@@ -7,9 +7,9 @@
-
-
+
+
diff --git a/examples/.idea/bld.xml b/examples/.idea/bld.xml
new file mode 100644
index 0000000..6600cee
--- /dev/null
+++ b/examples/.idea/bld.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/.idea/libraries/bld.xml b/examples/.idea/libraries/bld.xml
index 5c4010c..153a060 100644
--- a/examples/.idea/libraries/bld.xml
+++ b/examples/.idea/libraries/bld.xml
@@ -2,12 +2,12 @@
-
+
-
+
diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json
index 4c33beb..ba429d0 100644
--- a/examples/.vscode/settings.json
+++ b/examples/.vscode/settings.json
@@ -9,7 +9,7 @@
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
- "${HOME}/.bld/dist/bld-2.1.0.jar",
+ "${HOME}/.bld/dist/bld-2.2.1.jar",
"lib/**/*.jar"
]
}
diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar
index e617d5b..20412e6 100644
Binary files a/examples/lib/bld/bld-wrapper.jar and b/examples/lib/bld/bld-wrapper.jar differ
diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties
index ef08e20..67eaf60 100644
--- a/examples/lib/bld/bld-wrapper.properties
+++ b/examples/lib/bld/bld-wrapper.properties
@@ -1,8 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.downloadLocation=
-bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.6
-bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.1
+bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT
+bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
-bld.version=2.1.0
+bld.version=2.2.1
diff --git a/examples/src/bld/java/com/example/ExampleBuild.java b/examples/src/bld/java/com/example/ExampleBuild.java
index 483f73f..9a9a49c 100644
--- a/examples/src/bld/java/com/example/ExampleBuild.java
+++ b/examples/src/bld/java/com/example/ExampleBuild.java
@@ -31,13 +31,14 @@ public class ExampleBuild extends Project {
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
- final var kotlin = version(2, 0, 20);
+ final var kotlin = version(2, 1, 20);
scope(compile)
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlin));
scope(test)
.include(dependency("org.jetbrains.kotlin", "kotlin-test-junit5", kotlin))
- .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
- .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)));
+ .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 the Kotlin source directory when creating or publishing sources Java Archives
jarSourcesOperation().sourceDirectories(new File(srcMainDirectory(), "kotlin"));
@@ -45,14 +46,14 @@ public class ExampleBuild extends Project {
public static void main(String[] args) {
// Enable detailed logging
-// 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);
+ 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 ExampleBuild().start(args);
}
@@ -100,4 +101,13 @@ public class ExampleBuild extends Project {
.input("src/test/kotlin")
.execute();
}
+
+ @BuildCommand(value = "test-ci", summary = "Run detek with a test baseline")
+ public void testCi() throws ExitStatusException, IOException, InterruptedException {
+ // Run detek with the test basline (for CI testing)
+ new DetektOperation()
+ .fromProject(this)
+ .baseline("src/test/resources/detekt-baseline.xml")
+ .execute();
+ }
}
diff --git a/examples/src/test/resources/detekt-baseline.xml b/examples/src/test/resources/detekt-baseline.xml
new file mode 100644
index 0000000..1bf5c16
--- /dev/null
+++ b/examples/src/test/resources/detekt-baseline.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ EmptyIfBlock:Example.kt$Example.Companion${ }
+ MagicNumber:Example.kt$Example$5
+ NewLineAtEndOfFile:ExampleTest.kt$com.example.ExampleTest.kt
+ ThrowingExceptionsWithoutMessageOrCause:Example.kt$Example.Companion$IllegalStateException()
+ UseCheckOrError:Example.kt$Example.Companion$throw IllegalStateException()
+ VariableNaming:Example.kt$Example$// https://detekt.dev/docs/rules/naming#variablenaming val Message: String get() = "Hello World!"
+
+
diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar
index a7f1aff..ab362ae 100644
Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
index 5d0bba4..c5da09f 100644
--- a/lib/bld/bld-wrapper.properties
+++ b/lib/bld/bld-wrapper.properties
@@ -1,8 +1,8 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.downloadLocation=
-bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.3
-bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.5
+bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.4
+bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.1
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories=
-bld.version=2.1.0
+bld.version=2.2.1
diff --git a/src/bld/java/rife/bld/extension/DetektOperationBuild.java b/src/bld/java/rife/bld/extension/DetektOperationBuild.java
index ba94b28..78f1a3e 100644
--- a/src/bld/java/rife/bld/extension/DetektOperationBuild.java
+++ b/src/bld/java/rife/bld/extension/DetektOperationBuild.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import rife.bld.publish.PublishLicense;
import rife.bld.publish.PublishScm;
import java.util.List;
+import java.util.Locale;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile;
@@ -33,20 +34,22 @@ public class DetektOperationBuild extends Project {
public DetektOperationBuild() {
pkg = "rife.bld.extension";
name = "DetektOperation";
- version = version(0, 9, 6);
+ version = version(0, 9, 10, "SNAPSHOT");
javaRelease = 17;
+
downloadSources = true;
autoDownloadPurge = true;
+
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
scope(compile)
- .include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0)))
- .include(dependency("io.gitlab.arturbosch.detekt", "detekt-cli", version(1, 23, 6)));
+ .include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1)))
+ .include(dependency("io.gitlab.arturbosch.detekt", "detekt-cli", version(1, 23, 8)));
scope(test)
- .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 0)))
- .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 0)))
- .include(dependency("org.assertj", "assertj-core", version(3, 26, 3)));
+ .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.assertj", "assertj-core", version(3, 27, 3)));
javadocOperation()
.javadocOptions()
.author()
@@ -56,28 +59,26 @@ public class DetektOperationBuild extends Project {
publishOperation()
.repository(version.isSnapshot() ? repository("rife2-snapshot") : repository("rife2"))
+ .repository(repository("github"))
.info()
.groupId("com.uwyn.rife2")
.artifactId("bld-detekt")
.description("bld Detekt Extension")
.url("https://github.com/rife2/bld-detekt")
- .developer(
- new PublishDeveloper()
- .id("ethauvin")
- .name("Erik C. Thauvin")
- .email("erik@thauvin.net")
- .url("https://erik.thauvin.net/")
+ .developer(new PublishDeveloper()
+ .id("ethauvin")
+ .name("Erik C. Thauvin")
+ .email("erik@thauvin.net")
+ .url("https://erik.thauvin.net/")
)
- .license(
- new PublishLicense()
- .name("The Apache License, Version 2.0")
- .url("https://www.apache.org/licenses/LICENSE-2.0.txt")
+ .license(new PublishLicense()
+ .name("The Apache License, Version 2.0")
+ .url("https://www.apache.org/licenses/LICENSE-2.0.txt")
)
- .scm(
- new PublishScm()
- .connection("scm:git:https://github.com/rife2/bld-detekt.git")
- .developerConnection("scm:git:git@github.com:rife2/bld-detekt.git")
- .url("https://github.com/rife2/bld-detekt")
+ .scm(new PublishScm()
+ .connection("scm:git:https://github.com/rife2/bld-detekt.git")
+ .developerConnection("scm:git:git@github.com:rife2/bld-detekt.git")
+ .url("https://github.com/rife2/bld-detekt")
)
.signKey(property("sign.key"))
.signPassphrase(property("sign.passphrase"));
@@ -97,10 +98,13 @@ public class DetektOperationBuild extends Project {
@Override
public void test() throws Exception {
- new ExecOperation()
- .fromProject(this)
- .command("scripts/cliargs.sh")
- .execute();
+ var os = System.getProperty("os.name");
+ if (os != null && os.toLowerCase(Locale.US).contains("linux")) {
+ new ExecOperation()
+ .fromProject(this)
+ .command("scripts/cliargs.sh")
+ .execute();
+ }
super.test();
}
diff --git a/src/main/java/rife/bld/extension/DetektOperation.java b/src/main/java/rife/bld/extension/DetektOperation.java
index ec3ebae..2bb17a1 100644
--- a/src/main/java/rife/bld/extension/DetektOperation.java
+++ b/src/main/java/rife/bld/extension/DetektOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,10 +48,10 @@ public class DetektOperation extends AbstractProcessOperation {
"kotlin-reflect-",
"kotlin-script-runtime-",
"kotlin-stdlib-",
- "kotlin-stdlib-jdk7-",
- "kotlin-stdlib-jdk8-",
+ "kotlinx-coroutines-",
"kotlinx-html-jvm-",
"kotlinx-serialization-",
+ "poko-annotations-jvm-",
"sarif4k-jvm-",
"snakeyaml-engine-",
"trove4j-");
@@ -324,7 +324,6 @@ public class DetektOperation extends AbstractProcessOperation {
return configStrings(List.of(configs));
}
-
/**
* Paths to the config files ({@code path/to/config.yml}).
*
@@ -702,7 +701,7 @@ public class DetektOperation extends AbstractProcessOperation {
}
}
}
- return String.join(":", jars);
+ return String.join(File.pathSeparator, jars);
}
/**
diff --git a/src/main/java/rife/bld/extension/detekt/Report.java b/src/main/java/rife/bld/extension/detekt/Report.java
index 32dcc60..ffa4a45 100644
--- a/src/main/java/rife/bld/extension/detekt/Report.java
+++ b/src/main/java/rife/bld/extension/detekt/Report.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/rife/bld/extension/detekt/ReportId.java b/src/main/java/rife/bld/extension/detekt/ReportId.java
index ef53bc9..c087243 100644
--- a/src/main/java/rife/bld/extension/detekt/ReportId.java
+++ b/src/main/java/rife/bld/extension/detekt/ReportId.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/rife/bld/extension/DetektOperationTest.java b/src/test/java/rife/bld/extension/DetektOperationTest.java
index 3a9ec3f..04db107 100644
--- a/src/test/java/rife/bld/extension/DetektOperationTest.java
+++ b/src/test/java/rife/bld/extension/DetektOperationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023-2024 the original author or authors.
+ * Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,11 @@
package rife.bld.extension;
+import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnOs;
+import org.junit.jupiter.api.condition.OS;
import rife.bld.BaseProject;
import rife.bld.blueprints.BaseProjectBlueprint;
import rife.bld.extension.detekt.Report;
@@ -91,6 +94,7 @@ class DetektOperationTest {
}
@Test
+ @EnabledOnOs(OS.LINUX)
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
void testCheckAllParameters() throws IOException {
var args = Files.readAllLines(Paths.get("src", "test", "resources", "detekt-args.txt"));
@@ -147,15 +151,17 @@ class DetektOperationTest {
var params = op.executeConstructProcessCommandList();
- for (var p : args) {
- var found = false;
- for (var a : params) {
- if (a.startsWith(p)) {
- found = true;
- break;
+ try (var softly = new AutoCloseableSoftAssertions()) {
+ for (var p : args) {
+ var found = false;
+ for (var a : params) {
+ if (a.startsWith(p)) {
+ found = true;
+ break;
+ }
}
+ softly.assertThat(found).as(p + " not found.").isTrue();
}
- assertThat(found).as(p + " not found.").isTrue();
}
}
@@ -238,11 +244,11 @@ class DetektOperationTest {
void testExampleBaseline() throws IOException, ExitStatusException, InterruptedException {
var tmpDir = Files.createTempDirectory("bld-detekt-").toFile();
- var baseline = new File(tmpDir, "detekt-baseline.xml");
+ var baseline = new File(tmpDir, "examples/src/test/resources/detekt-baseline.xml");
var op = new DetektOperation()
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",
- "Example"))
+ "example", "Example"))
.baseline(baseline)
.createBaseline(true);
op.execute();
@@ -257,7 +263,7 @@ class DetektOperationTest {
void testExampleMaxIssues() {
var op = new DetektOperation()
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",
- "Example"))
+ "example", "Example"))
.maxIssues(8);
assertThatNoException().isThrownBy(op::execute);
}
@@ -274,7 +280,7 @@ class DetektOperationTest {
var op = new DetektOperation()
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",
- "Example"))
+ "example", "Example"))
.report(new Report(ReportId.HTML, html.getAbsolutePath()))
.report(new Report(ReportId.XML, xml.getAbsolutePath()))
.report(new Report(ReportId.TXT, txt.getAbsolutePath()))
@@ -292,7 +298,7 @@ class DetektOperationTest {
void testExamplesExecute() {
var op = new DetektOperation()
.fromProject(new BaseProjectBlueprint(new File("examples"), "com.example",
- "Example"))
+ "example", "Example"))
.debug(true);
assertThatThrownBy(op::execute).isInstanceOf(ExitStatusException.class);
}