Skip to content

Commit

Permalink
Merge branch 'master' into keyboard-shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed May 13, 2022
2 parents 8d1112d + e128402 commit ea0e439
Show file tree
Hide file tree
Showing 46 changed files with 240 additions and 751 deletions.
29 changes: 2 additions & 27 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ THE SOFTWARE.
<properties>
<asm.version>9.3</asm.version>
<slf4jVersion>1.7.36</slf4jVersion>
<stapler.version>1669.v95a_4b_919a_b_a_2</stapler.version>
<stapler.version>1685.v3b_5035c4ce05</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand All @@ -56,7 +56,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.19</version>
<version>5.3.20</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -261,31 +261,6 @@ THE SOFTWARE.
<artifactId>instance-identity</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>launchd-slave-installer</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>slave-installer</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>systemd-slave-installer</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>upstart-slave-installer</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>windows-slave-installer</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
Expand Down
13 changes: 0 additions & 13 deletions core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1412,16 +1412,6 @@ public HttpResponse doPluginsSearch(@QueryParameter String query, @QueryParamete
if (plugin.isForNewerHudson()) {
jsonObject.put("newerCoreRequired", Messages.PluginManager_coreWarning(plugin.requiredCore));
}
if (plugin.isForNewerJava()) {
jsonObject.put("newerJavaRequired", Messages.PluginManager_javaWarning(plugin.minimumJavaVersion));
}
if (plugin.isNeededDependenciesForNewerJava()) {
VersionNumber javaVersion = plugin.getNeededDependenciesMinimumJavaVersion();
if (javaVersion == null) {
throw new IllegalStateException("java version cannot be null here");
}
jsonObject.put("dependenciesNewerJava", Messages.PluginManager_depJavaWarning(javaVersion.toString()));
}
if (plugin.hasWarnings()) {
JSONObject unresolvedSecurityWarnings = new JSONObject();
unresolvedSecurityWarnings.put("text", Messages.PluginManager_securityWarning());
Expand Down Expand Up @@ -2057,9 +2047,6 @@ private void logPluginWarnings(Map.Entry<String, VersionNumber> requestedPlugin,
if (toInstall.isForNewerHudson()) {
LOGGER.log(WARNING, "{0}@{1} was built for a newer Jenkins", new Object[] {toInstall.name, toInstall.version});
}
if (toInstall.isForNewerJava()) {
LOGGER.log(WARNING, "{0}@{1} was built for a newer Java", new Object[] {toInstall.name, toInstall.version});
}
}

/**
Expand Down
24 changes: 0 additions & 24 deletions core/src/main/java/hudson/PluginWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import hudson.model.UpdateCenter;
import hudson.model.UpdateSite;
import hudson.util.VersionNumber;
import io.jenkins.lib.versionnumber.JavaSpecificationVersion;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -75,7 +74,6 @@
import jenkins.security.UpdateSiteWarningsMonitor;
import jenkins.util.AntClassLoader;
import jenkins.util.URLClassLoader2;
import jenkins.util.java.JavaUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.LogFactory;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -690,20 +688,6 @@ private String getVersionOf(Manifest manifest) {
return null;
}

/**
* Returns the minimum Java version of this plugin, as specified in the plugin metadata.
* Generally coming from the {@code java.level} extracted as MANIFEST's metadata with
* <a href="https://github.com/jenkinsci/plugin-pom/pull/134">this addition on the plugins' parent pom</a>.
*
* @see <a href="https://github.com/jenkinsci/maven-hpi-plugin/pull/75">maven-hpi-plugin#PR-75</a>
*
* @since 2.158
*/
@Exported
public @CheckForNull String getMinimumJavaVersion() {
return manifest.getMainAttributes().getValue("Minimum-Java-Version");
}

/**
* Returns the version number of this plugin
*/
Expand Down Expand Up @@ -958,14 +942,6 @@ public boolean hasLicensesXml() {
versionDependencyError(Messages.PluginWrapper_obsoleteCore(Jenkins.getVersion().toString(), requiredCoreVersion), Jenkins.getVersion().toString(), requiredCoreVersion);
}
}

String minimumJavaVersion = getMinimumJavaVersion();
if (minimumJavaVersion != null) {
JavaSpecificationVersion actualVersion = JavaUtils.getCurrentJavaRuntimeVersionNumber();
if (actualVersion.isOlderThan(new JavaSpecificationVersion(minimumJavaVersion))) {
versionDependencyError(Messages.PluginWrapper_obsoleteJava(actualVersion.toString(), minimumJavaVersion), actualVersion.toString(), minimumJavaVersion);
}
}
}
// make sure dependencies exist
for (Dependency d : dependencies) {
Expand Down
73 changes: 2 additions & 71 deletions core/src/main/java/hudson/model/UpdateSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import hudson.util.HttpResponses;
import hudson.util.TextFile;
import hudson.util.VersionNumber;
import io.jenkins.lib.versionnumber.JavaSpecificationVersion;
import java.io.File;
import java.io.IOException;
import java.net.URI;
Expand Down Expand Up @@ -80,7 +79,6 @@
import jenkins.util.JSONSignatureValidator;
import jenkins.util.PluginLabelUtil;
import jenkins.util.SystemProperties;
import jenkins.util.java.JavaUtils;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
Expand Down Expand Up @@ -1141,13 +1139,6 @@ public final class Plugin extends Entry {
*/
@Exported
public final String requiredCore;
/**
* Version of Java this plugin requires to run.
*
* @since 2.158
*/
@Exported
public final String minimumJavaVersion;
/**
* Categories for grouping plugins, taken from labels assigned to wiki page.
* Can be {@code null} if the update center does not return categories.
Expand Down Expand Up @@ -1211,7 +1202,6 @@ public Plugin(String sourceId, JSONObject o) {
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.latest = get(o, "latest");
this.requiredCore = Util.intern(get(o, "requiredCore"));
final String releaseTimestamp = get(o, "releaseTimestamp");
Expand Down Expand Up @@ -1301,9 +1291,9 @@ public boolean isCompatible() {

@Restricted(NoExternalUse.class) // table.jelly
public boolean isCompatible(PluginManager.MetadataCache cache) {
return isCompatibleWithInstalledVersion() && !isForNewerHudson() && !isForNewerJava() &&
return isCompatibleWithInstalledVersion() && !isForNewerHudson() &&
isNeededDependenciesCompatibleWithInstalledVersion(cache) &&
!isNeededDependenciesForNewerJenkins(cache) && !isNeededDependenciesForNewerJava();
!isNeededDependenciesForNewerJenkins(cache);
}

/**
Expand Down Expand Up @@ -1387,21 +1377,6 @@ public boolean isForNewerHudson() {
}
}

/**
* Returns true iff the plugin declares a minimum Java version and it's newer than what the Jenkins master is running on.
* @since 2.158
*/
public boolean isForNewerJava() {
try {
final JavaSpecificationVersion currentRuntimeJavaVersion = JavaUtils.getCurrentJavaRuntimeVersionNumber();
return minimumJavaVersion != null && new JavaSpecificationVersion(minimumJavaVersion).isNewerThan(
currentRuntimeJavaVersion);
} catch (NumberFormatException nfe) {
logBadMinJavaVersion();
return false; // treat this as undeclared minimum Java version
}
}

public VersionNumber getNeededDependenciesRequiredCore() {
VersionNumber versionNumber = null;
try {
Expand All @@ -1416,36 +1391,6 @@ public VersionNumber getNeededDependenciesRequiredCore() {
return versionNumber;
}

/**
* Returns the minimum Java version needed to use the plugin and all its dependencies.
* @since 2.158
* @return the minimum Java version needed to use the plugin and all its dependencies, or null if unspecified.
*/
@CheckForNull
public VersionNumber getNeededDependenciesMinimumJavaVersion() {
VersionNumber versionNumber = null;
try {
versionNumber = minimumJavaVersion == null ? null : new VersionNumber(minimumJavaVersion);
} catch (NumberFormatException nfe) {
logBadMinJavaVersion();
}
for (Plugin p : getNeededDependencies()) {
VersionNumber v = p.getNeededDependenciesMinimumJavaVersion();
if (v == null) {
continue;
}
if (versionNumber == null || v.isNewerThan(versionNumber)) {
versionNumber = v;
}
}
return versionNumber;
}

private void logBadMinJavaVersion() {
LOGGER.log(Level.WARNING, "minimumJavaVersion was specified for plugin {0} but unparseable (received {1})",
new String[]{this.name, this.minimumJavaVersion});
}

public boolean isNeededDependenciesForNewerJenkins() {
return isNeededDependenciesForNewerJenkins(new PluginManager.MetadataCache());
}
Expand All @@ -1462,20 +1407,6 @@ public boolean isNeededDependenciesForNewerJenkins(PluginManager.MetadataCache c
});
}

/**
* Returns true iff any of the plugin dependencies require a newer Java than Jenkins is running on.
*
* @since 2.158
*/
public boolean isNeededDependenciesForNewerJava() {
for (Plugin p : getNeededDependencies()) {
if (p.isForNewerJava() || p.isNeededDependenciesForNewerJava()) {
return true;
}
}
return false;
}

/**
* If at least some of the plugin's needed dependencies are already installed, and the new version of the
* needed dependencies plugin have a "compatibleSinceVersion"
Expand Down
36 changes: 14 additions & 22 deletions core/src/main/java/hudson/slaves/JNLPLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import jenkins.model.Jenkins;
import jenkins.slaves.RemotingWorkDirSettings;
import jenkins.util.SystemProperties;
import jenkins.util.java.JavaUtils;
import jenkins.websocket.WebSockets;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -67,11 +66,10 @@ public class JNLPLauncher extends ComputerLauncher {
public final String tunnel;

/**
* Additional JVM arguments. Can be null.
* @since 1.297
* @deprecated No longer used.
*/
@CheckForNull
public final String vmargs;
@Deprecated
public final transient String vmargs = null;

@NonNull
private RemotingWorkDirSettings workDirSettings = RemotingWorkDirSettings.getEnabledDefaults();
Expand Down Expand Up @@ -103,10 +101,20 @@ public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs, @C
}
}

// TODO cannot easily make tunnel into a @DataBoundSetter because then the @DataBoundConstructor would be on a no-arg constructor
// which is already defined and deprecated. Could retroactively let no-arg constructor use default for workDirSettings,
// which would be a behavioral change only for callers of the Java constructor (unlikely).
@DataBoundConstructor
public JNLPLauncher(@CheckForNull String tunnel) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
}

/**
* @deprecated use {@link JNLPLauncher#JNLPLauncher(String)}
*/
@Deprecated
public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
this.vmargs = Util.fixEmptyAndTrim(vmargs);
}

/**
Expand Down Expand Up @@ -249,22 +257,6 @@ public FormValidation doCheckWebSocket(@QueryParameter boolean webSocket, @Query

}

/**
* Returns true if Java Web Start button should be displayed.
* Java Web Start is only supported when the Jenkins server is
* running with Java 8. Earlier Java versions are not supported by Jenkins.
* Later Java versions do not support Java Web Start.
*
* This flag is checked in {@code config.jelly} before displaying the
* Java Web Start button.
* @return {@code true} if Java Web Start button should be displayed.
* @since 2.153
*/
@Restricted(NoExternalUse.class) // Jelly use
public boolean isJavaWebStartSupported() {
return JavaUtils.isRunningWithJava8OrBelow();
}

/**
* Overrides the url that inbound TCP agents should connect to
* as advertised in the agent.jnlp file. If not set, the default
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/install/SetupWizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public JSONArray getPlatformPluginUpdates() {
for (UpdateSite site : jenkins.getUpdateCenter().getSiteList()) {
UpdateSite.Plugin sitePlug = site.getPlugin(pluginName);
if (sitePlug != null
&& !sitePlug.isForNewerHudson() && !sitePlug.isForNewerJava()
&& !sitePlug.isForNewerHudson()
&& !sitePlug.isNeededDependenciesForNewerJenkins()) {
foundCompatibleVersion = true;
break;
Expand Down
Loading

0 comments on commit ea0e439

Please sign in to comment.