From 91a113ed5afaeebc6cda6b54d4af8ebf719d4d82 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 11:53:56 -0700 Subject: [PATCH 1/7] Fix non system specific path separator --- src/main/java/rife/bld/extension/CheckstyleOperation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/rife/bld/extension/CheckstyleOperation.java b/src/main/java/rife/bld/extension/CheckstyleOperation.java index d9b7b52..ed8a610 100644 --- a/src/main/java/rife/bld/extension/CheckstyleOperation.java +++ b/src/main/java/rife/bld/extension/CheckstyleOperation.java @@ -235,9 +235,9 @@ public class CheckstyleOperation extends AbstractProcessOperation { From 4e373bfd1019ea2d26a1556a1626d4770fd28ea6 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 11:55:53 -0700 Subject: [PATCH 2/7] Fix exclude and excludeRegex arguments --- .../rife/bld/extension/CheckstyleOperation.java | 6 ++++-- .../bld/extension/CheckstyleOperationTest.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/rife/bld/extension/CheckstyleOperation.java b/src/main/java/rife/bld/extension/CheckstyleOperation.java index ed8a610..97eeb55 100644 --- a/src/main/java/rife/bld/extension/CheckstyleOperation.java +++ b/src/main/java/rife/bld/extension/CheckstyleOperation.java @@ -250,7 +250,8 @@ public class CheckstyleOperation extends AbstractProcessOperation Date: Tue, 25 Mar 2025 11:58:26 -0700 Subject: [PATCH 3/7] Only check checkstyle arguments on Linux --- .../rife/bld/extension/CheckstyleOperationBuild.java | 12 ++++++++---- .../rife/bld/extension/CheckstyleOperationTest.java | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java index c7cf95c..90f78c6 100644 --- a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java +++ b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java @@ -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; @@ -99,10 +100,13 @@ public class CheckstyleOperationBuild 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/test/java/rife/bld/extension/CheckstyleOperationTest.java b/src/test/java/rife/bld/extension/CheckstyleOperationTest.java index 5c3f299..0d0e1b2 100644 --- a/src/test/java/rife/bld/extension/CheckstyleOperationTest.java +++ b/src/test/java/rife/bld/extension/CheckstyleOperationTest.java @@ -19,6 +19,8 @@ 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.Project; import rife.bld.WebProject; @@ -65,6 +67,7 @@ class CheckstyleOperationTest { } @Test + @EnabledOnOs(OS.LINUX) void checkAllParameters() throws IOException { var args = Files.readAllLines(Paths.get("src", "test", "resources", "checkstyle-args.txt")); From 610a042cedcf0a38b540b88ca60d3b720d0833f9 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 12:02:45 -0700 Subject: [PATCH 4/7] Bump Checkstyle extension to version 1.0.14-SNAPSHOT --- examples/lib/bld/bld-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties index 715835e..84fb734 100644 --- a/examples/lib/bld/bld-wrapper.properties +++ b/examples/lib/bld/bld-wrapper.properties @@ -1,7 +1,7 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= -bld.extension-checkstyle=com.uwyn.rife2:bld-checkstyle:1.0.13 +bld.extension-checkstyle=com.uwyn.rife2:bld-checkstyle:1.0.14-SNAPSHOT bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.sourceDirectories= bld.version=2.2.1 From f55e0102861da70fd6f1c0bbaefa7c0866c35697 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 12:03:37 -0700 Subject: [PATCH 5/7] Enable extensions logging --- .../src/bld/java/com/example/ExamplesBuild.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java index ea28912..ff88789 100644 --- a/examples/src/bld/java/com/example/ExamplesBuild.java +++ b/examples/src/bld/java/com/example/ExamplesBuild.java @@ -5,6 +5,9 @@ import rife.bld.BuildCommand; import rife.bld.extension.CheckstyleOperation; 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.MAVEN_CENTRAL; import static rife.bld.dependencies.Scope.*; @@ -29,6 +32,16 @@ public class ExamplesBuild extends BaseProject { } 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 ExamplesBuild().start(args); } From e8c901c6c18db603da4fe2731916c219dc6bfd7b Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 12:04:04 -0700 Subject: [PATCH 6/7] Add checkstyle-custom command --- examples/src/bld/java/com/example/ExamplesBuild.java | 9 ++++++++- examples/src/test/resources/checkstyle.xml | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 examples/src/test/resources/checkstyle.xml diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java index ff88789..d49b966 100644 --- a/examples/src/bld/java/com/example/ExamplesBuild.java +++ b/examples/src/bld/java/com/example/ExamplesBuild.java @@ -45,7 +45,7 @@ public class ExamplesBuild extends BaseProject { new ExamplesBuild().start(args); } - @BuildCommand(summary = "Check code style") + @BuildCommand(summary = "Check code style using Sun coding conventions") public void checkstyle() throws Exception { new CheckstyleOperation() .fromProject(this) @@ -53,4 +53,11 @@ public class ExamplesBuild extends BaseProject { .execute(); } + @BuildCommand(value = "checkstyle-custom", summary = "Check code style using custom coding conventions") + public void checkstyleCustom() throws Exception { + new CheckstyleOperation() + .fromProject(this) + .configurationFile("src/test/resources/checkstyle.xml") + .execute(); + } } diff --git a/examples/src/test/resources/checkstyle.xml b/examples/src/test/resources/checkstyle.xml new file mode 100644 index 0000000..e601ecb --- /dev/null +++ b/examples/src/test/resources/checkstyle.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file From c9585f3a5ce10135c230b6e54f1e0fa663217817 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Tue, 25 Mar 2025 12:04:32 -0700 Subject: [PATCH 7/7] Add OS matrix for Ubuntu, Windows and macOS --- .github/workflows/bld.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml index 138f5e5..6966bcb 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, 24] + 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,8 +24,16 @@ jobs: distribution: "zulu" java-version: ${{ matrix.java-version }} + - name: Download dependencies [examples] + working-directory: examples + run: ./bld download + + - name: Compile and Run Checkstyle [examples] + working-directory: examples + run: ./bld compile checkstyle-custom + - name: Download dependencies run: ./bld download - name: Run tests - run: ./bld compile test + run: ./bld compile test \ No newline at end of file