From bc94c23868817f6c9a3bb27f61f71166659686fe Mon Sep 17 00:00:00 2001 From: mindless Date: Tue, 10 Nov 2009 20:30:51 +0000 Subject: [PATCH] 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 --- core/src/main/java/hudson/model/UpdateSite.java | 9 +++++++++ core/src/main/resources/hudson/PluginManager/table.jelly | 3 +++ .../main/resources/hudson/PluginManager/table.properties | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java index a38a696c85..ae43bfea50 100644 --- a/core/src/main/java/hudson/model/UpdateSite.java +++ b/core/src/main/java/hudson/model/UpdateSite.java @@ -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()}. diff --git a/core/src/main/resources/hudson/PluginManager/table.jelly b/core/src/main/resources/hudson/PluginManager/table.jelly index 33017c5582..94e17ed9d1 100644 --- a/core/src/main/resources/hudson/PluginManager/table.jelly +++ b/core/src/main/resources/hudson/PluginManager/table.jelly @@ -56,6 +56,9 @@ THE SOFTWARE.
${%compatWarning}
+ +
${%coreWarning(p.coreVersion)}
+
diff --git a/core/src/main/resources/hudson/PluginManager/table.properties b/core/src/main/resources/hudson/PluginManager/table.properties index b57dcb3b66..43748a65a9 100644 --- a/core/src/main/resources/hudson/PluginManager/table.properties +++ b/core/src/main/resources/hudson/PluginManager/table.properties @@ -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. -- GitLab