Skip to content

Commit

Permalink
[JENKINS-21486] Fix :ant from daniel and separate failed plugin from
Browse files Browse the repository at this point in the history
missing
  • Loading branch information
Vlatombe committed Jul 29, 2016
1 parent b8f26b3 commit 99fa5f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
22 changes: 17 additions & 5 deletions core/src/main/java/hudson/PluginWrapper.java
Expand Up @@ -58,9 +58,11 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
Expand Down Expand Up @@ -247,7 +249,7 @@ public Dependency(String s) {

@Override
public String toString() {
return shortName + " (" + version + ") " + (optional ? "optional" : "");
return shortName + " (" + version + ")" + (optional ? " optional" : "");
}
}

Expand Down Expand Up @@ -572,7 +574,13 @@ public boolean hasLicensesXml() {
for (Dependency d : dependencies) {
PluginWrapper dependency = parent.getPlugin(d.shortName);
if (dependency == null) {
dependencyErrors.add(Messages.PluginWrapper_missing(d.shortName, d.version));
PluginWrapper failedDependency = NOTICE.getPlugin(d.shortName);
if (failedDependency != null) {
dependencyErrors.add(Messages.PluginWrapper_failed_to_load(failedDependency.getLongName(), d.version));
break;
} else {
dependencyErrors.add(Messages.PluginWrapper_missing(d.shortName, d.version));
}
} else {
if (dependency.isActive()) {
if (isDependencyObsolete(d, dependency)) {
Expand Down Expand Up @@ -730,18 +738,22 @@ public boolean isPinningForcingOldVersion() {
* Administrative Monitor for failed plugins
*/
public static final class PluginWrapperAdministrativeMonitor extends AdministrativeMonitor {
private final Set<PluginWrapper> plugins = new HashSet<>();
private final Map<String, PluginWrapper> plugins = new HashMap<>();

void addPlugin(PluginWrapper plugin) {
plugins.add(plugin);
plugins.put(plugin.shortName, plugin);
}

public boolean isActivated() {
return !plugins.isEmpty();
}

public Collection<PluginWrapper> getPlugins() {
return plugins;
return plugins.values();
}

public PluginWrapper getPlugin(String shortName) {
return plugins.get(shortName);
}

/**
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/hudson/Messages.properties
Expand Up @@ -74,6 +74,7 @@ ProxyConfiguration.Success=Success
Functions.NoExceptionDetails=No Exception details

PluginWrapper.missing=Plugin "{0}" ({1}) is missing. To fix, install version {1} or later.
PluginWrapper.failed_to_load=Plugin "{0}" ({1}) failed to load. Fix this plugin first.
PluginWrapper.disabledAndObsolete=Plugin "{0}" ({1}) is disabled and older than required. To fix, install version {2} or later and enable it.
PluginWrapper.disabled=Plugin "{0}" is disabled. To fix, enable it.
PluginWrapper.obsolete=Plugin "{0}" ({1}) is older than required. To fix, install version {2} or later.
Expand Down

0 comments on commit 99fa5f7

Please sign in to comment.