public void start() { LOG.info("Install plugins"); doStart(pluginsReferential.pluginList()); Map<PluginMetadata, SonarPlugin> localPlugins = pluginsReferential.localPlugins(); if (!localPlugins.isEmpty()) { LOG.info("Install local plugins"); for (Map.Entry<PluginMetadata, SonarPlugin> pluginByMetadata : localPlugins.entrySet()) { metadataByKey.put(pluginByMetadata.getKey().getKey(), pluginByMetadata.getKey()); pluginsByKey.put(pluginByMetadata.getKey().getKey(), pluginByMetadata.getValue()); } } }
public void declareExtension(@Nullable PluginMetadata plugin, Object extension) { propertyDefinitions.addComponent(extension, plugin != null ? plugin.getName() : ""); }
void doStart(List<RemotePlugin> remotePlugins) { PluginFilter filter = new PluginFilter(settings, analysisMode); metadataByKey = Maps.newHashMap(); for (RemotePlugin remote : remotePlugins) { if (filter.accepts(remote.getKey())) { File pluginFile = pluginsReferential.pluginFile(remote); PluginMetadata metadata = pluginInstaller.installToCache(pluginFile, remote.isCore()); if (StringUtils.isBlank(metadata.getBasePlugin()) || filter.accepts(metadata.getBasePlugin())) { metadataByKey.put(metadata.getKey(), metadata); } else { LOG.debug("Excluded plugin: " + metadata.getKey()); } } } classLoaders = new PluginClassloaders(Thread.currentThread().getContextClassLoader()); pluginsByKey = classLoaders.init(metadataByKey.values()); }