Skip to content

Commit

Permalink
Allow contained steps to participate in building the dependency graph
Browse files Browse the repository at this point in the history
[FIXED JENKINS-12418]
  • Loading branch information
bap2000 committed Jan 17, 2012
1 parent 500bf06 commit ca9d155
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -78,6 +80,11 @@ public Collection<? extends Action> getProjectActions(final AbstractProject<?, ?
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);
}
Expand Down
Expand Up @@ -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;
Expand All @@ -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";

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ca9d155

Please sign in to comment.