Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,35 @@ public String getUrlName() {
return null;
}

/** Offer a fallback Rebuild link if Replay is not permitted? */
/* accessible to Jelly */ public boolean isRebuildEnabled() {
if (!run.hasPermission(Item.BUILD)) {
return false;
}
if (!run.getParent().isBuildable()) {
return false;
}
if (Jenkins.get().getPlugin("rebuild") != null) {
// Go via reflection to avoid a pom.xml (and subsequent
// Jenkins controller) dependency on the "competing" plugin:
try {
Class<?> abstractRebuildAction = Jenkins.get()
.getPluginManager()
.uberClassLoader
.loadClass("com.sonyericsson.rebuild.AbstractRebuildAction");
if ((Boolean)
abstractRebuildAction.getMethod("isRebuildAvailable").invoke(null)) {
// THAT plugin will handle the Rebuild link better
// (parameterized if need be), so we here should
// show nothing at all
return false;
}
} catch (ClassNotFoundException e) {
// ignore
} catch (Exception e) {
LOGGER.log(Level.WARNING, "failed to check for rebuild-plugin", e);
}
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@
</f:form>
</j:when>
<j:otherwise>
<h1>${%Rebuild(it.owner.displayName)}</h1>
<p>
<j:out value="${%blurb.rebuild}"/>
</p>
<f:form action="rebuild" method="POST" name="rebuild">
<f:bottomButtonBar>
<f:submit value="${%Run}"/>
</f:bottomButtonBar>
</f:form>
<j:when test="${it.rebuildEnabled}">
<h1>${%Rebuild(it.owner.displayName)}</h1>
<p>
<j:out value="${%blurb.rebuild}"/>
</p>
<f:form action="rebuild" method="POST" name="rebuild">
<f:bottomButtonBar>
<f:submit value="${%Run}"/>
</f:bottomButtonBar>
</f:form>
</j:when>
</j:otherwise>
</j:choose>
</j:if>
Expand Down
Loading