Support for loading Guice modules from /lib

Gerrit already has "pluggable" features that need to be installed
at the early stages of the bootstrap phase and cannot be "unplugged"
as plugins do.

Attendees at the recent hackathon in Mountain View decided to
call this new entities "LibModules", and configure them in the
gerrit.config as follows:

  [gerrit]
    installModule = com.googlesource.gerrit.libmodule.MyModule
    installModule = com.example.abc.OurSpecialSauceModule

Change-Id: Id8bf1a2e88b14c8e9125f20cb10a041d47799100
This commit is contained in:
Luca Milanesio
2016-11-15 10:22:38 -08:00
committed by Shawn Pearce
parent 8e5418db0a
commit 62cc3503b9
4 changed files with 85 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ import com.google.gerrit.lifecycle.LifecycleModule;
import com.google.gerrit.lucene.LuceneIndexModule;
import com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker;
import com.google.gerrit.pgm.util.LogFileCompressor;
import com.google.gerrit.server.LibModuleLoader;
import com.google.gerrit.server.account.InternalAccountDirectory;
import com.google.gerrit.server.cache.h2.DefaultCacheFactory;
import com.google.gerrit.server.change.ChangeCleanupRunner;
@@ -339,6 +340,7 @@ public class WebAppInitializer extends GuiceServletContextListener
});
modules.add(new GarbageCollectionModule());
modules.add(new ChangeCleanupRunner.Module());
modules.addAll(LibModuleLoader.loadModules(cfgInjector));
return cfgInjector.createChildInjector(modules);
}