提交 78c709e9 编写于 作者: A Andrew Bayer

[JENKINS-8985] BuildTrigger modification to handle DependencyGroups.

Pull individual Dependencys out of DependencyGroups we see in
BuildTrigger.execute and make sure to actually kick those builds off
as well, so that we can have two different dependencies (say, for
different parameters) from one upstream project to a single downstream
project.
上级 1e9720dc
......@@ -63,6 +63,9 @@ Upcoming changes</a>
<li class=bug>
Fix unescaped apostrophe in French translation.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-9699">issue 9699</a>)
<li class=bug>
Allow building multiple downstream dependencies on a single job via DependencyGraph and BuildTrigger.
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-8985">issue 8985</a>)
<li class=rfe>
Set NODE_NAME for master node to "master"
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-9671">issue 9671</a>)
......
......@@ -478,7 +478,7 @@ public final class DependencyGraph implements Comparator<AbstractProject> {
/**
* Collect multiple dependencies between the same two projects.
*/
private static class DependencyGroup extends Dependency {
public static class DependencyGroup extends Dependency {
private Set<Dependency> group = new LinkedHashSet<Dependency>();
DependencyGroup(Dependency first) {
......@@ -486,10 +486,14 @@ public final class DependencyGraph implements Comparator<AbstractProject> {
group.add(first);
}
void add(Dependency next) {
private void add(Dependency next) {
group.add(next);
}
public Set<Dependency> getGroup() {
return group;
}
@Override
public boolean shouldTriggerBuild(AbstractBuild build, TaskListener listener,
List<Action> actions) {
......
......@@ -201,7 +201,19 @@ public class BuildTrigger extends Recorder implements DependecyDeclarer {
}
});
List<Dependency> depsToBuild = new ArrayList<Dependency>();
for (Dependency dep : downstreamProjects) {
if (dep instanceof DependencyGraph.DependencyGroup) {
for (Dependency d : ((DependencyGraph.DependencyGroup)dep).getGroup()) {
depsToBuild.add(d);
}
}
else {
depsToBuild.add(dep);
}
}
for (Dependency dep : depsToBuild) {
AbstractProject p = dep.getDownstreamProject();
if (p.isDisabled()) {
logger.println(Messages.BuildTrigger_Disabled(p.getName()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册