Skip to content
Permalink
Browse files

Merge pull request #4 from cjo9900/JENKINS-12258

Add empty descriptor to HtmlPublisherTarget [FIXED JENKINS-12258]
  • Loading branch information...
mrooney committed Mar 21, 2012
2 parents 6204dbf + 921edaa commit 1436ea499aee9c9ad4b944be7195eecf96c7ba8e
Showing with 21 additions and 12 deletions.
  1. +21 −12 src/main/java/htmlpublisher/HtmlPublisherTarget.java
@@ -4,10 +4,14 @@
import hudson.model.AbstractBuild;
import hudson.model.AbstractItem;
import hudson.model.AbstractProject;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Action;
import hudson.model.DirectoryBrowserSupport;
import hudson.model.ProminentProjectAction;
import hudson.model.Run;
import hudson.model.Descriptor;
import hudson.Extension;


import java.io.File;
import java.io.IOException;
@@ -20,16 +24,16 @@

/**
* A representation of an HTML directory to archive and publish.
*
*
* @author Mike Rooney
*
*/
public class HtmlPublisherTarget {
public class HtmlPublisherTarget extends AbstractDescribableImpl<HtmlPublisherTarget> {
/**
* The name of the report to display for the build/project, such as "Code Coverage"
*/
private final String reportName;

/**
* The path to the HTML report directory relative to the workspace.
*/
@@ -61,33 +65,33 @@ public HtmlPublisherTarget(String reportName, String reportDir, String reportFil
public String getReportName() {
return this.reportName;
}

public String getReportDir() {
return this.reportDir;
}

public String getReportFiles() {
return this.reportFiles;
}

public boolean getKeepAll() {
return this.keepAll;
}

public String getSanitizedName() {
String safeName = this.reportName;
safeName = safeName.replace(" ", "_");
return safeName;
}

public String getWrapperName() {
return this.wrapperName;
}

public FilePath getArchiveTarget(AbstractBuild build) {
return new FilePath(this.keepAll ? getBuildArchiveDir(build) : getProjectArchiveDir(build.getProject()));
}

/**
* Gets the directory where the HTML report is stored for the given project.
*/
@@ -100,7 +104,7 @@ private File getProjectArchiveDir(AbstractItem project) {
private File getBuildArchiveDir(Run run) {
return new File(new File(run.getRootDir(), "htmlreports"), this.getSanitizedName());
}

protected abstract class BaseHTMLAction implements Action {
private HtmlPublisherTarget actualHtmlPublisherTarget;

@@ -192,8 +196,13 @@ public void handleAction(AbstractBuild<?, ?> build) {
build.addAction(new HTMLBuildAction(build, this));
}
}

public Action getProjectAction(AbstractProject project) {
return new HTMLAction(project, this);
}

@Extension
public static class DescriptorImpl extends Descriptor<HtmlPublisherTarget> {
public String getDisplayName() { return ""; }
}
}

0 comments on commit 1436ea4

Please sign in to comment.
You can’t perform that action at this time.