use of org.eclipse.n4js.N4JSRuntimeModule in project n4js by eclipse.
the class N4jscBase method initInjection.
/**
* Creates the injector for the test and injects all fields with the initialized injector.
*/
private void initInjection(Properties properties) {
// STEP 1: set up language N4JS
// the following is doing roughly the same as N4JSStandaloneSetup.doSetup(), but is using a custom-built
// Guice module for injector creation:
TypesPackage.eINSTANCE.getNsURI();
TypeRefsPackage.eINSTANCE.getNsURI();
N4JSPackage.eINSTANCE.getNsURI();
N4mfPackage.eINSTANCE.getNsURI();
XMLTypePackage.eINSTANCE.getNsURI();
// combine all modules for N4JSC
final Module combinedModule = Modules.combine(new N4JSRuntimeModule(), new TesterModule(), new N4JSHeadlessGeneratorModule(properties));
// override with customized bindings
final Module overridenModule = Modules.override(combinedModule).with(binder -> {
binder.bind(TestTreeTransformer.class).to(CliTestTreeTransformer.class);
binder.bind(IHeadlessLogger.class).toInstance(new ConfigurableHeadlessLogger(verbose, debug));
});
RegularExpressionStandaloneSetup.doSetup();
TypesStandaloneSetup.doSetup();
N4MFStandaloneSetup.doSetup();
TypeExpressionsStandaloneSetup.doSetup();
final Injector injector = Guice.createInjector(overridenModule);
new N4JSStandaloneSetup().register(injector);
injector.injectMembers(this);
}
Aggregations