Skip to content
Permalink
Browse files
[FIXED JENKINS-15626] Conflict with standard clover plugin
  • Loading branch information
ssogabe committed Mar 13, 2013
1 parent 585ef56 commit 4e26c8a4a822b76bd13b146258c8feca31638517
@@ -140,7 +140,7 @@ public synchronized ProjectCoverage getResult() {
}
}

File reportFile = CloverPublisher.getCloverXmlReport(owner);
File reportFile = CloverPHPPublisher.getCloverXmlReport(owner);
try {
ProjectCoverage r = CloverCoverageParser.parse(reportFile, buildBaseDir);
r.setOwner(owner);
@@ -4,12 +4,15 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import hudson.matrix.MatrixProject;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.model.FreeStyleProject;
import hudson.model.Items;
import hudson.model.Project;
import hudson.model.Result;
import org.jenkinsci.plugins.cloverphp.results.ProjectCoverage;
@@ -36,10 +39,10 @@
*
* @author Stephen Connolly
*/
public class CloverPublisher extends Recorder {
public class CloverPHPPublisher extends Recorder {

private final boolean publishHtmlReport;

private final String reportDir;

private final String xmlLocation;
@@ -58,7 +61,7 @@ public class CloverPublisher extends Recorder {
* @stapler-constructor
*/
@DataBoundConstructor
public CloverPublisher(String xmlLocation, String publishHtmlReport, String reportDir, boolean disableArchiving) {
public CloverPHPPublisher(String xmlLocation, String publishHtmlReport, String reportDir, boolean disableArchiving) {
this.xmlLocation = Util.fixEmptyAndTrim(xmlLocation);
this.publishHtmlReport = Util.fixEmptyAndTrim(publishHtmlReport) != null;
this.reportDir = Util.fixEmptyAndTrim(reportDir);
@@ -71,7 +74,7 @@ public CloverPublisher(String xmlLocation, String publishHtmlReport, String repo
public boolean isPublishHtmlReport() {
return publishHtmlReport;
}

public String getReportDir() {
return reportDir;
}
@@ -173,7 +176,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen

// create "jobs/builds/XXX/cloverphp"
cloverphpBuildTarget.mkdirs();

if (isPublishHtmlReport() && !isDisableArchiving()) {
FilePath coverageReportDir = workspace.child(reportDir);
FilePath htmlReportDir = new FilePath(cloverphpBuildTarget, "htmlreport");
@@ -201,7 +204,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
* Process the clover.xml from the build directory. The clover.xml must have been already copied to the build dir.
*
*/
private void processCloverXml(AbstractBuild<?, ?> build, BuildListener listener, FilePath buildTarget)
private void processCloverXml(AbstractBuild<?, ?> build, BuildListener listener, FilePath buildTarget)
throws InterruptedException {
String workspacePath = build.getWorkspace().getRemote();
if (!workspacePath.endsWith(File.separator)) {
@@ -218,7 +221,6 @@ private void processCloverXml(AbstractBuild<?, ?> build, BuildListener listener,
Util.displayIOException(e, listener);
e.printStackTrace(listener.fatalError("Unable to parse " + cloverXmlReport));
build.setResult(Result.FAILURE);
return;
}
final CloverBuildAction action = CloverBuildAction.load(build, workspacePath, result, healthyTarget, unhealthyTarget);

@@ -308,16 +310,21 @@ public BuildStepMonitor getRequiredMonitorService() {
*/
public static final class DescriptorImpl extends BuildStepDescriptor<Publisher> {

@Initializer(before = InitMilestone.PLUGINS_STARTED)
public static void addAliases() {
Items.XSTREAM2.addCompatibilityAlias("org.jenkinsci.plugins.cloverphp.CloverPublisher", CloverPHPPublisher.class);
}

DescriptorImpl() {
super(CloverPublisher.class);
super(CloverPHPPublisher.class);
}

/**
* This human readable name is used in the configuration screen.
*/
@Override
public String getDisplayName() {
return Messages.CloverPublisher_DisplayName();
return Messages.CloverPHPPublisher_DisplayName();
}

@Override
@@ -331,13 +338,13 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
* Creates a new instance of {@link CloverPublisher} from a submitted form.
*/
@Override
public CloverPublisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {
CloverPublisher instance = req.bindParameters(CloverPublisher.class, "clover.");
public CloverPHPPublisher newInstance(StaplerRequest req, JSONObject formData) throws FormException {
CloverPHPPublisher instance = req.bindParameters(CloverPHPPublisher.class, "clover.");
if (instance.getXmlLocation() == null) {
throw new FormException(Messages.CloverPublisher_xmlLocation_required(), "xmlLocation");
}
throw new FormException(Messages.CloverPHPPublisher_xmlLocation_required(), "xmlLocation");
}
if (instance.isPublishHtmlReport() && instance.getReportDir() == null) {
throw new FormException(Messages.CloverPublisher_reportDir_required(), "reportDir");
throw new FormException(Messages.CloverPHPPublisher_reportDir_required(), "reportDir");
}
req.bindParameters(instance.failingTarget, "cloverFailingTarget.");
req.bindParameters(instance.healthyTarget, "cloverHealthyTarget.");
@@ -354,7 +361,7 @@ public CloverPublisher newInstance(StaplerRequest req, JSONObject formData) thro
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return FreeStyleProject.class.equals(jobType) || MatrixProject.class.equals(jobType);
}

public FormValidation doRequiredCheck(@QueryParameter String value) {
String v = Util.fixEmptyAndTrim(value);
return FormValidation.validateRequired(v);
@@ -31,9 +31,9 @@ public class CloverProjectAction extends Actionable implements ProminentProjectA

private final Project<?, ?> project;

private final CloverPublisher publisher;
private final CloverPHPPublisher publisher;

public CloverProjectAction(Project project, CloverPublisher publisher) {
public CloverProjectAction(Project project, CloverPHPPublisher publisher) {
this.project = project;
this.publisher = publisher;
}
@@ -4,14 +4,14 @@
<f:entry title="${%Clover XML Location}"
description="${%description.XmlLocation}">
<f:textbox name="clover.xmlLocation" value="${instance.xmlLocation}"
checkUrl="'descriptorByName/CloverPublisher/requiredCheck?value='+encodeURIComponent(this.value)"/>
checkUrl="'descriptorByName/CloverPHPPublisher/requiredCheck?value='+encodeURIComponent(this.value)"/>
</f:entry>

<f:optionalBlock name="clover.publishHtmlReport" checked="${instance.publishHtmlReport}" title="${%Publish HTML Report}" >
<f:entry title="${%Clover HTML report directory}"
description="${%description.HtmlReportDir}">
<f:textbox name="clover.reportDir" value="${instance.reportDir}"
checkUrl="'descriptorByName/CloverPublisher/requiredCheck?value='+encodeURIComponent(this.value)" />
checkUrl="'descriptorByName/CloverPHPPublisher/requiredCheck?value='+encodeURIComponent(this.value)" />
</f:entry>
<f:entry>
<f:checkbox name="clover.disableArchiving" checked="${instance.isDisableArchiving()}" />
@@ -78,4 +78,4 @@
</table>
</f:entry>
</f:advanced>
</j:jelly>
</j:jelly>
@@ -11,10 +11,10 @@ CloverProjectAction.InvalidConfiguration=Invalid clover report directory or name

CloverBuildAction.DisplayName=Clover Summary Report

CloverPublisher.DisplayName=Publish Clover PHP Coverage Report
CloverPHPPublisher.DisplayName=Publish Clover PHP Coverage Report

CloverPublisher.xmlLocation.required=Clover XML Location is required.
CloverPublisher.reportDir.required=Clover HTML report directory is required.
CloverPHPPublisher.xmlLocation.required=Clover XML Location is required.
CloverPHPPublisher.reportDir.required=Clover HTML report directory is required.

CloverCoverageParser.ProjectName=Project

@@ -11,10 +11,10 @@ CloverProjectAction.InvalidConfiguration=Clover\u30ec\u30dd\u30fc\u30c8\u306e\u3

CloverBuildAction.DisplayName=Clover\u6982\u8981\u30ec\u30dd\u30fc\u30c8

CloverPublisher.DisplayName=Clover PHP \u30ab\u30d0\u30ec\u30c3\u30b8\u30ec\u30dd\u30fc\u30c8\u3092\u96c6\u8a08
CloverPHPPublisher.DisplayName=Clover PHP \u30ab\u30d0\u30ec\u30c3\u30b8\u30ec\u30dd\u30fc\u30c8\u3092\u96c6\u8a08

CloverPublisher.xmlLocation.required=Clover XML\u30d1\u30b9\u306f\u5fc5\u9808\u3067\u3059\u3002
CloverPublisher.reportDir.required=Clover HTML\u30ec\u30dd\u30fc\u30c8 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u5fc5\u9808\u3067\u3059
CloverPHPPublisher.xmlLocation.required=Clover XML\u30d1\u30b9\u306f\u5fc5\u9808\u3067\u3059\u3002
CloverPHPPublisher.reportDir.required=Clover HTML\u30ec\u30dd\u30fc\u30c8 \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u5fc5\u9808\u3067\u3059


CloverCoverageParser.ProjectName=\u30d7\u30ed\u30b8\u30a7\u30af\u30c8
@@ -16,7 +16,7 @@ public void testRoundtrip() throws Exception {

FreeStyleProject p = createFreeStyleProject();

CloverPublisher publisher = new CloverPublisher("coverage.xml", "true", "reports", false);
CloverPHPPublisher publisher = new CloverPHPPublisher("coverage.xml", "true", "reports", false);
p.getPublishersList().add(publisher);

submit(new WebClient().getPage(p, "configure").getFormByName("config"));
@@ -36,7 +36,7 @@ public void testRoundtrip2() throws Exception {

FreeStyleProject p = createFreeStyleProject();

CloverPublisher publisher = new CloverPublisher("coverage.xml", null, "reports", true);
CloverPHPPublisher publisher = new CloverPHPPublisher("coverage.xml", null, "reports", true);
p.getPublishersList().add(publisher);

submit(new WebClient().getPage(p, "configure").getFormByName("config"));
@@ -56,7 +56,7 @@ public void testNotPublishAndReportDirIsNotSet() throws Exception {

FreeStyleProject p = createFreeStyleProject();

CloverPublisher publisher = new CloverPublisher("coverage.xml", null, null, false);
CloverPHPPublisher publisher = new CloverPHPPublisher("coverage.xml", null, null, false);
p.getPublishersList().add(publisher);

submit(new WebClient().getPage(p, "configure").getFormByName("config"));

0 comments on commit 4e26c8a

Please sign in to comment.