]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10689 Plugins are now always installed
authorEric Hartmann <hartmann.eric@gmail.com>
Thu, 24 May 2018 07:02:29 +0000 (09:02 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 12 Jun 2018 18:20:59 +0000 (20:20 +0200)
The bundled plugins have been removed

server/sonar-ce/src/test/java/org/sonar/ce/container/CePluginJarExploderTest.java
server/sonar-server/src/main/java/org/sonar/server/platform/ServerFileSystem.java
server/sonar-server/src/main/java/org/sonar/server/platform/ServerFileSystemImpl.java
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
server/sonar-server/src/test/java/org/sonar/server/plugins/ServerPluginRepositoryTest.java
sonar-application/build.gradle

index a5828ba8c780bf9c6ef8803f733afc91a38045ee..6f961fc73325b9657baee5f3271f277ff3c12dc8 100644 (file)
@@ -134,11 +134,6 @@ public class CePluginJarExploderTest {
       throw new UnsupportedOperationException();
     }
 
-    @Override
-    public File getBundledPluginsDir() {
-      throw new UnsupportedOperationException();
-    }
-
     @Override
     public File getPluginIndex() {
       throw new UnsupportedOperationException();
index 17524356cc2b6c9534f002dbf8135d415589e2cc..350a1c367871eb29a0fd53dcdc73300ae2f43a1e 100644 (file)
@@ -71,13 +71,6 @@ public interface ServerFileSystem {
    */
   File getInstalledPluginsDir();
 
-  /**
-   * Directory of the plugins packaged by default with application. These
-   * plugins are installed during the first fresh startup.
-   * @return a directory which may or not exist
-   */
-  File getBundledPluginsDir();
-
   /**
    * The file listing all the installed plugins. Used by scanner only.
    * @return an existing file
index 6764f85b804ab69894a8208fd70c616c9db96d9a..d7f982ad4f129be0d8a411037bad220a4a00154f 100644 (file)
@@ -95,11 +95,6 @@ public class ServerFileSystemImpl implements ServerFileSystem, org.sonar.api.pla
     return new File(getHomeDir(), "extensions/plugins");
   }
 
-  @Override
-  public File getBundledPluginsDir() {
-    return new File(getHomeDir(), "lib/bundled-plugins");
-  }
-
   @Override
   public File getPluginIndex() {
     return new File(deployDir, "plugins/index.txt");
index 0be17a3958dd5702981c9757ae65d5423fba474c..ef7faf3c594dd20b4b8d3c48c48a359b4fc13f9e 100644 (file)
@@ -61,7 +61,6 @@ import static org.sonar.core.util.FileUtils.deleteQuietly;
 /**
  * Entry point to install and load plugins on server startup. It manages
  * <ul>
- *   <li>installation of bundled plugins on first server startup</li>
  *   <li>installation of new plugins (effective after server startup)</li>
  *   <li>un-installation of plugins (effective after server startup)</li>
  *   <li>cancel pending installations/un-installations</li>
@@ -106,7 +105,6 @@ public class ServerPluginRepository implements PluginRepository, Startable {
   @Override
   public void start() {
     loadPreInstalledPlugins();
-    copyBundledPlugins();
     moveDownloadedPlugins();
     moveDownloadedEditionPlugins();
     unloadIncompatiblePlugins();
@@ -163,23 +161,6 @@ public class ServerPluginRepository implements PluginRepository, Startable {
     }
   }
 
-  /**
-   * Copies the plugins bundled with SonarQube distribution to directory extensions/plugins.
-   * Does nothing if not a fresh installation.
-   */
-  private void copyBundledPlugins() {
-    if (upgradeStatus.isFreshInstall()) {
-      for (File sourceFile : listJarFiles(fs.getBundledPluginsDir())) {
-        PluginInfo info = PluginInfo.create(sourceFile);
-        // lib/bundled-plugins should be copied only if the plugin is not already
-        // available in extensions/plugins
-        if (!pluginInfosByKeys.containsKey(info.getKey())) {
-          overrideAndRegisterPlugin(sourceFile, false);
-        }
-      }
-    }
-  }
-
   private void registerPluginInfo(PluginInfo info) {
     String pluginKey = info.getKey();
     if (blacklistedPluginKeys.contains(pluginKey)) {
index 432dd6496ebe6dcd3c26194e4ae29def10bd5151..69dd7856b9cebd6462b8aac2237c9545ea5188e4 100644 (file)
@@ -66,7 +66,6 @@ public class ServerPluginRepositoryTest {
 
   @Before
   public void setUp() throws IOException {
-    when(fs.getBundledPluginsDir()).thenReturn(temp.newFolder());
     when(fs.getDeployedPluginsDir()).thenReturn(temp.newFolder());
     when(fs.getDownloadedPluginsDir()).thenReturn(temp.newFolder());
     when(fs.getHomeDir()).thenReturn(temp.newFolder());
@@ -80,30 +79,6 @@ public class ServerPluginRepositoryTest {
     underTest.stop();
   }
 
-  /**
-   * The first server startup (fresh db) installs bundled plugins and instantiates bundled plugins.
-   */
-  @Test
-  public void first_startup_installs_bundled_plugins() throws Exception {
-    copyTestPluginTo("test-base-plugin", fs.getBundledPluginsDir());
-    when(upgradeStatus.isFreshInstall()).thenReturn(true);
-
-    underTest.start();
-
-    // both plugins are installed
-    assertThat(underTest.getPluginInfosByKeys()).containsOnlyKeys("testbase");
-  }
-
-  @Test
-  public void bundled_plugins_are_not_installed_if_not_fresh_server() throws Exception {
-    copyTestPluginTo("test-base-plugin", fs.getBundledPluginsDir());
-    when(upgradeStatus.isFreshInstall()).thenReturn(false);
-
-    underTest.start();
-
-    assertThat(underTest.getPluginInfos()).isEmpty();
-  }
-
   @Test
   public void standard_startup_loads_installed_plugins() throws Exception {
     copyTestPluginTo("test-base-plugin", fs.getInstalledPluginsDir());
index 0ad23e38625d349bc9fcf8ac4575fecd389ade56..49653ff181e67c88f055ce45c3b2301a55f2cbc7 100644 (file)
@@ -63,7 +63,6 @@ dependencies {
   testCompile 'junit:junit'
   testCompile 'org.assertj:assertj-core'
   testCompile 'org.mockito:mockito-core'
-
 }
 
 jar {
@@ -94,7 +93,7 @@ task zip(type: Zip) {
   into("${archiveDir}/lib/") {
     from jar
   }
-  into("${archiveDir}/lib/bundled-plugins/") {
+  into("${archiveDir}/extensions/plugins/") {
     from configurations.bundledPlugin
   }
   into("${archiveDir}/lib/jsw/") {