diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index e69de29..f6122cd 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -0,0 +1,57 @@ +name: javadocs-pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + + steps: + - name: Checkout source repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 17 + + - name: Build Javadocs + run: ./bld download clean javadoc + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload generated Javadocs repository + path: 'build/javadoc/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file diff --git a/.idea/copyright/Apache_License.xml b/.idea/copyright/Apache_License.xml index 15687f4..ade80da 100644 --- a/.idea/copyright/Apache_License.xml +++ b/.idea/copyright/Apache_License.xml @@ -1,6 +1,6 @@ - - \ No newline at end of file + diff --git a/.idea/intellij-javadocs-4.0.1.xml b/.idea/intellij-javadocs-4.0.1.xml new file mode 100644 index 0000000..90d3347 --- /dev/null +++ b/.idea/intellij-javadocs-4.0.1.xml @@ -0,0 +1,204 @@ + + + + + UPDATE + false + true + + FIELD + METHOD + TYPE + + + PUBLIC + PROTECTED + DEFAULT + + + + + + ^.*(public|protected|private)*.+interface\s+\w+.* + /**\n + * The interface ${name}.\n +<#if element.typeParameters?has_content> * \n +</#if> +<#list element.typeParameters as typeParameter> + * @param <${typeParameter.name}> the type parameter\n +</#list> + */ + + + ^.*(public|protected|private)*.+enum\s+\w+.* + /**\n + * The enum ${name}.\n + */ + + + ^.*(public|protected|private)*.+class\s+\w+.* + /**\n + * The type ${name}.\n +<#if element.typeParameters?has_content> * \n +</#if> +<#list element.typeParameters as typeParameter> + * @param <${typeParameter.name}> the type parameter\n +</#list> + */ + + + .+ + /**\n + * The type ${name}.\n + */ + + + + + .+ + /**\n + * Instantiates a new ${name}.\n +<#if element.parameterList.parameters?has_content> + *\n +</#if> +<#list element.parameterList.parameters as parameter> + * @param ${parameter.name} the ${paramNames[parameter.name]}\n +</#list> +<#if element.throwsList.referenceElements?has_content> + *\n +</#if> +<#list element.throwsList.referenceElements as exception> + * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n +</#list> + */ + + + + + ^.*(public|protected|private)*\s*.*(\w(\s*<.+>)*)+\s+get\w+\s*\(.*\).+ + /**\n + * Gets ${partName}.\n +<#if element.typeParameters?has_content> * \n +</#if> +<#list element.typeParameters as typeParameter> + * @param <${typeParameter.name}> the type parameter\n +</#list> +<#if element.parameterList.parameters?has_content> + *\n +</#if> +<#list element.parameterList.parameters as parameter> + * @param ${parameter.name} the ${paramNames[parameter.name]}\n +</#list> +<#if isNotVoid> + *\n + * @return the ${partName}\n +</#if> +<#if element.throwsList.referenceElements?has_content> + *\n +</#if> +<#list element.throwsList.referenceElements as exception> + * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n +</#list> + */ + + + ^.*(public|protected|private)*\s*.*(void|\w(\s*<.+>)*)+\s+set\w+\s*\(.*\).+ + /**\n + * Sets ${partName}.\n +<#if element.typeParameters?has_content> * \n +</#if> +<#list element.typeParameters as typeParameter> + * @param <${typeParameter.name}> the type parameter\n +</#list> +<#if element.parameterList.parameters?has_content> + *\n +</#if> +<#list element.parameterList.parameters as parameter> + * @param ${parameter.name} the ${paramNames[parameter.name]}\n +</#list> +<#if isNotVoid> + *\n + * @return the ${partName}\n +</#if> +<#if element.throwsList.referenceElements?has_content> + *\n +</#if> +<#list element.throwsList.referenceElements as exception> + * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n +</#list> + */ + + + ^.*((public\s+static)|(static\s+public))\s+void\s+main\s*\(\s*String\s*(\[\s*\]|\.\.\.)\s+\w+\s*\).+ + /**\n + * The entry point of application.\n + + <#if element.parameterList.parameters?has_content> + *\n +</#if> + * @param ${element.parameterList.parameters[0].name} the input arguments\n +<#if element.throwsList.referenceElements?has_content> + *\n +</#if> +<#list element.throwsList.referenceElements as exception> + * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n +</#list> + */ + + + .+ + /**\n + * ${name}<#if isNotVoid> ${return}</#if>.\n +<#if element.typeParameters?has_content> * \n +</#if> +<#list element.typeParameters as typeParameter> + * @param <${typeParameter.name}> the type parameter\n +</#list> +<#if element.parameterList.parameters?has_content> + *\n +</#if> +<#list element.parameterList.parameters as parameter> + * @param ${parameter.name} the ${paramNames[parameter.name]}\n +</#list> +<#if isNotVoid> + *\n + * @return the ${return}\n +</#if> +<#if element.throwsList.referenceElements?has_content> + *\n +</#if> +<#list element.throwsList.referenceElements as exception> + * @throws ${exception.referenceName} the ${exceptionNames[exception.referenceName]}\n +</#list> + */ + + + + + ^.*(public|protected|private)*.+static.*(\w\s\w)+.+ + /**\n + * The constant ${element.getName()}.\n + */ + + + ^.*(public|protected|private)*.*(\w\s\w)+.+ + /**\n + <#if element.parent.isInterface()> + * The constant ${element.getName()}.\n +<#else> + * The ${name}.\n +</#if> */ + + + .+ + /**\n + <#if element.parent.isEnum()> + *${name} ${typeName}.\n +<#else> + * The ${name}.\n +</#if>*/ + + + + + \ No newline at end of file diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index cf75013..bff4f62 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,11 +2,12 @@ - + - + + @@ -14,4 +15,4 @@ - \ No newline at end of file + diff --git a/.idea/misc.xml b/.idea/misc.xml index f03c702..1bf9192 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -8,6 +9,18 @@ \ No newline at end of file + diff --git a/examples/.idea/misc.xml b/examples/.idea/misc.xml index 7e477ca..97c1009 100644 --- a/examples/.idea/misc.xml +++ b/examples/.idea/misc.xml @@ -1,4 +1,3 @@ - + \ No newline at end of file diff --git a/examples/.vscode/settings.json b/examples/.vscode/settings.json index 133aa45..5633e79 100644 --- a/examples/.vscode/settings.json +++ b/examples/.vscode/settings.json @@ -7,7 +7,7 @@ ], "java.configuration.updateBuildConfiguration": "automatic", "java.project.referencedLibraries": [ - "${HOME}/.bld/dist/bld-1.7.5.jar", + "${HOME}/.bld/dist/bld-1.8.0.jar", "lib/compile/*.jar", "lib/runtime/*.jar", "lib/test/*.jar" diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..8fcbd04 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,6 @@ +# Compile and Run Checkstyle + +```console +./bld compile checkstyle +``` + diff --git a/examples/lib/bld/bld-wrapper.jar b/examples/lib/bld/bld-wrapper.jar index e9d9403..48bd8ab 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 8ac95b9..d219adc 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.extensions=com.uwyn.rife2:bld-checkstyle:0.9.0-SNAPSHOT -bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES +bld.extensions=com.uwyn.rife2:bld-checkstyle:0.9.1 +bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= bld.sourceDirectories= -bld.version=1.7.5 +bld.version=1.8.0 diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java index daf4979..a76d307 100644 --- a/examples/src/bld/java/com/example/ExamplesBuild.java +++ b/examples/src/bld/java/com/example/ExamplesBuild.java @@ -19,7 +19,7 @@ public class ExamplesBuild extends BaseProject { downloadSources = true; repositories = List.of(MAVEN_CENTRAL); - scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4))); + scope(test).include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0))); testOperation().mainClass("com.example.ExamplesTest"); } @@ -36,4 +36,4 @@ public class ExamplesBuild extends BaseProject { .execute(); } -} \ No newline at end of file +} diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index e9d9403..48bd8ab 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 f8b51d9..3cb1d83 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,8 +1,8 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true -bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.2 -bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.0 -bld.repositories=MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES +bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.5 +bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.2 +bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.downloadLocation= bld.sourceDirectories= -bld.version=1.7.5 +bld.version=1.8.0 diff --git a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java index 69d586b..74c233e 100644 --- a/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java +++ b/src/bld/java/rife/bld/extension/CheckstyleOperationBuild.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 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. @@ -27,14 +27,15 @@ import java.util.List; import static rife.bld.dependencies.Repository.MAVEN_CENTRAL; import static rife.bld.dependencies.Repository.RIFE2_RELEASES; -import static rife.bld.dependencies.Scope.*; +import static rife.bld.dependencies.Scope.compile; +import static rife.bld.dependencies.Scope.test; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; public class CheckstyleOperationBuild extends Project { public CheckstyleOperationBuild() { pkg = "rife.bld.extension"; name = "CheckstyleOperation"; - version = version(0, 9, 0, "SNAPSHOT"); + version = version(0, 9, 1); javaRelease = 17; downloadSources = true; @@ -42,15 +43,15 @@ public class CheckstyleOperationBuild extends Project { repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(compile) - .include(dependency("com.uwyn.rife2", "bld", version(1, 7, 5))); + .include(dependency("com.uwyn.rife2", "bld", version(1, 8, 0))); scope(test) - .include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 12, 4))) - .include(dependency("org.jsoup", "jsoup", version(1, 16, 2))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 0))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 0))) - .include(dependency("org.assertj", "assertj-core", version(3, 24, 2))); + .include(dependency("com.puppycrawl.tools", "checkstyle", version(10, 13, 0))) + .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.assertj", "assertj-core", version(3, 25, 2))); javadocOperation() .javadocOptions() + .author() .docLint(NO_MISSING) .link("https://rife2.github.io/bld/") .link("https://rife2.github.io/rife2/"); @@ -60,15 +61,26 @@ public class CheckstyleOperationBuild extends Project { .info() .groupId("com.uwyn.rife2") .artifactId("bld-checkstyle") - .description("bld Checkstyle Extensions") + .description("bld Checkstyle Extension") .url("https://github.com/rife2/bld-checkstyle") - .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("http://www.apache.org/licenses/LICENSE-2.0.txt")) - .scm(new PublishScm().connection("scm:git:https://github.com/rife2/bld-checkstyle.git") - .developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git") - .url("https://github.com/rife2/bld-checkstyle")) + .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("http://www.apache.org/licenses/LICENSE-2.0.txt") + ) + .scm( + new PublishScm() + .connection("scm:git:https://github.com/rife2/bld-checkstyle.git") + .developerConnection("scm:git:git@github.com:rife2/bld-checkstyle.git") + .url("https://github.com/rife2/bld-checkstyle") + ) .signKey(property("sign.key")) .signPassphrase(property("sign.passphrase")); } diff --git a/src/main/java/rife/bld/extension/CheckstyleOperation.java b/src/main/java/rife/bld/extension/CheckstyleOperation.java index 8237736..681e992 100644 --- a/src/main/java/rife/bld/extension/CheckstyleOperation.java +++ b/src/main/java/rife/bld/extension/CheckstyleOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 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. @@ -45,9 +45,14 @@ public class CheckstyleOperation extends AbstractProcessOperation paths) { for (var p : paths) { - options.put("-e", p); + if (isNotBlank(p)) { + options.put("-e", p); + } } return this; } /** * Directory/file pattern to exclude from CheckStyle. Multiple excludes are allowed. + * + * @param pattern the pattern + * @return the checkstyle operation */ public CheckstyleOperation excludedPathPattern(String pattern) { - options.put("-x", pattern); + if (isNotBlank(pattern)) { + options.put("-x", pattern); + } return this; } @@ -152,6 +178,9 @@ public class CheckstyleOperation extends AbstractProcessOperationonly Javadoc comment content * without including '/**' and '*/' at the beginning and at the end respectively. The option cannot * be used other options and requires exactly one file to run on to be specified. + * + * @param isTree {@code true} or {@code false} + * @return the checkstyle operation */ public CheckstyleOperation javadocTree(boolean isTree) { if (isTree) { @@ -208,51 +255,73 @@ public class CheckstyleOperation extends AbstractProcessOperationATTENTION: generated result will have few queries, joined by pipe(|). Together they will match all AST nodes * on specified line and column. You need to choose only one and recheck that it works. Usage of all of them is also * ok, but might result in undesirable matching and suppress other issues. + * + * @param lineColumn the line column + * @return the checkstyle operation */ public CheckstyleOperation lineColumn(String lineColumn) { - options.put("-s", lineColumn); + if (isNotBlank(lineColumn)) { + options.put("-s", lineColumn); + } return this; } /** * Sets the output file. Defaults to stdout. + * + * @param file the file + * @return the checkstyle operation */ public CheckstyleOperation output(String file) { - options.put("-o", file); + if (isNotBlank(file)) { + options.put("-o", file); + } return this; } /** * Sets the property files to load. + * + * @param file the file + * @return the checkstyle operation */ public CheckstyleOperation propertiesFile(String file) { - options.put("-p", file); + if (isNotBlank(file)) { + options.put("-p", file); + } return this; } /** * Specified the file(s) or folder(s) containing the source files to check. * + * @param dir one or more directories + * @return the checkstyle operation * @see #sourceDir(Collection) */ public CheckstyleOperation sourceDir(String... dir) { - sourceDirs.addAll(Arrays.asList(dir)); + sourceDirs.addAll(Arrays.stream(dir).filter(this::isNotBlank).toList()); return this; } /** * Specified the file(s) or folder(s) containing the source files to check. * + * @param dirs the directories + * @return the checkstyle operation * @see #sourceDir(String...) */ public CheckstyleOperation sourceDir(Collection dirs) { - sourceDirs.addAll(dirs); + sourceDirs.addAll(dirs.stream().filter(this::isNotBlank).toList()); return this; } /** * Sets the length of the tab character. Used only with the {@link #lineColumn(String) lineColum} option. * Default value is {@code 8}. + * + * @param length the length + * @return the checkstyle operation */ public CheckstyleOperation tabWith(int length) { options.put("-w", String.valueOf(length)); @@ -262,6 +331,9 @@ public class CheckstyleOperation extends AbstractProcessOperation