提交 bc94c238 编写于 作者: M mindless

Plugin manager now shows warning for upgrade/install of plugins

into a Hudson that is older than the plugin was built for.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@23634 71c3de6d-444a-0410-be80-ed276b4c234a
上级 f3a13715
......@@ -464,6 +464,10 @@ public class UpdateSite {
* Optional version # from which this plugin release is configuration-compatible.
*/
public final String compatibleSinceVersion;
/**
* Version of Hudson core this plugin was compiled against.
*/
public final String requiredCore;
@DataBoundConstructor
public Plugin(String sourceId, JSONObject o) {
......@@ -472,6 +476,7 @@ public class UpdateSite {
this.title = get(o,"title");
this.excerpt = get(o,"excerpt");
this.compatibleSinceVersion = get(o,"compatibleSinceVersion");
this.requiredCore = get(o,"requiredCore");
}
private String get(JSONObject o, String prop) {
......@@ -515,6 +520,10 @@ public class UpdateSite {
return true;
}
public boolean isForNewerHudson() {
return requiredCore!=null && new VersionNumber(requiredCore).isNewerThan(new VersionNumber(Hudson.VERSION));
}
/**
* @deprecated as of 1.326
* Use {@link #deploy()}.
......
......@@ -56,6 +56,9 @@ THE SOFTWARE.
<j:if test="${!p.isCompatibleWithInstalledVersion()}">
<div class="compatWarning">${%compatWarning}</div>
</j:if>
<j:if test="${p.isForNewerHudson()}">
<div class="compatWarning">${%coreWarning(p.coreVersion)}</div>
</j:if>
</td>
<td class="pane"><st:out value="${p.version}" /></td>
<j:if test="${attrs.page=='updates'}">
......
......@@ -21,4 +21,7 @@
# THE SOFTWARE.
compatWarning=\
Warning: New version not compatible with installed version. \
Jobs using this plugin may need to be reconfigured.
\ No newline at end of file
Jobs using this plugin may need to be reconfigured.
coreWarning=\
Warning: This plugin is built for Hudson {0} or newer. \
It may or may not work in your Hudson.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册