From 6e4b335bd2fce514bf71c8d4c6ab8092393fee2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Galland?= Date: Tue, 24 Jul 2018 17:28:02 +0200 Subject: [PATCH] [sarlc] All the modules are loaded through then Bootique dynamic loading feature. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Galland --- .../io/sarl/lang/sarlc/BootiqueSarlcMain.java | 25 +------------------ .../services/io.bootique.BQModuleProvider | 9 +++++++ 2 files changed, 10 insertions(+), 24 deletions(-) create mode 100644 products/sarlc/src/main/resources/META-INF/services/io.bootique.BQModuleProvider diff --git a/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java b/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java index c933212d54..f9e5cc7a0f 100644 --- a/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java +++ b/products/sarlc/src/main/java/io/sarl/lang/sarlc/BootiqueSarlcMain.java @@ -35,15 +35,6 @@ import org.apache.log4j.Logger; import io.sarl.lang.SARLStandaloneSetup; -import io.sarl.lang.sarlc.modules.commands.CompilerCommandModuleProvider; -import io.sarl.lang.sarlc.modules.commands.VersionCommandModuleProvider; -import io.sarl.lang.sarlc.modules.configs.CompilerConfigModuleProvider; -import io.sarl.lang.sarlc.modules.configs.SarlcConfigModuleProvider; -import io.sarl.lang.sarlc.modules.configs.ValidatorConfigModuleProvider; -import io.sarl.lang.sarlc.modules.general.SARLRuntimeModuleProvider; -import io.sarl.lang.sarlc.modules.general.SarlBatchCompilerModuleProvider; -import io.sarl.lang.sarlc.modules.general.SarlcApplicationModuleProvider; -import io.sarl.lang.sarlc.modules.general.SarlcDefaultCommandModuleProvider; /** Class that implements the standard main function for running a SARL application * with bootique modules. @@ -64,21 +55,7 @@ public class BootiqueSarlcMain { @SuppressWarnings("static-method") protected BQRuntime createRuntime(String... args) { SARLStandaloneSetup.doPreSetup(); - Bootique bootique = Bootique.app(args); - // Configuration modules - bootique.module(new SarlcConfigModuleProvider()) - .module(new CompilerConfigModuleProvider()) - .module(new ValidatorConfigModuleProvider()); - // Command modules - bootique.module(new VersionCommandModuleProvider()) - .module(new CompilerCommandModuleProvider()); - // Core modules - bootique.module(new SARLRuntimeModuleProvider()) - .module(new SarlBatchCompilerModuleProvider()) - .module(new SarlcDefaultCommandModuleProvider()) - .module(new SarlcApplicationModuleProvider()); - bootique = bootique.autoLoadModules(); - final BQRuntime runtime = bootique.createRuntime(); + final BQRuntime runtime = Bootique.app(args).autoLoadModules().createRuntime(); SARLStandaloneSetup.doPostSetup(runtime.getInstance(Injector.class)); return runtime; } diff --git a/products/sarlc/src/main/resources/META-INF/services/io.bootique.BQModuleProvider b/products/sarlc/src/main/resources/META-INF/services/io.bootique.BQModuleProvider new file mode 100644 index 0000000000..1119879148 --- /dev/null +++ b/products/sarlc/src/main/resources/META-INF/services/io.bootique.BQModuleProvider @@ -0,0 +1,9 @@ +io.sarl.lang.sarlc.modules.configs.SarlcConfigModuleProvider +io.sarl.lang.sarlc.modules.configs.CompilerConfigModuleProvider +io.sarl.lang.sarlc.modules.configs.ValidatorConfigModuleProvider +io.sarl.lang.sarlc.modules.commands.VersionCommandModuleProvider +io.sarl.lang.sarlc.modules.commands.CompilerCommandModuleProvider +io.sarl.lang.sarlc.modules.general.SARLRuntimeModuleProvider +io.sarl.lang.sarlc.modules.general.SarlBatchCompilerModuleProvider +io.sarl.lang.sarlc.modules.general.SarlcDefaultCommandModuleProvider +io.sarl.lang.sarlc.modules.general.SarlcApplicationModuleProvider