diff --git a/README.md b/README.md index 3233e67..fa56b55 100644 --- a/README.md +++ b/README.md @@ -118,4 +118,10 @@ Project uses semantic versioning. ### 1.1.3 ### -* Remove final from `ConcatenationType` in mojo. \ No newline at end of file +* Remove final from `ConcatenationType` in mojo. + +### 1.2.0 ### + +* Make `concatenationType` required. +* Add debug logger for the parmas if enable. +* Move verification to CI profile \ No newline at end of file diff --git a/pom.xml b/pom.xml index 63d72e4..0a00747 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.github.flaw101 concat-maven-plugin - 1.1.3 + 1.2.0 maven-plugin Concat Maven Plugin Maven plugin that can concatenate several files into one new file. @@ -160,77 +160,84 @@ - - com.github.ekryd.sortpom - sortpom-maven-plugin - 2.8.0 - - - verify-pom-order - process-sources - - verify - - - - - - org.owasp - dependency-check-maven - 3.1.0 - - - process-sources - - check - - - - - 0 - true - - - - org.pitest - pitest-maven - 1.3.1 - - - test - - mutationCoverage - - - - *HelpMojo* - - 4 - 86 - 90 - - - - - - net.revelc.code.formatter - formatter-maven-plugin - 2.7.1 - - - process-sources - - validate - - - - - /.formatter.xml - - + + ci + + + + com.github.ekryd.sortpom + sortpom-maven-plugin + 2.8.0 + + + verify-pom-order + process-sources + + verify + + + + + + org.owasp + dependency-check-maven + 3.1.0 + + + process-sources + + check + + + + + 0 + true + + + + org.pitest + pitest-maven + 1.3.1 + + + test + + mutationCoverage + + + + *HelpMojo* + + 4 + 86 + 90 + + + + + + net.revelc.code.formatter + formatter-maven-plugin + 2.7.1 + + + process-sources + + validate + + + + + /.formatter.xml + + + + + deploy diff --git a/src/main/java/io/github/flaw101/concat/ConcatMojo.java b/src/main/java/io/github/flaw101/concat/ConcatMojo.java index 3790d6b..2099e70 100644 --- a/src/main/java/io/github/flaw101/concat/ConcatMojo.java +++ b/src/main/java/io/github/flaw101/concat/ConcatMojo.java @@ -55,8 +55,9 @@ public class ConcatMojo extends AbstractMojo { * Type of concatenation to perform * * @parameter + * @required */ - private ConcantenationType concatenationType = ConcantenationType.FILE_LIST; + private ConcantenationType concatenationType; /** * The resulting file @@ -84,16 +85,16 @@ public class ConcatMojo extends AbstractMojo { /** * Append newline after each concatenation * - * @parameter + * @parameter default-value="false" */ - private boolean appendNewline = false; + private boolean appendNewline; /** * Deletes the target file before concatenation * - * @parameter + * @parameter default-value="false" */ - private boolean deleteTargetFile = false; + private boolean deleteTargetFile; /* * (non-Javadoc) @@ -104,7 +105,9 @@ public class ConcatMojo extends AbstractMojo { public void execute() throws MojoExecutionException { final ConcatParams params = new ConcatParams(directory, concatFiles, outputFile, deleteTargetFile, appendNewline, concatenationType); - + if (getLog().isDebugEnabled()) { + getLog().debug("Concatenating with params" + params.toString()); + } final Injector injector = Guice.createInjector(new ConcatModule()); final ConcatService concatService = injector.getInstance(ConcatService.class); try { diff --git a/src/main/java/io/github/flaw101/concat/ConcatParams.java b/src/main/java/io/github/flaw101/concat/ConcatParams.java index 039e774..92a7dfe 100644 --- a/src/main/java/io/github/flaw101/concat/ConcatParams.java +++ b/src/main/java/io/github/flaw101/concat/ConcatParams.java @@ -87,4 +87,75 @@ public void addAll(final Collection files) { public String getDirectory() { return directory; } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (appendNewline ? 1231 : 1237); + result = prime * result + + ((concatenationType == null) ? 0 : concatenationType.hashCode()); + result = prime * result + (deleteTargetFile ? 1231 : 1237); + result = prime * result + ((directory == null) ? 0 : directory.hashCode()); + result = prime * result + (files.hashCode()); + result = prime * result + ((outputFile == null) ? 0 : outputFile.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { // NOSONAR + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ConcatParams)) { + return false; + } + final ConcatParams other = (ConcatParams) obj; + if (appendNewline != other.appendNewline) { + return false; + } + if (concatenationType != other.concatenationType) { + return false; + } + if (deleteTargetFile != other.deleteTargetFile) { + return false; + } + if (directory == null) { + if (other.directory != null) { + return false; + } + } + else if (!directory.equals(other.directory)) { + return false; + } + if (other.files != null) { + return false; + } + else if (!files.equals(other.files)) { + return false; + } + if (outputFile == null) { + if (other.outputFile != null) { + return false; + } + } + else if (!outputFile.equals(other.outputFile)) { + return false; + } + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("ConcatParams [directory=").append(directory) + .append(", outputFile=").append(outputFile).append(", deleteTargetFile=") + .append(deleteTargetFile).append(", appendNewline=").append(appendNewline) + .append(", files=").append(files).append(", concatenationType=") + .append(concatenationType).append("]"); + return builder.toString(); + } } diff --git a/src/test/resources/test-delete-target-file-pom.xml b/src/test/resources/test-delete-target-file-pom.xml index 2d9603e..df12b0a 100644 --- a/src/test/resources/test-delete-target-file-pom.xml +++ b/src/test/resources/test-delete-target-file-pom.xml @@ -23,18 +23,15 @@ concat-maven-plugin true + FILE_LIST target/concatfile.output - src/test/resources/testfiles/file_1.input - src/test/resources/testfiles/file_2.input - src/test/resources/testfiles/file_3.input + src/test/resources/testfiles/file_1.input + src/test/resources/testfiles/file_2.input + src/test/resources/testfiles/file_3.input - - - - \ No newline at end of file diff --git a/src/test/resources/test-missing-output-pom.xml b/src/test/resources/test-missing-output-pom.xml index 44b960b..a360bfc 100644 --- a/src/test/resources/test-missing-output-pom.xml +++ b/src/test/resources/test-missing-output-pom.xml @@ -22,17 +22,14 @@ concat-maven-plugin + FILE_LIST - src/test/resources/testfiles/file_1.input - src/test/resources/testfiles/file_2.input - src/test/resources/testfiles/file_3.input + src/test/resources/testfiles/file_1.input + src/test/resources/testfiles/file_2.input + src/test/resources/testfiles/file_3.input - - - - \ No newline at end of file diff --git a/src/test/resources/test-newline-pom.xml b/src/test/resources/test-newline-pom.xml index dd38513..54a5039 100644 --- a/src/test/resources/test-newline-pom.xml +++ b/src/test/resources/test-newline-pom.xml @@ -22,19 +22,16 @@ concat-maven-plugin + FILE_LIST true target/concatfile.output - src/test/resources/testfiles/file_1.input - src/test/resources/testfiles/file_2.input - src/test/resources/testfiles/file_3.input + src/test/resources/testfiles/file_1.input + src/test/resources/testfiles/file_2.input + src/test/resources/testfiles/file_3.input - - - - \ No newline at end of file diff --git a/src/test/resources/test-pom-directory-competing-args.xml b/src/test/resources/test-pom-directory-competing-args.xml index 8eec3ae..b4872bd 100644 --- a/src/test/resources/test-pom-directory-competing-args.xml +++ b/src/test/resources/test-pom-directory-competing-args.xml @@ -29,16 +29,12 @@ DIRECTORY - src/test/resources/testfiles/file_1.input - src/test/resources/testfiles/file_2.input - src/test/resources/testfiles/file_3.input + src/test/resources/testfiles/file_1.input + src/test/resources/testfiles/file_2.input + src/test/resources/testfiles/file_3.input - - - - \ No newline at end of file diff --git a/src/test/resources/test-pom-directory-missing-directory.xml b/src/test/resources/test-pom-directory-missing-directory.xml index 3bb65da..e5c88d4 100644 --- a/src/test/resources/test-pom-directory-missing-directory.xml +++ b/src/test/resources/test-pom-directory-missing-directory.xml @@ -31,8 +31,4 @@ - - - - \ No newline at end of file diff --git a/src/test/resources/test-pom-directory-not-a-directory.xml b/src/test/resources/test-pom-directory-not-a-directory.xml index a8461ac..16a5b5c 100644 --- a/src/test/resources/test-pom-directory-not-a-directory.xml +++ b/src/test/resources/test-pom-directory-not-a-directory.xml @@ -32,8 +32,4 @@ - - - - \ No newline at end of file diff --git a/src/test/resources/test-pom-directory.xml b/src/test/resources/test-pom-directory.xml index 863fe53..e658c5a 100644 --- a/src/test/resources/test-pom-directory.xml +++ b/src/test/resources/test-pom-directory.xml @@ -32,8 +32,4 @@ - - - - \ No newline at end of file diff --git a/src/test/resources/test-pom.xml b/src/test/resources/test-pom.xml index 2a03e2f..7ad53d5 100644 --- a/src/test/resources/test-pom.xml +++ b/src/test/resources/test-pom.xml @@ -23,17 +23,14 @@ concat-maven-plugin target/concatfile.output + FILE_LIST - src/test/resources/testfiles/file_1.input - src/test/resources/testfiles/file_2.input - src/test/resources/testfiles/file_3.input + src/test/resources/testfiles/file_1.input + src/test/resources/testfiles/file_2.input + src/test/resources/testfiles/file_3.input - - - - \ No newline at end of file