diff --git a/.idea/libraries/bld.xml b/.idea/libraries/bld.xml index 5c4010c..4dd96bf 100644 --- a/.idea/libraries/bld.xml +++ b/.idea/libraries/bld.xml @@ -2,12 +2,12 @@ - + - + diff --git a/.idea/libraries/compile.xml b/.idea/libraries/compile.xml index 99cc0c0..9bd86aa 100644 --- a/.idea/libraries/compile.xml +++ b/.idea/libraries/compile.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/runtime.xml b/.idea/libraries/runtime.xml index 56ddbf1..81feb0b 100644 --- a/.idea/libraries/runtime.xml +++ b/.idea/libraries/runtime.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.idea/libraries/test.xml b/.idea/libraries/test.xml index f72f7a3..13b6513 100644 --- a/.idea/libraries/test.xml +++ b/.idea/libraries/test.xml @@ -7,7 +7,7 @@ - - + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c33beb..5b2667b 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.0.1.jar", "lib/**/*.jar" ] } diff --git a/README.md b/README.md index 00dbca3..4f29dea 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) -[![bld](https://img.shields.io/badge/2.1.0-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) +[![bld](https://img.shields.io/badge/2.0.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![Release](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/releases/com/uwyn/rife2/bld-pmd/maven-metadata.xml?color=blue)](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-pmd) [![Snapshot](https://flat.badgen.net/maven/v/metadata-url/repo.rife2.com/snapshots/com/uwyn/rife2/bld-pmd/maven-metadata.xml?label=snapshot)](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-pmd) [![GitHub CI](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml) diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index 3133172..fec2c9a 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 e011e70..8b07b8b 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -2,4 +2,4 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES -bld.version=2.1.0 +bld.version=2.0.1 diff --git a/src/bld/java/rife/bld/extension/PmdOperationBuild.java b/src/bld/java/rife/bld/extension/PmdOperationBuild.java index eb8eda4..ed1ec9a 100644 --- a/src/bld/java/rife/bld/extension/PmdOperationBuild.java +++ b/src/bld/java/rife/bld/extension/PmdOperationBuild.java @@ -31,7 +31,7 @@ public class PmdOperationBuild extends Project { public PmdOperationBuild() { pkg = "rife.bld.extension"; name = "bld-pmd"; - version = version(1, 1, 5); + version = version(1, 1, 5, "SNAPSHOT"); javaRelease = 17; @@ -39,9 +39,9 @@ public class PmdOperationBuild extends Project { autoDownloadPurge = true; repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); - var pmd = version(7, 5, 0); + var pmd = version(7, 4, 0); scope(compile) - .include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0))) + .include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))) .include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); scope(runtime) .include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 16))); diff --git a/src/main/java/rife/bld/extension/PmdOperation.java b/src/main/java/rife/bld/extension/PmdOperation.java index 5b4cfde..ff67cae 100644 --- a/src/main/java/rife/bld/extension/PmdOperation.java +++ b/src/main/java/rife/bld/extension/PmdOperation.java @@ -560,7 +560,7 @@ public class PmdOperation extends AbstractOperation { * * @param inputPath a collection of input paths * @return this operation - * @see #addInputPaths(Collection) + * @see #addInputPaths(Path...) */ public PmdOperation inputPaths(Collection inputPath) { inputPaths_.clear(); @@ -584,7 +584,7 @@ public class PmdOperation extends AbstractOperation { * * @param inputPath a collection of input paths * @return this operation - * @see #addInputPathsFiles(Collection) ) + * @see #addInputPaths(File...) */ public PmdOperation inputPathsFiles(Collection inputPath) { return inputPaths(inputPath.stream().map(File::toPath).toList()); @@ -597,7 +597,7 @@ public class PmdOperation extends AbstractOperation { * * @param inputPath a collection of input paths * @return this operation - * @see #addInputPathsStrings(Collection) + * @see #addInputPaths(String...) */ public PmdOperation inputPathsStrings(Collection inputPath) { return inputPaths(inputPath.stream().map(Paths::get).toList()); @@ -804,7 +804,8 @@ public class PmdOperation extends AbstractOperation { * @return this operation */ public PmdOperation reportFile(File reportFile) { - return reportFile(reportFile.toPath()); + reportFile_ = reportFile.toPath(); + return this; } /** @@ -814,7 +815,8 @@ public class PmdOperation extends AbstractOperation { * @return this operation */ public PmdOperation reportFile(String reportFile) { - return reportFile(Paths.get(reportFile)); + reportFile_ = Paths.get(reportFile); + return this; } /** @@ -869,7 +871,9 @@ public class PmdOperation extends AbstractOperation { * @see #addRuleSet(String...) */ public PmdOperation ruleSets(String... ruleSet) { - return ruleSets(List.of(ruleSet)); + ruleSets_.clear(); + ruleSets_.addAll(List.of(ruleSet)); + return this; } /** diff --git a/src/test/java/rife/bld/extension/PmdOperationTest.java b/src/test/java/rife/bld/extension/PmdOperationTest.java index 80f7169..d9e08fb 100644 --- a/src/test/java/rife/bld/extension/PmdOperationTest.java +++ b/src/test/java/rife/bld/extension/PmdOperationTest.java @@ -76,42 +76,40 @@ class PmdOperationTest { var err = pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)); + pmd.inputPaths().clear(); + pmd.addInputPaths(project.srcMainDirectory()); + + assertThat(pmd.inputPaths()).as("main").containsExactly(project.srcMainDirectory().toPath()); + pmd.inputPaths().clear(); pmd = pmd.addInputPaths(project.srcMainDirectory(), project.srcTestDirectory()); - assertThat(pmd.inputPaths()).as("File...").containsExactly(project.srcMainDirectory().toPath(), + assertThat(pmd.inputPaths()).as("main, test").containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd.inputPaths().clear(); pmd = pmd.addInputPathsFiles(List.of(project.srcMainDirectory(), project.srcTestDirectory())); - assertThat(pmd.inputPaths()).as("List(File...)") - .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); - - pmd.inputPaths().clear(); - pmd = pmd.addInputPaths(project.srcMainDirectory().getAbsolutePath(), - project.srcTestDirectory().getAbsolutePath()); - - assertThat(pmd.inputPaths()).as("String...") + assertThat(pmd.inputPaths()).as("PathsFiles(main, test)") .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd.inputPaths().clear(); pmd = pmd.addInputPathsStrings( List.of(project.srcMainDirectory().getAbsolutePath(), project.srcTestDirectory().getAbsolutePath())); - assertThat(pmd.inputPaths()).as("List(String...)") + assertThat(pmd.inputPaths()).as("PathsStrings(main, test)") .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd.inputPaths().clear(); pmd = pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); - assertThat(pmd.inputPaths()).as("Path...") + assertThat(pmd.inputPaths()).as("toPath(main, test)") .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd.inputPaths().clear(); pmd = pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath())); - assertThat(pmd.inputPaths()).as("List(Path)") + assertThat(pmd.inputPaths()).as("List(main, test)") .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) @@ -236,31 +234,31 @@ class PmdOperationTest { var pmd = newPmdOperation() .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); - assertThat(pmd.inputPaths()).as("Path....").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); + assertThat(pmd.inputPaths()).as("paths").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); pmd = newPmdOperation() .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .inputPaths(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile()); - assertThat(pmd.inputPaths()).as("File...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); + assertThat(pmd.inputPaths()).as("toFile()").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); pmd = newPmdOperation() .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .inputPaths(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString()); - assertThat(pmd.inputPaths()).as("String...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); + assertThat(pmd.inputPaths()).as("toString").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); pmd = newPmdOperation() .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .inputPathsFiles(List.of(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile())); - assertThat(pmd.inputPaths()).as("List(Path...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); + assertThat(pmd.inputPaths()).as("PathsFiles").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); pmd = newPmdOperation() .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .inputPathsStrings(List.of(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString())); - assertThat(pmd.inputPaths()).as("List(String...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); + assertThat(pmd.inputPaths()).as("PathsStrings").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); } @@ -349,7 +347,7 @@ class PmdOperationTest { var pmd = newPmdOperation() .forceLanguageVersion(language.getLatestVersion()) .defaultLanguageVersions(language.getVersions()) - .languageVersions(language.getDefaultVersion()) + .languageVersions(language.getVersion("22")) .ruleSets(PmdOperation.RULE_SET_DEFAULT); assertThat(pmd.languageVersions()).contains(language.getDefaultVersion()); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); @@ -388,13 +386,13 @@ class PmdOperationTest { pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)) .relativizeRootsFiles(List.of(foo.toFile(), bar.toFile(), baz.toFile())); config = pmd.initConfiguration(COMMAND_NAME); - assertThat(config.getRelativizeRoots()).as("List(File...)").isEqualTo(pmd.relativizeRoots()); + assertThat(config.getRelativizeRoots()).as("toFile").isEqualTo(pmd.relativizeRoots()); assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz); pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)) .relativizeRootsStrings(List.of(foo.toString(), bar.toString(), baz.toString())); config = pmd.initConfiguration(COMMAND_NAME); - assertThat(config.getRelativizeRoots()).as("List(String....)").isEqualTo(pmd.relativizeRoots()); + assertThat(config.getRelativizeRoots()).as("toString").isEqualTo(pmd.relativizeRoots()); assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz); }