Package com.google.gwt.dev.javac

Examples of com.google.gwt.dev.javac.StandardGeneratorContext$PendingResource


  }


  public static String getModuleName(final GeneratorContext context) {
    try {
      final StandardGeneratorContext standardGeneratorContext =
              (StandardGeneratorContext) context;
      final Field field = StandardGeneratorContext.class.getDeclaredField("module");
      field.setAccessible(true);
      final ModuleDef moduleDef = (ModuleDef) field.get(standardGeneratorContext);
      return moduleDef.getCanonicalName();
View Full Code Here


   * Returns the list of translatable packages in the module that caused the generator to run (the module under compilation).
   */
  public static Set<String> findTranslatablePackagesInModule(final GeneratorContext context) {
    final Set<String> packages = new HashSet<String>();
    try {
      final StandardGeneratorContext stdContext = (StandardGeneratorContext) context;
      final Field field = StandardGeneratorContext.class.getDeclaredField("module");
      field.setAccessible(true);
      final ModuleDef moduleDef = (ModuleDef) field.get(stdContext);

      // moduleName looks like "com.foo.xyz.MyModule" and we just want the package part
View Full Code Here

     * Try to determine the module package -- hackishly
     */
    //TODO: Find a more standard way to do this.
    try {
      if (context instanceof StandardGeneratorContext) {
        StandardGeneratorContext stdContext = (StandardGeneratorContext) context;
        Field field = StandardGeneratorContext.class.getDeclaredField("module");
        field.setAccessible(true);

        ModuleDef moduleDef = (ModuleDef) field.get(stdContext);

View Full Code Here

    // Set up the rebind oracle for the module.
    // It has to wait until now because we need to inject javascript.
    //
    Rules rules = module.getRules();
    StandardGeneratorContext genCtx = new StandardGeneratorContext(
        compilationState, module, genDir, shellDir, new ArtifactSet());
    rebindOracle = new StandardRebindOracle(propOracle, rules, genCtx);

    // Create a completely isolated class loader which owns all classes
    // associated with a particular module. This effectively builds a
View Full Code Here

    compilerContext = compilerContextBuilder.module(module).build();
    compilerContext.getOptions().setGenDir(new File(System.getProperty("java.io.tmpdir")));

    ArtifactSet allGenreatedArtifacts = new ArtifactSet();
    boolean isProd = false;
    StandardGeneratorContext context = new StandardGeneratorContext(
        compilerContext, module.getCompilationState(logger, compilerContext), allGenreatedArtifacts,
        isProd);
    return context;
  }
View Full Code Here

    } catch (UnableToCompleteException e) {
      throw new RuntimeException(e);
    }

    genCtx =
        new StandardGeneratorContext(compilerContext, mockCompilationState, artifactSet, false);
    genCtx.setPropertyOracle(mockPropOracle);
    genCtx.setCurrentGenerator(Generator.class);
  }
View Full Code Here

        "    }",
        "  }",
        "}");

    contextBuilder.add(simpleEnumTest);
    StandardGeneratorContext ctx =
        (StandardGeneratorContext) contextBuilder.buildGeneratorContext();
    assertNotNull(ctx.getTypeOracle().findType("test.Simple"));
    try {
      assertEquals("test.SimpleImpl",
          generator.generate(logger, contextBuilder.buildGeneratorContext(), "test.Simple"));
      fail("RequestContext is not annotated as a service");
    } catch (UnableToCompleteException expected) {
View Full Code Here

        "    }",
        "  }",
        "}");

    contextBuilder.add(simpleEnumTest);
    StandardGeneratorContext ctx =
        (StandardGeneratorContext) contextBuilder.buildGeneratorContext();
    assertNotNull(ctx.getTypeOracle().findType("test.Simple"));
    try {
      assertEquals("test.SimpleImpl", generator.generate(logger, ctx, "test.Simple"));
    } catch (UnableToCompleteException e) {
      throw new RuntimeException("Could not complete with errors:\n" + writer.toString());
    }
    assertNotNull(ctx.getGeneratedUnitMap().get("test.SimpleImpl"));
    String source = ctx.getGeneratedUnitMap().get("test.SimpleImpl").getSource();
    assertTrue(source.contains("@com.google.web.bindery.autobean.shared.impl.EnumMap.ExtraEnums("
        + "{test.Simple.SimpleContext.GetByIdRequest.GetByIdEnum.class})"));
  }
View Full Code Here

      Rules rules = module.getRules();
      PrecompileTaskOptionsImpl options = new PrecompileTaskOptionsImpl();
      options.setGenDir(genDir);
      CompilerContext compilerContext =
          new CompilerContext.Builder().module(module).options(options).build();
      StandardGeneratorContext genCtx =
          new StandardGeneratorContext(compilerContext, compilationState, new ArtifactSet(), false);

      // Only enable generator result caching if we have a valid rebindCache
      genCtx.setGeneratorResultCachingEnabled((rebindCache != null));

      rebindOracle = new StandardRebindOracle(propOracle, rules, genCtx);
      rebindOracle.setRebindCache(rebindCache);

      // Create a completely isolated class loader which owns all classes
View Full Code Here

    void buildPropertyProviderRegistrator(Set<String> allRootTypes,
        SortedSet<BindingProperty> bindingProperties,
        SortedSet<ConfigurationProperty> configurationProperties) throws UnableToCompleteException {
      PropertyProviderRegistratorGenerator propertyProviderRegistratorGenerator =
          new PropertyProviderRegistratorGenerator(bindingProperties, configurationProperties);
      StandardGeneratorContext generatorContext = getGeneratorContext();
      // Name based on module canonical name, to avoid collisions resulting from multiple modules
      // with the same rename.
      String propertyProviderRegistratorTypeName = propertyProviderRegistratorGenerator.generate(
          logger, generatorContext, module.getCanonicalName());
      // Ensures that unification traverses and keeps the class.
      allRootTypes.add(propertyProviderRegistratorTypeName);
      // Ensures that JProgram knows to index this class's methods so that later bootstrap
      // construction code is able to locate the FooPropertyProviderRegistrator.register() function.
      jprogram.addIndexedTypeName(propertyProviderRegistratorTypeName);
      jprogram.setPropertyProviderRegistratorTypeSourceName(propertyProviderRegistratorTypeName);
      generatorContext.finish(logger);
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.javac.StandardGeneratorContext$PendingResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.