Skip to content

Commit

Permalink
[JENKINS-47634] Move metadata about split plugins into a resource fil…
Browse files Browse the repository at this point in the history
…e so that plugin-compat-tester need not be manually synchronized.
  • Loading branch information
jglick committed Oct 25, 2017
1 parent bcbd5ba commit 1a399a1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 33 deletions.
58 changes: 25 additions & 33 deletions core/src/main/java/hudson/ClassicPluginStrategy.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -268,7 +267,7 @@ public static List<PluginWrapper.Dependency> getImpliedDependencies(String plugi
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;
}
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/resources/jenkins/split-plugin-cycles.txt
@@ -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
16 changes: 16 additions & 0 deletions core/src/main/resources/jenkins/split-plugins.txt
@@ -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.