Skip to content
Permalink
Browse files

[JENKINS-47634] Move metadata about split plugins into a resource fil…

…e so that plugin-compat-tester need not be manually synchronized.
  • Loading branch information
jglick committed Oct 25, 2017
1 parent bcbd5ba commit 1a399a1c9efb4702d1bd1ada0824487e78365eab
@@ -23,6 +23,8 @@
*/
package hudson;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
@@ -58,20 +60,17 @@

import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
@@ -268,7 +267,7 @@ private static void fix(Attributes atts, List<PluginWrapper.Dependency> optional
if (detached.shortName.equals(pluginName)) {
continue;
}
if (BREAK_CYCLES.contains(pluginName + '/' + detached.shortName)) {
if (BREAK_CYCLES.contains(pluginName + ' ' + detached.shortName)) {
LOGGER.log(Level.FINE, "skipping implicit dependency {0} → {1}", new Object[] {pluginName, detached.shortName});
continue;
}
@@ -410,36 +409,29 @@ public VersionNumber getRequiredVersion() {
}
}

private static final List<DetachedPlugin> DETACHED_LIST = Collections.unmodifiableList(Arrays.asList(
new DetachedPlugin("maven-plugin", "1.296", "1.296"),
new DetachedPlugin("subversion", "1.310", "1.0"),
new DetachedPlugin("cvs", "1.340", "0.1"),
new DetachedPlugin("ant", "1.430.*", "1.0"),
new DetachedPlugin("javadoc", "1.430.*", "1.0"),
new DetachedPlugin("external-monitor-job", "1.467.*", "1.0"),
new DetachedPlugin("ldap", "1.467.*", "1.0"),
new DetachedPlugin("pam-auth", "1.467.*", "1.0"),
new DetachedPlugin("mailer", "1.493.*", "1.2"),
new DetachedPlugin("matrix-auth", "1.535.*", "1.0.2"),
new DetachedPlugin("windows-slaves", "1.547.*", "1.0"),
new DetachedPlugin("antisamy-markup-formatter", "1.553.*", "1.0"),
new DetachedPlugin("matrix-project", "1.561.*", "1.0"),
new DetachedPlugin("junit", "1.577.*", "1.0"),
new DetachedPlugin("bouncycastle-api", "2.16.*", "2.16.0"),
new DetachedPlugin("command-launcher", "2.86.*", "1.0")
));
/** Record of which plugins which removed from core and when. */
private static final List<DetachedPlugin> DETACHED_LIST;

/** Implicit dependencies that are known to be unnecessary and which must be cut out to prevent a dependency cycle among bundled plugins. */
private static final Set<String> BREAK_CYCLES = new HashSet<String>(Arrays.asList(
"script-security/matrix-auth",
"script-security/windows-slaves",
"script-security/antisamy-markup-formatter",
"script-security/matrix-project",
"script-security/bouncycastle-api",
"script-security/command-launcher",
"credentials/matrix-auth",
"credentials/windows-slaves"
));
private static final Set<String> BREAK_CYCLES;

static {
List<DetachedPlugin> detached = new ArrayList<>();
try (InputStream is = ClassicPluginStrategy.class.getResourceAsStream("/jenkins/split-plugins.txt")) {
for (String line : org.apache.commons.io.IOUtils.readLines(is, StandardCharsets.UTF_8)) {
String[] pieces = line.split(" ");
detached.add(new DetachedPlugin(pieces[0], pieces[1] + ".*", pieces[2]));
}
} catch (IOException x) {
throw new ExceptionInInitializerError(x);
}
DETACHED_LIST = ImmutableList.copyOf(detached);
try (InputStream is = ClassicPluginStrategy.class.getResourceAsStream("/jenkins/split-plugin-cycles.txt")) {
BREAK_CYCLES = ImmutableSet.copyOf(org.apache.commons.io.IOUtils.readLines(is, StandardCharsets.UTF_8));
} catch (IOException x) {
throw new ExceptionInInitializerError(x);
}
}

/**
* Computes the classloader that takes the class masking into account.
@@ -0,0 +1,8 @@
credentials matrix-auth
credentials windows-slaves
script-security antisamy-markup-formatter
script-security bouncycastle-api
script-security command-launcher
script-security matrix-auth
script-security matrix-project
script-security windows-slaves
@@ -0,0 +1,16 @@
maven-plugin 1.296 1.296
subversion 1.310 1.0
cvs 1.340 0.1
ant 1.430 1.0
javadoc 1.430 1.0
external-monitor-job 1.467 1.0
ldap 1.467 1.0
pam-auth 1.467 1.0
mailer 1.493 1.2
matrix-auth 1.535 1.0.2
windows-slaves 1.547 1.0
antisamy-markup-formatter 1.553 1.0
matrix-project 1.561 1.0
junit 1.577 1.0
bouncycastle-api 2.16 2.16.0
command-launcher 2.86 1.0

0 comments on commit 1a399a1

Please sign in to comment.