Search in sources :

Example 1 with N4JSStandaloneSetup

use of org.eclipse.n4js.N4JSStandaloneSetup in project n4js by eclipse.

the class GrammarLinter method main.

/**
 */
public static void main(String[] args) {
    GrammarLinter linter = new N4JSStandaloneSetup().createInjectorAndDoEMFRegistration().getInstance(GrammarLinter.class);
    linter.typesGrammarAccess = new TypeExpressionsStandaloneSetup().createInjector().getInstance(TypeExpressionsGrammarAccess.class);
    linter.diagnose();
}
Also used : TypeExpressionsGrammarAccess(org.eclipse.n4js.ts.services.TypeExpressionsGrammarAccess) N4JSStandaloneSetup(org.eclipse.n4js.N4JSStandaloneSetup) TypeExpressionsStandaloneSetup(org.eclipse.n4js.ts.TypeExpressionsStandaloneSetup)

Example 2 with N4JSStandaloneSetup

use of org.eclipse.n4js.N4JSStandaloneSetup 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);
}
Also used : N4JSRuntimeModule(org.eclipse.n4js.N4JSRuntimeModule) ConfigurableHeadlessLogger(org.eclipse.n4js.generator.headless.logging.ConfigurableHeadlessLogger) Injector(com.google.inject.Injector) IHeadlessLogger(org.eclipse.n4js.generator.headless.logging.IHeadlessLogger) N4JSStandaloneSetup(org.eclipse.n4js.N4JSStandaloneSetup) TesterModule(org.eclipse.n4js.tester.TesterModule) N4JSHeadlessGeneratorModule(org.eclipse.n4js.generator.headless.N4JSHeadlessGeneratorModule) TestTreeTransformer(org.eclipse.n4js.tester.TestTreeTransformer) CliTestTreeTransformer(org.eclipse.n4js.tester.CliTestTreeTransformer) Module(com.google.inject.Module) TesterModule(org.eclipse.n4js.tester.TesterModule) N4JSRuntimeModule(org.eclipse.n4js.N4JSRuntimeModule) N4JSHeadlessGeneratorModule(org.eclipse.n4js.generator.headless.N4JSHeadlessGeneratorModule)

Aggregations

N4JSStandaloneSetup (org.eclipse.n4js.N4JSStandaloneSetup)2 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 N4JSRuntimeModule (org.eclipse.n4js.N4JSRuntimeModule)1 N4JSHeadlessGeneratorModule (org.eclipse.n4js.generator.headless.N4JSHeadlessGeneratorModule)1 ConfigurableHeadlessLogger (org.eclipse.n4js.generator.headless.logging.ConfigurableHeadlessLogger)1 IHeadlessLogger (org.eclipse.n4js.generator.headless.logging.IHeadlessLogger)1 CliTestTreeTransformer (org.eclipse.n4js.tester.CliTestTreeTransformer)1 TestTreeTransformer (org.eclipse.n4js.tester.TestTreeTransformer)1 TesterModule (org.eclipse.n4js.tester.TesterModule)1 TypeExpressionsStandaloneSetup (org.eclipse.n4js.ts.TypeExpressionsStandaloneSetup)1 TypeExpressionsGrammarAccess (org.eclipse.n4js.ts.services.TypeExpressionsGrammarAccess)1