Index: HtmlPublisherTarget.java
===================================================================
--- HtmlPublisherTarget.java (revision 30680)
+++ HtmlPublisherTarget.java (working copy)
@@ -20,7 +20,7 @@
/**
* A representation of an HTML directory to archive and publish.
- *
+ *
* @author Mike Rooney
*
*/
@@ -29,7 +29,7 @@
* 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 +61,33 @@
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,14 +100,20 @@
private File getBuildArchiveDir(Run run) {
return new File(new File(run.getRootDir(), "htmlreports"), this.getSanitizedName());
}
-
+
protected abstract class BaseHTMLAction implements Action {
+ private HtmlPublisherTarget actualHtmlPublisherTarget;
+
+ public BaseHTMLAction(HtmlPublisherTarget actualHtmlPublisherTarget) {
+ this.actualHtmlPublisherTarget = actualHtmlPublisherTarget;
+ }
+
public String getUrlName() {
- return HtmlPublisherTarget.this.getSanitizedName();
+ return actualHtmlPublisherTarget.getSanitizedName();
}
public String getDisplayName() {
- String action = HtmlPublisherTarget.this.reportName;
+ String action = actualHtmlPublisherTarget.reportName;
return dir().exists() ? action : null;
}
@@ -132,7 +138,8 @@
public class HTMLAction extends BaseHTMLAction implements ProminentProjectAction {
private final AbstractItem project;
- public HTMLAction(AbstractItem project) {
+ public HTMLAction(AbstractItem project, HtmlPublisherTarget actualHtmlPublisherTarget) {
+ super(actualHtmlPublisherTarget);
this.project = project;
}
@@ -163,7 +170,8 @@
public class HTMLBuildAction extends BaseHTMLAction {
private final AbstractBuild, ?> build;
- public HTMLBuildAction(AbstractBuild, ?> build) {
+ public HTMLBuildAction(AbstractBuild, ?> build, HtmlPublisherTarget actualHtmlPublisherTarget) {
+ super(actualHtmlPublisherTarget);
this.build = build;
}
@@ -181,11 +189,11 @@
public void handleAction(AbstractBuild, ?> build) {
// Add build action, if coverage is recorded for each build
if (this.keepAll) {
- build.addAction(new HTMLBuildAction(build));
+ build.addAction(new HTMLBuildAction(build, this));
}
}
-
+
public Action getProjectAction(AbstractProject project) {
- return new HTMLAction(project);
+ return new HTMLAction(project, this);
}
}
\ No newline at end of file