Skip to content

Commit

Permalink
Merge pull request #1168 from jglick/Trigger-DependencyDeclarer-JENKI…
Browse files Browse the repository at this point in the history
…NS-22397

[JENKINS-22397] Allow a Trigger to be a DependencyDeclarer
  • Loading branch information
jglick committed Mar 28, 2014
2 parents f97b5b3 + 63ece76 commit 769bd81
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -63,6 +63,9 @@
<li class=bug>
<code>NoSuchMethodError: hudson.model.BuildAuthorizationToken.checkPermission(…)</code> from Build Token Root plugin since 1.556.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22382">issue 22382</a>)
<li class=rfe>
Allow a <code>Trigger</code> to be a <code>DependencyDeclarer</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22397">issue 22397</a>)
<li class=bug>
Fixed a slow down in resource loading caused by fix to JENKINS-18677.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-21579">issue 21579</a>)
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/matrix/MatrixProject.java
Expand Up @@ -802,7 +802,8 @@ public boolean isFingerprintConfigured() {
return false;
}

protected void buildDependencyGraph(DependencyGraph graph) {
@Override protected void buildDependencyGraph(DependencyGraph graph) {
super.buildDependencyGraph(graph);
publishers.buildDependencyGraph(this,graph);
builders.buildDependencyGraph(this,graph);
buildWrappers.buildDependencyGraph(this,graph);
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/hudson/model/AbstractProject.java
Expand Up @@ -1712,9 +1712,11 @@ private void checkAndRecord(AbstractProject that, TreeMap<Integer, RangeSet> r,

/**
* Builds the dependency graph.
* @see DependencyGraph
* Since 1.558, not abstract and by default includes dependencies contributed by {@link #triggers()}.
*/
protected abstract void buildDependencyGraph(DependencyGraph graph);
protected void buildDependencyGraph(DependencyGraph graph) {
triggers().buildDependencyGraph(this, graph);
}

@Override
protected SearchIndexBuilder makeSearchIndex() {
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/Project.java
Expand Up @@ -175,7 +175,8 @@ public Publisher getPublisher(Descriptor<Publisher> descriptor) {
return null;
}

protected void buildDependencyGraph(DependencyGraph graph) {
@Override protected void buildDependencyGraph(DependencyGraph graph) {
super.buildDependencyGraph(graph);
getPublishersList().buildDependencyGraph(this,graph);
getBuildersList().buildDependencyGraph(this,graph);
getBuildWrappersList().buildDependencyGraph(this,graph);
Expand Down
12 changes: 7 additions & 5 deletions core/src/main/java/jenkins/model/DependencyDeclarer.java
Expand Up @@ -25,18 +25,20 @@

import hudson.model.AbstractProject;
import hudson.model.DependencyGraph;
import hudson.tasks.BuildStep;
import hudson.tasks.BuildWrapper;
import hudson.tasks.Builder;
import hudson.tasks.Publisher;
import hudson.triggers.Trigger;
import hudson.util.DescribableList;

/**
* Marker interface for those {@link BuildStep}s that can participate
* Marker interface for project-associated objects that can participate
* in the dependency graph computation process.
*
* <p>
* {@link Publisher}s, {@link Builder}s, and {@link hudson.model.JobProperty}s
* can additional implement this method to add additional edges
* to the dependency graph computation.
* {@link Publisher}s, {@link Builder}s, {@link BuildWrapper}s, and {@link Trigger}s
* (or whatever {@link DescribableList#buildDependencyGraph} is called on, by {@link AbstractProject#buildDependencyGraph})
* can implement this interface to add additional edges to the dependency graph.
*
* @author Nicolas Lalevee
* @author Martin Ficker
Expand Down

0 comments on commit 769bd81

Please sign in to comment.