mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
use plugin condition in backend
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.26</version>
|
||||
<configuration>
|
||||
<stopPort>8005</stopPort>
|
||||
<stopPort>8004</stopPort>
|
||||
<stopKey>STOP</stopKey>
|
||||
<source>${project.build.javaLevel}</source>
|
||||
<target>${project.build.javaLevel}</target>
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.plugin.rest;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.plugin.PluginCondition;
|
||||
import sonia.scm.plugin.PluginFilter;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
|
||||
@@ -81,8 +82,10 @@ public class DefaultPluginFilter implements PluginFilter
|
||||
@Override
|
||||
public boolean accept(PluginInformation plugin)
|
||||
{
|
||||
return snapshot
|
||||
||!plugin.getVersion().toUpperCase().contains(VERSION_SNAPSHOT);
|
||||
PluginCondition condition = plugin.getCondition();
|
||||
return ((condition != null) && condition.isSupported(version, os, arch))
|
||||
|| (condition == null) &&
|
||||
(snapshot || !plugin.getVersion().toUpperCase().contains(VERSION_SNAPSHOT));
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.plugin.Plugin;
|
||||
import sonia.scm.plugin.PluginBackend;
|
||||
import sonia.scm.plugin.PluginCondition;
|
||||
import sonia.scm.plugin.PluginException;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
@@ -158,6 +159,13 @@ public class DefaultPluginScanner implements PluginScanner
|
||||
if ((plugin != null) && (plugin.getInformation() != null)
|
||||
&& plugin.getInformation().isValid())
|
||||
{
|
||||
PluginCondition condition = plugin.getCondition();
|
||||
|
||||
if (condition != null)
|
||||
{
|
||||
plugin.getInformation().setCondition(condition);
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("add plugin {} to backend", file.getPath());
|
||||
|
||||
Reference in New Issue
Block a user