mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-29 20:45:20 +00:00
Merge branch 'master' into feature/add-deprecated-plugin-monitor
This commit is contained in:
commit
0dc475a1df
770 files changed
+9675
-5414
No files matched your search
@@ -36,6 +36,7 @@ import hudson.util.VersionNumber;
|
||||
import io.jenkins.lib.versionnumber.JavaSpecificationVersion;
|
||||
import jenkins.YesNoMaybe;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.security.UpdateSiteWarningsMonitor;
|
||||
import jenkins.util.java.JavaUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -50,8 +51,8 @@ import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
import org.kohsuke.stapler.interceptor.RequirePOST;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -226,7 +227,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* Set the list of components that depend on this plugin.
|
||||
* @param dependents The list of components that depend on this plugin.
|
||||
*/
|
||||
public void setDependents(@Nonnull Set<String> dependents) {
|
||||
public void setDependents(@NonNull Set<String> dependents) {
|
||||
this.dependents = dependents;
|
||||
}
|
||||
|
||||
@@ -234,7 +235,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @deprecated Please use {@link #setDependents}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDependants(@Nonnull Set<String> dependents) {
|
||||
public void setDependants(@NonNull Set<String> dependents) {
|
||||
setDependents(dependents);
|
||||
}
|
||||
|
||||
@@ -242,7 +243,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* Set the list of components that depend optionally on this plugin.
|
||||
* @param optionalDependents The list of components that depend optionally on this plugin.
|
||||
*/
|
||||
public void setOptionalDependents(@Nonnull Set<String> optionalDependents) {
|
||||
public void setOptionalDependents(@NonNull Set<String> optionalDependents) {
|
||||
this.optionalDependents = optionalDependents;
|
||||
}
|
||||
|
||||
@@ -250,7 +251,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @deprecated Please use {@link #setOptionalDependents}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setOptionalDependants(@Nonnull Set<String> optionalDependents) {
|
||||
public void setOptionalDependants(@NonNull Set<String> optionalDependents) {
|
||||
setOptionalDependents(dependents);
|
||||
}
|
||||
|
||||
@@ -259,7 +260,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* Note that the list will include elements of {@link #getOptionalDependents}.
|
||||
* @return The list of components that depend on this plugin.
|
||||
*/
|
||||
public @Nonnull Set<String> getDependents() {
|
||||
public @NonNull Set<String> getDependents() {
|
||||
if (isBundled && dependents.isEmpty()) {
|
||||
return CORE_ONLY_DEPENDANT;
|
||||
} else {
|
||||
@@ -271,7 +272,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @deprecated Please use {@link #getDependents}.
|
||||
*/
|
||||
@Deprecated
|
||||
public @Nonnull Set<String> getDependants() {
|
||||
public @NonNull Set<String> getDependants() {
|
||||
return getDependents();
|
||||
}
|
||||
|
||||
@@ -279,7 +280,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* Like {@link #getDependents} but excluding optional dependencies.
|
||||
* @since 2.181
|
||||
*/
|
||||
public @Nonnull Set<String> getMandatoryDependents() {
|
||||
public @NonNull Set<String> getMandatoryDependents() {
|
||||
Set<String> s = new HashSet<>(dependents);
|
||||
s.removeAll(optionalDependents);
|
||||
return s;
|
||||
@@ -288,7 +289,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
/**
|
||||
* @return The list of components that depend optionally on this plugin.
|
||||
*/
|
||||
public @Nonnull Set<String> getOptionalDependents() {
|
||||
public @NonNull Set<String> getOptionalDependents() {
|
||||
return optionalDependents;
|
||||
}
|
||||
|
||||
@@ -296,7 +297,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @deprecated Please use {@link #getOptionalDependents}.
|
||||
*/
|
||||
@Deprecated
|
||||
public @Nonnull Set<String> getOptionalDependants() {
|
||||
public @NonNull Set<String> getOptionalDependants() {
|
||||
return getOptionalDependents();
|
||||
}
|
||||
|
||||
@@ -448,7 +449,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
}
|
||||
|
||||
public Api getApi() {
|
||||
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
|
||||
Jenkins.get().checkAnyPermission(Jenkins.SYSTEM_READ, Jenkins.MANAGE);
|
||||
return new Api(this);
|
||||
}
|
||||
|
||||
@@ -715,7 +716,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
* @param strategy strategy to use
|
||||
* @return an object representing the result of the disablement of this plugin and its dependents plugins.
|
||||
*/
|
||||
public @Nonnull PluginDisableResult disable(@Nonnull PluginDisableStrategy strategy) {
|
||||
public @NonNull PluginDisableResult disable(@NonNull PluginDisableStrategy strategy) {
|
||||
PluginDisableResult result = new PluginDisableResult(shortName);
|
||||
|
||||
if (!this.isEnabled()) {
|
||||
@@ -963,7 +964,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
/**
|
||||
* Similar to {@code org.apache.maven.artifact.ArtifactUtils.isSnapshot}.
|
||||
*/
|
||||
static boolean isSnapshot(@Nonnull String version) {
|
||||
static boolean isSnapshot(@NonNull String version) {
|
||||
return version.contains("-SNAPSHOT") || version.matches(".+-[0-9]{8}.[0-9]{6}-[0-9]+");
|
||||
}
|
||||
|
||||
@@ -1034,6 +1035,21 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
return DetachedPluginsUtil.isDetachedPlugin(shortName);
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
public boolean hasImpliedDependents() {
|
||||
if (!isDetached()) {
|
||||
return false;
|
||||
}
|
||||
for (PluginWrapper p : Jenkins.get().getPluginManager().getPlugins()) {
|
||||
for (Dependency dependency : DetachedPluginsUtil.getImpliedDependencies(p.shortName, p.getRequiredCoreVersion())) {
|
||||
if (dependency.shortName.equals(shortName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort by short name.
|
||||
*/
|
||||
@@ -1272,6 +1288,10 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
|
||||
return HttpResponses.redirectViaContextPath("/pluginManager/installed"); // send back to plugin manager
|
||||
}
|
||||
|
||||
@Restricted(DoNotUse.class) // Jelly
|
||||
public List<UpdateSite.Warning> getActiveWarnings() {
|
||||
return ExtensionList.lookupSingleton(UpdateSiteWarningsMonitor.class).getActivePluginWarningsByPlugin().getOrDefault(this, Collections.emptyList());
|
||||
}
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(PluginWrapper.class.getName());
|
||||
|
||||
|
||||
Reference in new issue
Block a user