Skip to content
Permalink
Browse files

[FIXED JENKINS-8478] Based on xbeumala, thomasfox, mattakis and gauth…

…ierde pull requests
  • Loading branch information...
Eric Nielsen
Eric Nielsen committed Nov 5, 2013
1 parent 3899ab7 commit fc4ee19e52441de19eaa2cfd8efb8f648f03bbb7
@@ -7,8 +7,6 @@

import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Build;
import hudson.model.Project;
import hudson.model.Run;
import hudson.util.ChartUtil;
import hudson.util.ShiftedCategoryAxis;
@@ -92,7 +90,7 @@
* to the project is needed to retrieve and save the CSV file
* that is stored in the project's root directory.
*/
private transient AbstractProject project;
private transient AbstractProject<?, ?> project;

/** All plots share the same JFreeChart drawing supplier object. */
private static final DrawingSupplier supplier = new DefaultDrawingSupplier(
@@ -371,7 +369,7 @@ private int getHeight() {
*
* @param project the project
*/
public void setProject(Project project) {
public void setProject(AbstractProject<?, ?> project) {
this.project = project;
}

@@ -443,7 +441,7 @@ public void plotGraphMap(StaplerRequest req, StaplerResponse rsp)
* @param build
* @param logger
*/
public void addBuild(Build build, PrintStream logger) {
public void addBuild(AbstractBuild<?, ?> build, PrintStream logger) {
if (project == null) project = build.getProject();

// load the existing plot data from disk
@@ -4,8 +4,8 @@
*/
package hudson.plugins.plot;

import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Project;

import java.io.IOException;
import java.util.logging.Logger;
@@ -22,15 +22,15 @@
public class PlotAction implements Action, StaplerProxy {

private static final Logger LOGGER = Logger.getLogger(PlotAction.class.getName());
private final Project project;
private final AbstractProject<?, ?> project;
private final PlotPublisher publisher;

public PlotAction(Project project, PlotPublisher publisher) {
public PlotAction(AbstractProject<?, ?> project, PlotPublisher publisher) {
this.project = project;
this.publisher = publisher;
}

public Project getProject() {
public AbstractProject<?, ?> getProject() {
return project;
}

@@ -8,12 +8,11 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
import hudson.matrix.MatrixProject;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Build;
import hudson.model.BuildListener;
import hudson.model.Project;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Publisher;
@@ -64,7 +63,7 @@ private Object readResolve() {
/**
* Converts a URL friendly plot group name to the original group name.
* If the given urlGroup doesn't already exist then the empty string will
* be returned.
* be returned.
*/
public String urlGroupToOriginalGroup(String urlGroup) {
if (urlGroup == null || "nogroup".equals(urlGroup)) {
@@ -108,7 +107,7 @@ private String originalGroupToUrlGroup(String originalGroup) {

/**
* Replaces the plots managed by this object with the given list.
*
*
* @param plots the new list of plots
*/
public void setPlots(Plot[] plots) {
@@ -120,8 +119,8 @@ public void setPlots(Plot[] plots) {
}

/**
* Adds the new plot to the plot data structures managed by this object.
*
* Adds the new plot to the plot data structures managed by this object.
*
* @param plot the new plot
*/
public void addPlot(Plot plot) {
@@ -163,7 +162,7 @@ public void addPlot(Plot plot) {
*/
@Override
public Action getProjectAction(AbstractProject<?, ?> project) {
return project instanceof Project ? new PlotAction((Project) project, this) : null;
return new PlotAction(project, this);
}

public BuildStepMonitor getRequiredMonitorService() {
@@ -184,14 +183,10 @@ public BuildStepMonitor getRequiredMonitorService() {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
BuildListener listener) throws IOException, InterruptedException {
// Should always be a Build due to isApplicable below
if (!(build instanceof Build)) {
return true;
}
listener.getLogger().println("Recording plot data");
// add the build to each plot
for (Plot plot : getPlots()) {
plot.addBuild((Build) build, listener.getLogger());
plot.addBuild(build, listener.getLogger());
}
// misconfigured plots will not fail a build so always return true
return true;
@@ -211,7 +206,8 @@ public String getDisplayName() {

@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return Project.class.isAssignableFrom(jobType);
return AbstractProject.class.isAssignableFrom(jobType)
&& !MatrixProject.class.isAssignableFrom(jobType);
}

/**
@@ -235,7 +231,7 @@ private static Plot bindPlot(JSONObject data, StaplerRequest req) {
/**
* Checks if the series file is valid.
*/
public FormValidation doCheckSeriesFile(@AncestorInPath AbstractProject project,
public FormValidation doCheckSeriesFile(@AncestorInPath AbstractProject<?, ?> project,
@QueryParameter String value) throws IOException {
return FilePath.validateFileMask(project.getSomeWorkspace(), value);
}
@@ -4,7 +4,7 @@
*/
package hudson.plugins.plot;

import hudson.model.Project;
import hudson.model.AbstractProject;

import java.io.File;
import java.io.FileReader;
@@ -28,7 +28,7 @@
public class PlotReport {
private static final Logger LOGGER = Logger.getLogger(PlotReport.class.getName());

private final Project project;
private final AbstractProject<?, ?> project;

/**
* The sorted list of plots that belong to the same group.
@@ -40,15 +40,15 @@
*/
private String group;

public PlotReport(Project project, String group, Plot[] plots) {
public PlotReport(AbstractProject<?, ?> project, String group, Plot[] plots) {
Arrays.sort(plots);
this.plots = plots;
this.group = group;
this.project = project;
}

// called from PlotReport/index.jelly
public Project getProject() {
public AbstractProject<?, ?> getProject() {
return project;
}

0 comments on commit fc4ee19

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