RuntimeRebindRuleGenerator.RUNTIME_REBIND_RULE_SOURCES_BY_SHORT_NAME;
MockLibraryWriter libraryWriter = new MockLibraryWriter();
// A library group with a varied
// user.agent/locale/BrowserShimGenerator/LocaleMessageGenerator configuration of properties
// and generators.
MockModuleDef module = new MockModuleDef();
BindingProperty userAgentProperty = module.getProperties().createBinding("user.agent");
userAgentProperty.addDefinedValue(userAgentProperty.getRootCondition(), "mozilla");
userAgentProperty.addDefinedValue(userAgentProperty.getRootCondition(), "webkit");
userAgentProperty.addDefinedValue(userAgentProperty.getRootCondition(), "ie");
userAgentProperty.addDefinedValue(userAgentProperty.getRootCondition(), "webkit_phone");
userAgentProperty.addDefinedValue(userAgentProperty.getRootCondition(), "webkit_tablet");
BindingProperty flavorProperty = module.getProperties().createBinding("locale");
flavorProperty.addDefinedValue(flavorProperty.getRootCondition(), "en");
flavorProperty.addDefinedValue(flavorProperty.getRootCondition(), "fr");
flavorProperty.addDefinedValue(flavorProperty.getRootCondition(), "ru");
RuleGenerateWith browserShimGenerateRule = new RuleGenerateWith(BrowserShimGenerator.class);
browserShimGenerateRule.getRootCondition()
.getConditions().add(new ConditionWhenTypeEndsWith("Shim"));
module.addRule(browserShimGenerateRule);
RuleGenerateWith localeMessageGenerateRule = new RuleGenerateWith(LocaleMessageGenerator.class);
localeMessageGenerateRule.getRootCondition()
.getConditions().add(new ConditionWhenTypeEndsWith("Messages"));
module.addRule(localeMessageGenerateRule);
LibraryGroup libraryGroup = LibraryGroupTest.buildVariedPropertyGeneratorLibraryGroup(
Sets.newHashSet("com.google.ChromeMessages"),
Sets.newHashSet("com.google.WindowShim"));
PrecompileTaskOptions options = new CompilerOptionsImpl();
options.setFinalProperties(module.getProperties());
compilerContext = new CompilerContext.Builder().libraryGroup(libraryGroup)
.libraryWriter(libraryWriter).module(module).options(options).build();
finishSetUpWithCompilerContext();
// Analyzes properties and generators in the library group and watches output in the generator