private static boolean maybeOverrideConfig(ModuleDef module, String propName, String newValue) { ConfigurationProperty config = module.getProperties().findConfigProp(propName); if (config != null) { config.setValue(newValue); return true; } return false; }
private static boolean maybeOverrideConfig(ModuleDef module, String propName, String newValue) { ConfigurationProperty config = module.getProperties().findConfigProp(propName); if (config != null) { config.setValue(newValue); return true; } return false; }
/** * Sets a binding even if it's set to a different value in the GWT application. */ private static void overrideBinding(ModuleDef module, String propName, String newValue) { BindingProperty binding = module.getProperties().findBindingProp(propName); if (binding != null) { // This sets both allowed and generated values, which is needed since the module // might have explicitly disallowed the value. // It persists over multiple compiles but that's okay since we set it the same way // every time. binding.setValues(binding.getRootCondition(), newValue); } }
/** * Sets a binding even if it's set to a different value in the GWT application. */ private static void overrideBinding(ModuleDef module, String propName, String newValue) { BindingProperty binding = module.getProperties().findBindingProp(propName); if (binding != null) { // This sets both allowed and generated values, which is needed since the module // might have explicitly disallowed the value. // It persists over multiple compiles but that's okay since we set it the same way // every time. binding.setValues(binding.getRootCondition(), newValue); } }
protected PropertyOracle getPropertyOracle() { if (propertyOracle == null) { PropertyCombinations permutations = new PropertyCombinations(moduleDef.getProperties(), moduleDef.getActiveLinkerNames()); SortedSet<ConfigurationProperty> configPropSet = moduleDef.getProperties().getConfigurationProperties(); ConfigurationProperty[] configProps = configPropSet.toArray(new ConfigurationProperty[configPropSet.size()]); BindingProperty[] orderedProperties = permutations.getOrderedProperties(); WithProperties withProperties = GwtTestDataHolder.get().getCurrentWithProperties(); String[] processedProperties; if (withProperties != null) { processedProperties = replaceOrderedPropertyValues(orderedProperties, permutations.getOrderedPropertyValues(0), withProperties); } else { processedProperties = permutations.getOrderedPropertyValues(0); } propertyOracle = new StaticPropertyOracle(orderedProperties, processedProperties, configProps); } return propertyOracle; }
protected PropertyOracle getPropertyOracle() { if (propertyOracle == null) { PropertyCombinations permutations = new PropertyCombinations(moduleDef.getProperties(), moduleDef.getActiveLinkerNames()); SortedSet<ConfigurationProperty> configPropSet = moduleDef.getProperties().getConfigurationProperties(); ConfigurationProperty[] configProps = configPropSet.toArray(new ConfigurationProperty[configPropSet.size()]); BindingProperty[] orderedProperties = permutations.getOrderedProperties(); WithProperties withProperties = GwtTestDataHolder.get().getCurrentWithProperties(); String[] processedProperties; if (withProperties != null) { processedProperties = replaceOrderedPropertyValues(orderedProperties, permutations.getOrderedPropertyValues(0), withProperties); } else { processedProperties = permutations.getOrderedPropertyValues(0); } propertyOracle = new StaticPropertyOracle(orderedProperties, processedProperties, configProps); } return propertyOracle; }
void compileForWebMode(ModuleDef module, Set<String> userAgents) throws UnableToCompleteException { if (userAgents != null && !userAgents.isEmpty()) { Properties props = module.getProperties(); Property userAgent = props.find("user.agent"); if (userAgent instanceof BindingProperty) { BindingProperty bindingProperty = (BindingProperty) userAgent; bindingProperty.setRootGeneratedValues(userAgents.toArray(new String[0])); } } boolean success = false; try { success = new Compiler(options).run(getTopLogger(), module); } catch (Exception e) { getTopLogger().log(Type.ERROR, "Compiler aborted with an exception ", e); } if (!success) { throw new UnableToCompleteException(); } // TODO(scottb): prepopulate currentCompilationState somehow? }
@Override public void processModule(ModuleDef module) { computePropertiesMap(); if (properties.size() > 0) { Properties props = module.getProperties(); for (Property property : properties) { BindingProperty binding = props.createBinding(property.name()); if (!binding.isDefinedValue(property.value())) { binding.addDefinedValue(binding.getRootCondition(), property.value()); } binding.setValues( binding.getRootCondition(), property.value()); } } }
@Override public void processModule(ModuleDef module) { computePropertiesMap(); if (properties.size() > 0) { Properties props = module.getProperties(); for (Property property : properties) { BindingProperty binding = props.createBinding(property.name()); if (!binding.isDefinedValue(property.value())) { binding.addTargetLibraryDefinedValue(binding.getRootCondition(), property.value()); } binding.setValues( binding.getRootCondition(), property.value()); } } }
ConfigurationProperty moduleNameProp = moduleDef.getProperties().createConfiguration( "junit.moduleName", false); moduleNameProp.setValue(syntheticModuleName);
ConfigurationProperty moduleNameProp = moduleDef.getProperties().createConfiguration( "junit.moduleName", false); moduleNameProp.setValue(syntheticModuleName);
void compileForWebMode(ModuleDef module, Set<String> userAgents) throws UnableToCompleteException { if (userAgents != null && !userAgents.isEmpty()) { Properties props = module.getProperties(); Property userAgent = props.find("user.agent"); if (userAgent instanceof BindingProperty) { BindingProperty bindingProperty = (BindingProperty) userAgent; bindingProperty.setRootGeneratedValues(userAgents.toArray(new String[0])); } } if (!Compiler.maybeRestrictProperties(getTopLogger(), module, options.getProperties())) { throw new UnableToCompleteException(); } if (options.isClosureCompilerFormatEnabled()) { module.addLinker("closureHelpers"); } boolean success = false; try { success = new Compiler(options).run(getTopLogger(), module); } catch (Exception e) { getTopLogger().log(Type.ERROR, "Compiler aborted with an exception ", e); } if (!success) { throw new UnableToCompleteException(); } // TODO(scottb): prepopulate currentCompilationState somehow? }
BindingProperty binding = module.getProperties().findBindingProp(propName); if (binding == null) { logger.log(TreeLogger.Type.WARN, "undefined property: '" + propName + "'");
BindingProperty binding = module.getProperties().findBindingProp(propName); if (binding == null) { logger.log(TreeLogger.Type.WARN, "undefined property: '" + propName + "'");
for (BindingProperty bindingProperty : moduleDef.getProperties().getBindingProperties()) { bindingProperty.resetGeneratedValues();
for (BindingProperty bindingProperty : moduleDef.getProperties().getBindingProperties()) { bindingProperty.resetGeneratedValues();
new PropertyCombinations(module.getProperties(), module.getActiveLinkerNames()); List<PropertyCombinations> permutationPropertySets = propertyCombinations.collapseProperties(); if (options.isIncrementalCompileEnabled() && permutationPropertySets.size() > 1) {
new PropertyCombinations(module.getProperties(), module.getActiveLinkerNames()); List<PropertyCombinations> permutationPropertySets = propertyCombinations.collapseProperties(); if (options.isIncrementalCompileEnabled() && permutationPropertySets.size() > 1) {
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException { this.space = readySpace; Event moduleSpaceHostReadyEvent = SpeedTracerLogger.start(DevModeEventType.MODULE_SPACE_HOST_READY); try { // Establish an environment for JavaScript property providers to run. // ModuleSpacePropertyOracle propOracle = new ModuleSpacePropertyOracle( module.getProperties(), module.getActiveLinkerNames(), readySpace); // Set up the rebind oracle for the module. // It has to wait until now because we need to inject javascript. // Deque<Rule> 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 StandardRebindOracle2(propOracle, rules, genCtx); rebindOracle.setRebindCache(rebindCache); } finally { moduleSpaceHostReadyEvent.end(); } }
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException { this.space = readySpace; Event moduleSpaceHostReadyEvent = SpeedTracerLogger.start(DevModeEventType.MODULE_SPACE_HOST_READY); try { // Establish an environment for JavaScript property providers to run. // ModuleSpacePropertyOracle propOracle = new ModuleSpacePropertyOracle( module.getProperties(), module.getActiveLinkerNames(), readySpace); // Set up the rebind oracle for the module. // It has to wait until now because we need to inject javascript. // Deque<Rule> 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 StandardRebindOracle2(propOracle, rules, genCtx); rebindOracle.setRebindCache(rebindCache); } finally { moduleSpaceHostReadyEvent.end(); } }