// 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"));
rules.prepend(ruleFail);
rules.prepend(new RuleGenerateWith(Generator.class));
RuleReplaceWith ruleReplaceCanvas = new RuleReplaceWith("WebkitCanvasElement");
ruleReplaceCanvas.getRootCondition()
.getConditions().add(new ConditionWhenTypeIs("CanvasElement"));
rules.prepend(ruleReplaceCanvas);
rules.prepend(new RuleReplaceWithFallback("CanvasElement"));
// Creates rebind rule classes for the non-generator rules in the provided list.
precompiler.buildSimpleRuntimeRebindRules(rules);
// Only 3 rebind rules were created because the generator rule was skipped.