Package com.google.gwt.dev

Examples of com.google.gwt.dev.MinimalRebuildCache


    CompilerOptions runOptions = new CompilerOptionsImpl(compileDir, newModuleName, options);
    compilerContext = compilerContextBuilder.options(runOptions).build();

    // Looks up the matching rebuild cache using the final set of overridden binding properties.
    MinimalRebuildCache knownGoodMinimalRebuildCache =
        getKnownGoodMinimalRebuildCache(bindingProperties);
    job.setCompileStrategy(knownGoodMinimalRebuildCache.isPopulated() ? CompileStrategy.INCREMENTAL
        : CompileStrategy.FULL);

    // Takes care to transactionally replace the saved cache only after a successful compile.
    MinimalRebuildCache mutableMinimalRebuildCache = new MinimalRebuildCache();
    mutableMinimalRebuildCache.copyFrom(knownGoodMinimalRebuildCache);
    boolean success =
        new Compiler(runOptions, mutableMinimalRebuildCache).run(compileLogger, module);
    if (success) {
      publishedCompileDir = compileDir;
      lastBuildInput = input;
View Full Code Here


      Map<String, String> bindingProperties) {
    if (!options.isIncrementalCompileEnabled()) {
      return new NullRebuildCache();
    }

    MinimalRebuildCache minimalRebuildCache =
        minimalRebuildCacheForProperties.get(bindingProperties);
    if (minimalRebuildCache == null) {
      minimalRebuildCache = new MinimalRebuildCache();
      minimalRebuildCacheForProperties.put(bindingProperties, minimalRebuildCache);
    }
    return minimalRebuildCache;
  }
View Full Code Here

  }

  public void testBuildLocalRuntimeRebindRules() throws UnableToCompleteException {
    // Sets up environment.
    Set<String> allRootTypes = Sets.newHashSet();
    compiler.jprogram = new JProgram(new MinimalRebuildCache());
    Map<String, String> runtimeRebindRuleSourcesByShortName =
        RuntimeRebindRuleGenerator.RUNTIME_REBIND_RULE_SOURCES_BY_SHORT_NAME;
    Rules rules = new Rules();
    RuleFail ruleFail = new RuleFail();
    ruleFail.getRootCondition().getConditions().add(new ConditionWhenPropertyIs("foo", "bar"));
View Full Code Here

    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Vanilla");
    flavorProperty.addTargetLibraryDefinedValue(flavorProperty.getRootCondition(), "Chocolate");
    ConfigurationProperty emulateStackProperty =
        properties.createConfiguration("emulateStack", false);
    emulateStackProperty.setValue("TRUE");
    compiler.jprogram = new JProgram(new MinimalRebuildCache());

    // Builds property provider classes and a property provider registrator to register them.
    precompiler.buildPropertyProviderRegistrator(allRootTypes,
        Sets.newTreeSet(Lists.newArrayList(userAgentProperty, flavorProperty)),
        Sets.newTreeSet(Lists.newArrayList(emulateStackProperty)));
View Full Code Here

    appendStatement(sb, srb, smb, "<epilogue>\n");
    appendStatement(sb, srb, smb, "<Some Bootstrap Code>\n");
    appendStatement(sb, srb, smb, "</epilogue>\n");
    String originalJs = sb.toString();

    MinimalRebuildCache minimalRebuildCache = new MinimalRebuildCache();

    // Create type inheritance.
    Map<String, String> superClassesByClass =
        minimalRebuildCache.getImmediateTypeRelations().getImmediateSuperclassesByClass();
    superClassesByClass.put("java.lang.Class", "java.lang.Object");
    superClassesByClass.put("com.some.app.SomeAModel", "java.lang.Object");
    superClassesByClass.put("com.some.app.SomeBModel", "java.lang.Object");
    superClassesByClass.put("com.some.app.SomeController", "java.lang.Object");
    superClassesByClass.put("com.some.app.EntryPoint", "java.lang.Object");

    // Record root types.
    minimalRebuildCache.setRootTypeNames(Lists.newArrayList("com.some.app.EntryPoint"));

    // Record type references.
    minimalRebuildCache.addTypeReference("com.some.app.EntryPoint",
        "com.some.app.SomeController");
    minimalRebuildCache.addTypeReference("com.some.app.SomeController",
        "com.some.app.SomeBModel");
    minimalRebuildCache.addTypeReference("com.some.app.SomeController",
        "com.some.app.SomeAModel");

    JsTypeLinker jsTypeLinker = new JsTypeLinker(TreeLogger.NULL,
        new JsNoopTransformer(originalJs, srb.build(), smb.build()), classRanges, programRange,
        minimalRebuildCache, new JTypeOracle(null, minimalRebuildCache, true));

    // Run the JS Type Linker.
    jsTypeLinker.exec();

    // Verify that the linker output all the expected classes and sorted them alphabetically.
    assertEquals("<preamble>\n<java.lang.Object />\n<java.lang.Class />\n</preamble>\n"
        + "<com.some.app.EntryPoint>\n" + "<com.some.app.SomeModelA>\n"
        + "<com.some.app.SomeModelB>\n" + "<com.some.app.SomeController>\n"
        + "<epilogue>\n<Some Bootstrap Code>\n</epilogue>\n", jsTypeLinker.getJs());
    assertEquals(Lists.newArrayList("preamble", "java.lang.Object", "java.lang.Class", "/preamble",
        "com.some.app.EntryPoint", "com.some.app.SomeModelA", "com.some.app.SomeModelB",
        "com.some.app.SomeController", "epilogue", "Some Bootstrap Code", "/epilogue"),
        getTypeNames(jsTypeLinker.getSourceInfoMap()));
    assertEquals(11, jsTypeLinker.getSourceInfoMap().getLines());

    // Make SomeModelB the super class of SomeModelA and then verify that B comes out before A.
    superClassesByClass.put("com.some.app.SomeAModel", "com.some.app.SomeBModel");
    jsTypeLinker = new JsTypeLinker(TreeLogger.NULL,
        new JsNoopTransformer(originalJs, srb.build(), smb.build()), classRanges, programRange,
        minimalRebuildCache, new JTypeOracle(null, minimalRebuildCache, true));
    jsTypeLinker.exec();
    assertEquals("<preamble>\n<java.lang.Object />\n<java.lang.Class />\n</preamble>\n"
        + "<com.some.app.EntryPoint>\n" + "<com.some.app.SomeModelB>\n"
        + "<com.some.app.SomeModelA>\n" + "<com.some.app.SomeController>\n"
        + "<epilogue>\n<Some Bootstrap Code>\n</epilogue>\n", jsTypeLinker.getJs());
    assertEquals(Lists.newArrayList("preamble", "java.lang.Object", "java.lang.Class", "/preamble",
        "com.some.app.EntryPoint", "com.some.app.SomeModelB", "com.some.app.SomeModelA",
        "com.some.app.SomeController", "epilogue", "Some Bootstrap Code", "/epilogue"),
        getTypeNames(jsTypeLinker.getSourceInfoMap()));
    assertEquals(11, jsTypeLinker.getSourceInfoMap().getLines());

    // Stop referring to SomeModelA from the Controller and verify that SomeModelA is not in the
    // output.
    minimalRebuildCache.removeReferencesFrom("com.some.app.SomeController");
    minimalRebuildCache.addTypeReference("com.some.app.SomeController",
        "com.some.app.SomeBModel");
    jsTypeLinker = new JsTypeLinker(TreeLogger.NULL,
        new JsNoopTransformer(originalJs, srb.build(), smb.build()), classRanges, programRange,
        minimalRebuildCache, new JTypeOracle(null, minimalRebuildCache, true));
    jsTypeLinker.exec();
View Full Code Here

    Assert.assertTrue(program.typeOracle.isSuperClass(sub1_2, baseAll));
  }

  public void testTypeRelationsBeforeRecompute() {
    // Construct a JTypeOracle with some previously cached type relations, but do not recompute();
    MinimalRebuildCache minimalRebuildCache = new MinimalRebuildCache();
    ImmediateTypeRelations immediateTypeRelations = minimalRebuildCache.getImmediateTypeRelations();
    immediateTypeRelations.getImmediateSuperclassesByClass().put("Foo", "java.lang.Object");
    JTypeOracle typeOracle = new JTypeOracle(null, minimalRebuildCache, true);

    // Show that the typeOracle can already answer basic type relation questions.
    assertEquals("java.lang.Object", typeOracle.getSuperTypeName("Foo"));
View Full Code Here

    assertEquals("java.lang.Object", typeOracle.getSuperTypeName("Foo"));
  }

  @Override
  protected void setUp() {
    createSampleProgram(new MinimalRebuildCache());
  }
View Full Code Here

    PrecompileTaskOptions options = new PrecompileTaskOptionsImpl();
    options.setOutput(JsOutputOption.PRETTY);
    options.setRunAsyncEnabled(false);
    CompilerContext context = new CompilerContext.Builder().options(options)
        .minimalRebuildCache(new MinimalRebuildCache()).build();

    ConfigProps config = new ConfigProps(Arrays.asList(recordFileNamesProp,
        recordLineNumbersProp));

    CompilationState state =
View Full Code Here

  }

  private void checkAddGeneratedCompilationUnit(boolean incremental) {
    compilerContext.getOptions().setIncrementalCompileEnabled(incremental);

    MinimalRebuildCache minimalRebuildCache = compilerContext.getMinimalRebuildCache();

    // Compile and ensure that not-yet-generated class Foo is not seen.
    validateCompilationState();
    assertFalse(minimalRebuildCache.getModifiedCompilationUnitNames().contains("test.Foo"));

    // Add a generated unit and ensure it shows up as a new modified unit.
    addGeneratedUnits(JavaResourceBase.FOO);
    validateCompilationState(Shared.getTypeName(JavaResourceBase.FOO));
    assertEquals(incremental,
        minimalRebuildCache.getModifiedCompilationUnitNames().contains("test.Foo"));

    rebuildCompilationState();
    validateCompilationState();
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.MinimalRebuildCache

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.