Skip to content

Commit

Permalink
[FIXED JENKINS-14669] Compatibility with hierarchical projects (folde…
Browse files Browse the repository at this point in the history
…rs).
  • Loading branch information
jglick committed Aug 2, 2012
1 parent 5bc1c3c commit 76f2f5f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.403</version>
<version>1.424.3</version>
</parent>

<groupId>org.jvnet.hudson.plugins</groupId>
Expand Down
Expand Up @@ -49,7 +49,7 @@ public DownstreamBuildViewAction(AbstractBuild<?, ?> build) {
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
addDownstreamBuilds(project.getName(),0);
addDownstreamBuilds(project.getFullName(),0);
}
rootURL = Hudson.getInstance().getRootUrl();
}
Expand All @@ -59,14 +59,14 @@ private List<DownstreamBuilds> findDownstream(List<AbstractProject> childs, int
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
DownstreamBuilds downstreamBuild = new DownstreamBuilds();
downstreamBuild.setProjectName(project.getName());
downstreamBuild.setProjectName(project.getFullName());
downstreamBuild.setProjectUrl(project.getUrl());
AbstractProject upproject = Hudson.getInstance().getItemByFullName(upProjectName, AbstractProject.class);
if(upBuildNumber!= 0){
AbstractBuild upBuild = (AbstractBuild)upproject.getBuildByNumber(upBuildNumber);
if(upBuild != null){
for (DownstreamBuildViewAction action : upBuild.getActions(DownstreamBuildViewAction.class)) {
downstreamBuild.setBuildNumber(action.getDownstreamBuildNumber(project.getName()));
downstreamBuild.setBuildNumber(action.getDownstreamBuildNumber(project.getFullName()));
}
}else {
downstreamBuild.setBuildNumber(0);
Expand All @@ -84,7 +84,7 @@ private List<DownstreamBuilds> findDownstream(List<AbstractProject> childs, int
downstreamBuild.setChildNumber(childs.size());
List<AbstractProject> childProjects = project.getDownstreamProjects();
if (!childProjects.isEmpty()) {
downstreamBuild.setChilds(findDownstream(childProjects,depth + 1, parentChildSize,project.getName(),downstreamBuild.getBuildNumber()));
downstreamBuild.setChilds(findDownstream(childProjects,depth + 1, parentChildSize,project.getFullName(),downstreamBuild.getBuildNumber()));
}
childList.add(downstreamBuild);
}
Expand Down Expand Up @@ -218,7 +218,7 @@ public String getRootURL() {

public List<DownstreamBuilds> getDownstreamBuildList() {
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getFullName(),build.getNumber());
return downstreamBuildList;
}

Expand Down
Expand Up @@ -85,7 +85,7 @@ public void onStarted(AbstractBuild r,TaskListener listener) {
AbstractBuild upBuild = (AbstractBuild)project.getBuildByNumber(buildNumber);
build = upBuild;
for (DownstreamBuildViewAction action : upBuild.getActions(DownstreamBuildViewAction.class)) {
action.addDownstreamBuilds(r.getProject().getName(),r.getNumber());
action.addDownstreamBuilds(r.getProject().getFullName(),r.getNumber());
}
super.onFinalized(build);
save();
Expand Down

0 comments on commit 76f2f5f

Please sign in to comment.