diff --git a/pom.xml b/pom.xml index b93cfb32..69ed7952 100644 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,17 @@ 1.6 + + org.jenkins-ci.tools + maven-hpi-plugin + true + + true + /jenkins + true + + + diff --git a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java index f728957c..bf9d36dd 100644 --- a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java +++ b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashRepository.java @@ -249,6 +249,8 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) { boolean shouldBuild = true; + logger.info("Processing PR: " + pullRequest.getId()); + if (pullRequest.getState() != null && pullRequest.getState().equals("OPEN")) { if (isSkipBuild(pullRequest.getTitle())) { logger.info("Skipping PR: " + pullRequest.getId() + " as title contained skip phrase"); @@ -285,6 +287,7 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) { Collections.sort(comments); Collections.reverse(comments); for (StashPullRequestComment comment : comments) { + logger.fine(comment.toString()); String content = comment.getText(); if (content == null || content.isEmpty()) { continue; @@ -341,6 +344,8 @@ private boolean isBuildTarget(StashPullRequestResponseValue pullRequest) { } if (shouldBuild) { logger.info("Building PR: " + pullRequest.getId()); + } else { + logger.fine("Skipping PR: " + pullRequest.getId()); } return shouldBuild; } diff --git a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashPullRequestComment.java b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashPullRequestComment.java index 4fdd18d8..1013be07 100644 --- a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashPullRequestComment.java +++ b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/stash/StashPullRequestComment.java @@ -1,8 +1,12 @@ package stashpullrequestbuilder.stashpullrequestbuilder.stash; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import org.apache.commons.lang.builder.CompareToBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; +import org.joda.time.DateTime; /** * Created by Nathan McCarthy @@ -13,7 +17,7 @@ public class StashPullRequestComment implements Comparable target.getCommentId()) { - return 1; - } else if (this.getCommentId().equals(target.getCommentId())) { - return 0; - } else { - return -1; - } + return new CompareToBuilder() + .append(this.createdDate, target.createdDate) + .append(this.commentId, target.commentId) + .toComparison(); + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) + .append("createdDate", createdDate) + .append("commentId", commentId) + .append("text", text) + .toString(); } }