提交 455cd8ea 编写于 作者: K kohsuke

expanding the maven module set build page and added links to the corresponding module builds.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2192 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e36e0e06
......@@ -19,6 +19,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.LinkedHashMap;
/**
* {@link Build} for {@link MavenModuleSet}.
......@@ -53,6 +55,37 @@ public final class MavenModuleSetBuild extends AbstractBuild<MavenModuleSet,Mave
return null;
}
/**
* Computes the module builds that correspond to this build.
* <p>
* A module may be built multiple times (by the user action),
* so the value is a list.
*/
public Map<MavenModule,List<MavenBuild>> getModuleBuilds() {
Collection<MavenModule> mods = getParent().getModules();
// identify the build number range. [start,end)
int start = getNumber();
int end;
MavenModuleSetBuild nb = getNextBuild();
end = nb!=null ? nb.getNumber() : Integer.MAX_VALUE;
// preserve the order by using LinkedHashMap
Map<MavenModule,List<MavenBuild>> r = new LinkedHashMap<MavenModule,List<MavenBuild>>(mods.size());
for (MavenModule m : mods) {
List<MavenBuild> builds = new ArrayList<MavenBuild>();
MavenBuild b = m.getNearestBuild(start);
while(b!=null && b.getNumber()<end) {
builds.add(b);
b = b.getNextBuild();
}
r.put(m,builds);
}
return r;
}
public void run() {
run(new RunnerImpl());
}
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<h2>Module Builds</h2>
<j:set var="builds" value="${it.moduleBuilds}" />
<ul>
<j:forEach var="m" items="${builds}">
<li>
<a href="${rootURL}/${m.key.url}">${m.key.displayName}</a>
<j:forEach var="b" items="${m.value}">
<t:buildLink job="${m.key}" number="${b.number}" />
</j:forEach>
</li>
</j:forEach>
</ul>
</j:jelly>
\ No newline at end of file
......@@ -96,6 +96,7 @@
</t:summary>
</table>
<st:include page="main.jelly" optional="true" />
<!-- upstream/downstream builds -->
<j:set var="upstream" value="${it.upstreamBuilds}" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册