Permalink
Browse files

extending this to BuildWrapper

  • Loading branch information...
1 parent 13aed4c commit 15e30703946b509d9c65974f3d87a82b5ba74ea7 @kohsuke kohsuke committed Aug 3, 2011
@@ -24,13 +24,14 @@
package hudson.matrix;
import hudson.model.JobProperty;
+import hudson.tasks.BuildWrapper;
import hudson.tasks.Publisher;
import hudson.ExtensionPoint;
import hudson.Launcher;
import hudson.model.BuildListener;
/**
- * {@link Publisher} and {@link JobProperty} can optionally implement this interface
+ * {@link Publisher}, {@link JobProperty}, {@link BuildWrapper} can optionally implement this interface
* to perform result aggregation across {@link MatrixRun}.
*
* <p>
@@ -236,24 +236,9 @@ protected Result doRun(BuildListener listener) throws Exception {
PrintStream logger = listener.getLogger();
// list up aggregators
- for (Publisher pub : p.getPublishers().values()) {
- if (pub instanceof MatrixAggregatable) {
- MatrixAggregatable ma = (MatrixAggregatable) pub;
- MatrixAggregator a = ma.createAggregator(MatrixBuild.this, launcher, listener);
- if(a!=null)
- aggregators.add(a);
- }
- }
-
- //let properties do their job
- for (JobProperty prop : p.getProperties().values()) {
- if (prop instanceof MatrixAggregatable) {
- MatrixAggregatable ma = (MatrixAggregatable) prop;
- MatrixAggregator a = ma.createAggregator(MatrixBuild.this, launcher, listener);
- if(a!=null)
- aggregators.add(a);
- }
- }
+ listUpAggregators(listener, p.getPublishers().values());
+ listUpAggregators(listener, p.getProperties().values());
+ listUpAggregators(listener, p.getBuildWrappers().values());
axes = p.getAxes();
Collection<MatrixConfiguration> activeConfigurations = p.getActiveConfigurations();
@@ -333,7 +318,18 @@ protected Result doRun(BuildListener listener) throws Exception {
}
}
}
-
+
+ private void listUpAggregators(BuildListener listener, Collection<?> values) {
+ for (Object v : values) {
+ if (v instanceof MatrixAggregatable) {
+ MatrixAggregatable ma = (MatrixAggregatable) v;
+ MatrixAggregator a = ma.createAggregator(MatrixBuild.this, launcher, listener);
+ if(a!=null)
+ aggregators.add(a);
+ }
+ }
+ }
+
private Result waitForCompletion(BuildListener listener, MatrixConfiguration c) throws InterruptedException, IOException, AggregatorFailureException {
String whyInQueue = "";
long startTime = System.currentTimeMillis();

0 comments on commit 15e3070

Please sign in to comment.