diff --git a/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java b/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java index 10dff89..c8833ff 100644 --- a/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java +++ b/src/main/java/hudson/plugins/global_build_stats/business/GlobalBuildStatsBusiness.java @@ -34,6 +34,7 @@ import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; +import org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject; import com.cloudbees.hudson.plugins.folder.Folder; public class GlobalBuildStatsBusiness { @@ -96,15 +97,7 @@ public void changePluginStateBeforeSavingIt(GlobalBuildStatsPlugin plugin) { List jobBuildResultsRead = new ArrayList(); for (TopLevelItem item : Hudson.getInstance().getItems()) { - if (item instanceof Folder){ - Folder f = (Folder)item; - for (TopLevelItem i : f.getItems()){ - handleItem(jobBuildResultsRead,i); - } - } - if (item instanceof Job) { - handleItem(jobBuildResultsRead, item); - } + recursivelyAddBuilds(jobBuildResultsRead, item); } plugin.getJobBuildResultsSharder().queueResultsToAdd( @@ -112,11 +105,24 @@ public void changePluginStateBeforeSavingIt(GlobalBuildStatsPlugin plugin) { } }); } - - public void handleItem(List results, TopLevelItem item){ + + public void recursivelyAddBuilds(List results, TopLevelItem item){ if (item instanceof Job){ - addBuildsFrom(results, (Job)item); + addBuildsFrom(results, (Job) item); } + if (item instanceof Folder){ + Folder f = (Folder) item; + for (TopLevelItem i : f.getItems()){ + recursivelyAddBuilds(results, i); + } + } + + if (item instanceof WorkflowMultiBranchProject) { + WorkflowMultiBranchProject w = (WorkflowMultiBranchProject) item; + for (TopLevelItem i : w.getItems()) { + recursivelyAddBuilds(results, i); + } + } } public JFreeChart createChart(BuildStatConfiguration config){