Compare commits

...

4 commits

Author SHA1 Message Date
d20f3e41b8
Version 1.1.5 2024-08-30 11:43:07 -07:00
47c0b14ce9
Minor cleanups 2024-08-30 11:38:44 -07:00
176929cd29
Bumped PMD to version 7.5.0 2024-08-30 11:00:20 -07:00
3e18345efe
Bumped bld to version 2.1.0 2024-08-29 21:58:24 -07:00
11 changed files with 40 additions and 42 deletions

View file

@ -2,12 +2,12 @@
<library name="bld"> <library name="bld">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.1.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-2.1.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" /> <root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.1-sources.jar!/" /> <root url="jar://$USER_HOME$/.bld/dist/bld-2.1.0-sources.jar!/" />
</SOURCES> </SOURCES>
<excluded> <excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" /> <root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -7,7 +7,7 @@
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" /> <root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -7,7 +7,7 @@
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" /> <root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -7,7 +7,7 @@
<SOURCES> <SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" /> <root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES> </SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" /> <jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
</library> </library>
</component> </component>

View file

@ -9,7 +9,7 @@
], ],
"java.configuration.updateBuildConfiguration": "automatic", "java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [ "java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-2.0.1.jar", "${HOME}/.bld/dist/bld-2.1.0.jar",
"lib/**/*.jar" "lib/**/*.jar"
] ]
} }

View file

@ -2,7 +2,7 @@
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![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) [![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.0.1-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld) [![bld](https://img.shields.io/badge/2.1.0-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) [![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) [![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) [![GitHub CI](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld-pmd/actions/workflows/bld.yml)

Binary file not shown.

View file

@ -2,4 +2,4 @@ bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.downloadLocation=
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.version=2.0.1 bld.version=2.1.0

View file

@ -31,7 +31,7 @@ public class PmdOperationBuild extends Project {
public PmdOperationBuild() { public PmdOperationBuild() {
pkg = "rife.bld.extension"; pkg = "rife.bld.extension";
name = "bld-pmd"; name = "bld-pmd";
version = version(1, 1, 5, "SNAPSHOT"); version = version(1, 1, 5);
javaRelease = 17; javaRelease = 17;
@ -39,9 +39,9 @@ public class PmdOperationBuild extends Project {
autoDownloadPurge = true; autoDownloadPurge = true;
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
var pmd = version(7, 4, 0); var pmd = version(7, 5, 0);
scope(compile) scope(compile)
.include(dependency("com.uwyn.rife2", "bld", version(2, 0, 1))) .include(dependency("com.uwyn.rife2", "bld", version(2, 1, 0)))
.include(dependency("net.sourceforge.pmd", "pmd-java", pmd)); .include(dependency("net.sourceforge.pmd", "pmd-java", pmd));
scope(runtime) scope(runtime)
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 16))); .include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 16)));

View file

@ -560,7 +560,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param inputPath a collection of input paths * @param inputPath a collection of input paths
* @return this operation * @return this operation
* @see #addInputPaths(Path...) * @see #addInputPaths(Collection)
*/ */
public PmdOperation inputPaths(Collection<Path> inputPath) { public PmdOperation inputPaths(Collection<Path> inputPath) {
inputPaths_.clear(); inputPaths_.clear();
@ -584,7 +584,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param inputPath a collection of input paths * @param inputPath a collection of input paths
* @return this operation * @return this operation
* @see #addInputPaths(File...) * @see #addInputPathsFiles(Collection) )
*/ */
public PmdOperation inputPathsFiles(Collection<File> inputPath) { public PmdOperation inputPathsFiles(Collection<File> inputPath) {
return inputPaths(inputPath.stream().map(File::toPath).toList()); return inputPaths(inputPath.stream().map(File::toPath).toList());
@ -597,7 +597,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* *
* @param inputPath a collection of input paths * @param inputPath a collection of input paths
* @return this operation * @return this operation
* @see #addInputPaths(String...) * @see #addInputPathsStrings(Collection)
*/ */
public PmdOperation inputPathsStrings(Collection<String> inputPath) { public PmdOperation inputPathsStrings(Collection<String> inputPath) {
return inputPaths(inputPath.stream().map(Paths::get).toList()); return inputPaths(inputPath.stream().map(Paths::get).toList());
@ -804,8 +804,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation reportFile(File reportFile) { public PmdOperation reportFile(File reportFile) {
reportFile_ = reportFile.toPath(); return reportFile(reportFile.toPath());
return this;
} }
/** /**
@ -815,8 +814,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @return this operation * @return this operation
*/ */
public PmdOperation reportFile(String reportFile) { public PmdOperation reportFile(String reportFile) {
reportFile_ = Paths.get(reportFile); return reportFile(Paths.get(reportFile));
return this;
} }
/** /**
@ -871,9 +869,7 @@ public class PmdOperation extends AbstractOperation<PmdOperation> {
* @see #addRuleSet(String...) * @see #addRuleSet(String...)
*/ */
public PmdOperation ruleSets(String... ruleSet) { public PmdOperation ruleSets(String... ruleSet) {
ruleSets_.clear(); return ruleSets(List.of(ruleSet));
ruleSets_.addAll(List.of(ruleSet));
return this;
} }
/** /**

View file

@ -76,40 +76,42 @@ class PmdOperationTest {
var err = pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)); 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.inputPaths().clear();
pmd = pmd.addInputPaths(project.srcMainDirectory(), project.srcTestDirectory()); pmd = pmd.addInputPaths(project.srcMainDirectory(), project.srcTestDirectory());
assertThat(pmd.inputPaths()).as("main, test").containsExactly(project.srcMainDirectory().toPath(), assertThat(pmd.inputPaths()).as("File...").containsExactly(project.srcMainDirectory().toPath(),
project.srcTestDirectory().toPath()); project.srcTestDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd = pmd.addInputPathsFiles(List.of(project.srcMainDirectory(), project.srcTestDirectory())); pmd = pmd.addInputPathsFiles(List.of(project.srcMainDirectory(), project.srcTestDirectory()));
assertThat(pmd.inputPaths()).as("PathsFiles(main, test)") 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...")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd = pmd.addInputPathsStrings( pmd = pmd.addInputPathsStrings(
List.of(project.srcMainDirectory().getAbsolutePath(), project.srcTestDirectory().getAbsolutePath())); List.of(project.srcMainDirectory().getAbsolutePath(), project.srcTestDirectory().getAbsolutePath()));
assertThat(pmd.inputPaths()).as("PathsStrings(main, test)") assertThat(pmd.inputPaths()).as("List(String...)")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd = pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); pmd = pmd.addInputPaths(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
assertThat(pmd.inputPaths()).as("toPath(main, test)") assertThat(pmd.inputPaths()).as("Path...")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
pmd.inputPaths().clear(); pmd.inputPaths().clear();
pmd = pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath())); pmd = pmd.addInputPaths(List.of(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()));
assertThat(pmd.inputPaths()).as("List(main, test)") assertThat(pmd.inputPaths()).as("List(Path)")
.containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath()); .containsExactly(project.srcMainDirectory().toPath(), project.srcTestDirectory().toPath());
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))) assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME)))
@ -234,31 +236,31 @@ class PmdOperationTest {
var pmd = newPmdOperation() var pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); .inputPaths(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.inputPaths()).as("paths").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("Path....").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation() pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile()); .inputPaths(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile());
assertThat(pmd.inputPaths()).as("toFile()").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("File...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation() pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPaths(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString()); .inputPaths(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString());
assertThat(pmd.inputPaths()).as("toString").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("String...").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation() pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPathsFiles(List.of(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile())); .inputPathsFiles(List.of(ERROR_PRONE_SAMPLE.toFile(), CODE_STYLE_SAMPLE.toFile()));
assertThat(pmd.inputPaths()).as("PathsFiles").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("List(Path...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
pmd = newPmdOperation() pmd = newPmdOperation()
.ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML) .ruleSets(PmdOperation.RULE_SET_DEFAULT, CODE_STYLE_XML)
.inputPathsStrings(List.of(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString())); .inputPathsStrings(List.of(ERROR_PRONE_SAMPLE.toString(), CODE_STYLE_SAMPLE.toString()));
assertThat(pmd.inputPaths()).as("PathsStrings").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE); assertThat(pmd.inputPaths()).as("List(String...)").containsExactly(ERROR_PRONE_SAMPLE, CODE_STYLE_SAMPLE);
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
} }
@ -347,7 +349,7 @@ class PmdOperationTest {
var pmd = newPmdOperation() var pmd = newPmdOperation()
.forceLanguageVersion(language.getLatestVersion()) .forceLanguageVersion(language.getLatestVersion())
.defaultLanguageVersions(language.getVersions()) .defaultLanguageVersions(language.getVersions())
.languageVersions(language.getVersion("22")) .languageVersions(language.getDefaultVersion())
.ruleSets(PmdOperation.RULE_SET_DEFAULT); .ruleSets(PmdOperation.RULE_SET_DEFAULT);
assertThat(pmd.languageVersions()).contains(language.getDefaultVersion()); assertThat(pmd.languageVersions()).contains(language.getDefaultVersion());
assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0); assertThat(pmd.performPmdAnalysis(TEST, pmd.initConfiguration(COMMAND_NAME))).isGreaterThan(0);
@ -386,13 +388,13 @@ class PmdOperationTest {
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)) pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
.relativizeRootsFiles(List.of(foo.toFile(), bar.toFile(), baz.toFile())); .relativizeRootsFiles(List.of(foo.toFile(), bar.toFile(), baz.toFile()));
config = pmd.initConfiguration(COMMAND_NAME); config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.getRelativizeRoots()).as("toFile").isEqualTo(pmd.relativizeRoots()); assertThat(config.getRelativizeRoots()).as("List(File...)").isEqualTo(pmd.relativizeRoots());
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz); assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO)) pmd = newPmdOperation().ruleSets(List.of(CATEGORY_FOO))
.relativizeRootsStrings(List.of(foo.toString(), bar.toString(), baz.toString())); .relativizeRootsStrings(List.of(foo.toString(), bar.toString(), baz.toString()));
config = pmd.initConfiguration(COMMAND_NAME); config = pmd.initConfiguration(COMMAND_NAME);
assertThat(config.getRelativizeRoots()).as("toString").isEqualTo(pmd.relativizeRoots()); assertThat(config.getRelativizeRoots()).as("List(String....)").isEqualTo(pmd.relativizeRoots());
assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz); assertThat(config.getRelativizeRoots()).containsExactly(foo, bar, baz);
} }