Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More on JENKINS-1613
Originally-Committed-As: f10b5eb4cd2d1d1fd68f0c469f7a9a78e45c68a4
  • Loading branch information
wolfgarnet committed May 13, 2011
1 parent 16c70a2 commit 1b135d4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/matrix/MatrixBuild.java
Expand Up @@ -24,6 +24,7 @@
package hudson.matrix;

import hudson.Util;
import hudson.matrix.listeners.MatrixBuildListener;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
Expand Down Expand Up @@ -217,7 +218,7 @@ protected Result doRun(BuildListener listener) throws Exception {
Collection<MatrixConfiguration> touchStoneConfigurations = new HashSet<MatrixConfiguration>();
Collection<MatrixConfiguration> delayedConfigurations = new HashSet<MatrixConfiguration>();
for (MatrixConfiguration c: activeConfigurations) {
if (Math.random()<0.1) continue; // test skipping behaviour
if (!MatrixBuildListener.buildConfiguration(MatrixBuild.this, c)) continue;
if (touchStoneFilter != null && c.getCombination().evalGroovyExpression(p.getAxes(), p.getTouchStoneCombinationFilter())) {
touchStoneConfigurations.add(c);
} else {
Expand Down
@@ -0,0 +1,36 @@
package hudson.matrix.listeners;

import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.matrix.MatrixConfiguration;
import hudson.matrix.MatrixBuild;
import hudson.model.Hudson;

public abstract class MatrixBuildListener implements ExtensionPoint {

/**
* Determine whether to build a given configuration or not
* @param b
* @param c
* @return
*/
public boolean doBuildConfiguration(MatrixBuild b, MatrixConfiguration c){return true;}

public static boolean buildConfiguration(MatrixBuild b, MatrixConfiguration c) {
for (MatrixBuildListener l : all()) {
if(!l.doBuildConfiguration(b, c)) {
return false;
}

}

return true;
}

/**
* Returns all the registered {@link MatrixBuildListener} descriptors.
*/
public static ExtensionList<MatrixBuildListener> all() {
return Hudson.getInstance().getExtensionList(MatrixBuildListener.class);
}
}

0 comments on commit 1b135d4

Please sign in to comment.