mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-03 15:15:54 +00:00
[JENKINS-55681] - Make JAXB a detached plugin only on Java 11 (#3865)
* Move detached plugins logic into a dedicated class ClassicPluginStrategy is already long enough, so trying to make things a bit more focused before adding Java 11 logic. (and even if not, the change still splits a class that is almost 1k lines). * Install jaxb as detached only on Java 11+ * Remove duplicate @Restricted Given the enclosing class already has it. * Use 1.5 release * Add more test coverage * getMinJavaVersion => getMinimumJavaVersion * Rename DetachedPluginsManager as DetachedPluginsUtil as requested by Oleg and Jesse. Mainly because of the misleading relationship (there's no inheritance) with the existing `PluginManager` class. * 🤦 adjust to 1.5 release method renaming * Clarify minimum Java version column Co-Authored-By: batmat <bmathus@gmail.com> * Update to 2.3.0 version of the jaxb plugin * Bump minimum core version to next expected release version * Add preventive cycle breaks for jaxb while waiting for JENKINS-28942 As requested by Oleg. * Add test to fail fast on wrong format for split-plugins.txt
This commit is contained in:
1 parent
8ab5ab57e2
commit
a78312ea0f
11 files changed
+369
-202
No files matched your search
@@ -62,6 +62,7 @@ import jenkins.YesNoMaybe;
|
||||
import jenkins.install.InstallState;
|
||||
import jenkins.install.InstallUtil;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.plugins.DetachedPluginsUtil;
|
||||
import jenkins.security.CustomClassFilter;
|
||||
import jenkins.util.SystemProperties;
|
||||
import jenkins.util.io.OnMaster;
|
||||
@@ -725,7 +726,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
LOGGER.log(INFO, "Upgrading Jenkins. The last running version was {0}. This Jenkins is version {1}.",
|
||||
new Object[] {lastExecVersion, Jenkins.VERSION});
|
||||
|
||||
final List<ClassicPluginStrategy.DetachedPlugin> detachedPlugins = ClassicPluginStrategy.getDetachedPlugins(lastExecVersion);
|
||||
final List<DetachedPluginsUtil.DetachedPlugin> detachedPlugins = DetachedPluginsUtil.getDetachedPlugins(lastExecVersion);
|
||||
|
||||
Set<String> loadedDetached = loadPluginsFromWar("/WEB-INF/detached-plugins", new FilenameFilter() {
|
||||
@Override
|
||||
@@ -734,7 +735,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
// If this was a plugin that was detached some time in the past i.e. not just one of the
|
||||
// plugins that was bundled "for fun".
|
||||
if (ClassicPluginStrategy.isDetachedPlugin(name)) {
|
||||
if (DetachedPluginsUtil.isDetachedPlugin(name)) {
|
||||
VersionNumber installedVersion = getPluginVersion(rootDir, name);
|
||||
VersionNumber bundledVersion = getPluginVersion(dir, name);
|
||||
// If the plugin is already installed, we need to decide whether to replace it with the bundled version.
|
||||
@@ -747,7 +748,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
}
|
||||
|
||||
// If it's a plugin that was detached since the last running version.
|
||||
for (ClassicPluginStrategy.DetachedPlugin detachedPlugin : detachedPlugins) {
|
||||
for (DetachedPluginsUtil.DetachedPlugin detachedPlugin : detachedPlugins) {
|
||||
if (detachedPlugin.getShortName().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
@@ -763,9 +764,9 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
InstallUtil.saveLastExecVersion();
|
||||
} else {
|
||||
final Set<ClassicPluginStrategy.DetachedPlugin> forceUpgrade = new HashSet<>();
|
||||
final Set<DetachedPluginsUtil.DetachedPlugin> forceUpgrade = new HashSet<>();
|
||||
// TODO using getDetachedPlugins here seems wrong; should be forcing an upgrade when the installed version is older than that in WEB-INF/detached-plugins/
|
||||
for (ClassicPluginStrategy.DetachedPlugin p : ClassicPluginStrategy.getDetachedPlugins()) {
|
||||
for (DetachedPluginsUtil.DetachedPlugin p : DetachedPluginsUtil.getDetachedPlugins()) {
|
||||
VersionNumber installedVersion = getPluginVersion(rootDir, p.getShortName());
|
||||
VersionNumber requiredVersion = p.getRequiredVersion();
|
||||
if (installedVersion != null && installedVersion.isOlderThan(requiredVersion)) {
|
||||
@@ -780,7 +781,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
name = normalisePluginName(name);
|
||||
for (ClassicPluginStrategy.DetachedPlugin detachedPlugin : forceUpgrade) {
|
||||
for (DetachedPluginsUtil.DetachedPlugin detachedPlugin : forceUpgrade) {
|
||||
if (detachedPlugin.getShortName().equals(name)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user