import org.slf4j.LoggerFactory;
import org.sonar.api.CoreProperties;
import org.sonar.api.Plugin;
+import org.sonar.api.SonarPlugin;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.PluginMetadata;
import org.sonar.api.platform.PluginRepository;
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());
+ }
+ }
}
void doStart(List<RemotePlugin> remotePlugins) {
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.sonar.api.SonarPlugin;
+import org.sonar.api.platform.PluginMetadata;
import org.sonar.core.plugins.RemotePlugin;
import org.sonar.core.plugins.RemotePluginFile;
import org.sonar.home.cache.FileCache;
import java.io.File;
import java.io.IOException;
+import java.util.Collections;
import java.util.List;
+import java.util.Map;
/**
* A {@link PluginsReferential} implementation that put downloaded plugins in a FS cache.
}
}
+ @Override
+ public Map<PluginMetadata, SonarPlugin> localPlugins() {
+ return Collections.emptyMap();
+ }
+
}
*/
package org.sonar.batch.bootstrap;
+import org.sonar.api.SonarPlugin;
+import org.sonar.api.platform.PluginMetadata;
import org.sonar.core.plugins.RemotePlugin;
import java.io.File;
import java.util.List;
+import java.util.Map;
/**
* Plugin referential.
public interface PluginsReferential {
/**
- * Return list of plugins to be installed
+ * Return list of remote plugins to be installed
*/
List<RemotePlugin> pluginList();
*/
File pluginFile(RemotePlugin remote);
+ /**
+ * Return the list of local plugins to be installed
+ */
+ Map<PluginMetadata, SonarPlugin> localPlugins();
+
}
import javax.annotation.Nullable;
import java.io.Serializable;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
import static com.google.common.collect.Lists.newArrayList;
}
@CheckForNull
- public Long debtInMinutes(){
+ public Long debtInMinutes() {
return debt != null ? debt.toMinutes() : null;
}