Skip to content
Permalink
Browse files

Allow contained steps to participate in building the dependency graph

[FIXED JENKINS-12418]
  • Loading branch information
bap2000 committed Jan 17, 2012
1 parent 500bf06 commit ca9d155ed5930eecacea781b63d99afcaf18da26
@@ -31,6 +31,8 @@
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.model.DependecyDeclarer;
import hudson.model.DependencyGraph;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.model.Hudson;
@@ -45,7 +47,7 @@
import java.util.Collection;
import java.util.List;

public class ConditionalPublisher implements Describable<ConditionalPublisher> {
public class ConditionalPublisher implements Describable<ConditionalPublisher>, DependecyDeclarer {

private final RunCondition condition;
private final BuildStep publisher;
@@ -78,6 +80,11 @@ public ConditionalPublisherDescriptor getDescriptor() {
return publisher.getProjectActions(project);
}

public void buildDependencyGraph(final AbstractProject abstractProject, final DependencyGraph dependencyGraph) {
if (publisher instanceof DependecyDeclarer)
((DependecyDeclarer) publisher).buildDependencyGraph(abstractProject, dependencyGraph);
}

public boolean prebuild(final AbstractBuild<?, ?> build, final BuildListener listener) {
return runner.prebuild(condition, publisher, build, listener);
}
@@ -31,6 +31,8 @@
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
import hudson.model.DependecyDeclarer;
import hudson.model.DependencyGraph;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.model.Result;
@@ -49,7 +51,7 @@
import java.util.List;
import java.util.Set;

public class FlexiblePublisher extends Recorder {
public class FlexiblePublisher extends Recorder implements DependecyDeclarer {

public static final String PROMOTION_JOB_TYPE = "hudson.plugins.promoted_builds.PromotionProcess";

@@ -89,6 +91,11 @@ public boolean prebuild(final AbstractBuild<?, ?> build, final BuildListener lis
return true;
}

public void buildDependencyGraph(final AbstractProject abstractProject, final DependencyGraph dependencyGraph) {
for (ConditionalPublisher publisher : publishers)
publisher.buildDependencyGraph(abstractProject, dependencyGraph);
}

@Override
public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener)
throws InterruptedException, IOException {

0 comments on commit ca9d155

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