mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-29 12:35:19 +00:00
Rename to minimumJavaVersion to keep the name across tooling
Given this field is present in maven-hpi-plugin, update-center, etc. I think it does not hurt to keep the 'Minimum-Java-Version' name across various usages to help make it clear.
This commit is contained in:
1 parent
27c49bf0a1
commit
29de9aaef6
3 files changed
+16
-14
No files matched your search
@@ -496,13 +496,13 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the required Java version of this plugin.
|
||||
* @return the required Java version of this plugin.
|
||||
* Returns the minimumJava version of this plugin.
|
||||
* @return the minimum Java version of this plugin.
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
@Exported
|
||||
public @CheckForNull String getRequiredJavaVersion() {
|
||||
public @CheckForNull String getMinimumJavaVersion() {
|
||||
return manifest.getMainAttributes().getValue("Minimum-Java-Version");
|
||||
}
|
||||
|
||||
@@ -757,12 +757,12 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
}
|
||||
}
|
||||
|
||||
String requiredJavaVersion = getRequiredJavaVersion();
|
||||
if (requiredJavaVersion != null) {
|
||||
String minimumJavaVersion = getMinimumJavaVersion();
|
||||
if (minimumJavaVersion != null) {
|
||||
// TODO replace with calls to Runtime.version() once we're on Java 9+
|
||||
VersionNumber actualVersion = new VersionNumber(System.getProperty("java.specification.version"));
|
||||
if (actualVersion.isOlderThan(new VersionNumber(requiredJavaVersion))) {
|
||||
versionDependencyError(Messages.PluginWrapper_obsoleteJava(actualVersion.toString(), requiredJavaVersion), actualVersion.toString(), requiredJavaVersion);
|
||||
if (actualVersion.isOlderThan(new VersionNumber(minimumJavaVersion))) {
|
||||
versionDependencyError(Messages.PluginWrapper_obsoleteJava(actualVersion.toString(), minimumJavaVersion), actualVersion.toString(), minimumJavaVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ public class UpdateSite {
|
||||
* @since TODO
|
||||
*/
|
||||
@Exported
|
||||
public final String requiredJava;
|
||||
public final String minimumJavaVersion;
|
||||
/**
|
||||
* Categories for grouping plugins, taken from labels assigned to wiki page.
|
||||
* Can be null.
|
||||
@@ -1000,6 +1000,7 @@ public class UpdateSite {
|
||||
this.title = get(o,"title");
|
||||
this.excerpt = get(o,"excerpt");
|
||||
this.compatibleSinceVersion = Util.intern(get(o,"compatibleSinceVersion"));
|
||||
this.minimumJavaVersion = Util.intern(get(o, "minimumJavaVersion"));
|
||||
this.requiredCore = Util.intern(get(o,"requiredCore"));
|
||||
this.categories = o.has("labels") ? internInPlace((String[])o.getJSONArray("labels").toArray(EMPTY_STRING_ARRAY)) : null;
|
||||
JSONArray ja = o.getJSONArray("dependencies");
|
||||
@@ -1134,7 +1135,7 @@ public class UpdateSite {
|
||||
*/
|
||||
public boolean isForNewerJava() {
|
||||
try {
|
||||
return requiredJava != null && new VersionNumber(requiredJava).isNewerThan(
|
||||
return minimumJavaVersion != null && new VersionNumber(minimumJavaVersion).isNewerThan(
|
||||
new VersionNumber(System.getProperty("java.specification.version")));
|
||||
} catch (NumberFormatException nfe) {
|
||||
return false; // plugin doesn't declare a minimum Java version
|
||||
@@ -1162,15 +1163,16 @@ public class UpdateSite {
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public VersionNumber getNeededDependenciesRequiredJava() {
|
||||
@CheckForNull
|
||||
public VersionNumber getNeededDependenciesMinimumJavaVersion() {
|
||||
VersionNumber versionNumber = null;
|
||||
try {
|
||||
versionNumber = requiredJava == null ? null : new VersionNumber(requiredJava);
|
||||
versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion);
|
||||
} catch (NumberFormatException nfe) {
|
||||
// unable to parse version
|
||||
}
|
||||
for (Plugin p: getNeededDependencies()) {
|
||||
VersionNumber v = p.getNeededDependenciesRequiredJava();
|
||||
VersionNumber v = p.getNeededDependenciesMinimumJavaVersion();
|
||||
if (v == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ THE SOFTWARE.
|
||||
<div class="compatWarning">${%coreWarning(p.requiredCore)}</div>
|
||||
</j:if>
|
||||
<j:if test="${p.isForNewerJava()}">
|
||||
<div class="compatWarning">${%javaWarning(p.requiredJava)}</div>
|
||||
<div class="compatWarning">${%javaWarning(p.minimumJavaVersion)}</div>
|
||||
</j:if>
|
||||
<j:if test="${!p.isNeededDependenciesCompatibleWithInstalledVersion(cache)}">
|
||||
<div class="compatWarning">${%depCompatWarning}</div>
|
||||
@@ -117,7 +117,7 @@ THE SOFTWARE.
|
||||
<div class="compatWarning">${%depCoreWarning(p.getNeededDependenciesRequiredCore().toString())}</div>
|
||||
</j:if>
|
||||
<j:if test="${p.isNeededDependenciesForNewerJava()}">
|
||||
<div class="compatWarning">${%depJavaWarning(p.getNeededDependenciesRequiredJava().toString())}</div>
|
||||
<div class="compatWarning">${%depJavaWarning(p.getNeededDependenciesMinimumJavaVersion().toString())}</div>
|
||||
</j:if>
|
||||
<j:if test="${p.hasWarnings()}">
|
||||
<div class="securityWarning">${%securityWarning}
|
||||
|
||||
Reference in new issue
Block a user