use of com.google.gwt.core.ext.TreeLogger in project gwt-cs by iSergio.
the class CesiumScriptInjector method forceScriptLoad.
private boolean forceScriptLoad(TreeLogger logger, String moduleName, Float gwtVersion) {
try {
ModuleDef module;
Method getModuleDef;
if (gwtVersion < 2.6f) {
getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, String.class });
module = (ModuleDef) getModuleDef.invoke(null, logger, moduleName);
} else if (gwtVersion < 2.8f) {
Class compilerContextClass = Class.forName("com.google.gwt.dev.CompilerContext");
Object context = compilerContextClass.getDeclaredConstructor().newInstance();
getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, compilerContextClass, String.class });
module = (ModuleDef) getModuleDef.invoke(null, logger, compilerContextClass.cast(context), moduleName);
} else {
getModuleDef = ModuleDefLoader.class.getDeclaredMethod("loadFromClassPath", new Class[] { TreeLogger.class, String.class, boolean.class });
module = (ModuleDef) getModuleDef.invoke(null, logger, moduleName, false);
}
if (module != null)
return CrossSiteIframeLinker.class.equals(module.getActivePrimaryLinker());
logger.log(TreeLogger.WARN, "Can't find module reference - not injecting scripts.");
} catch (Throwable t) {
logger.log(TreeLogger.ERROR, "Encountered an exception while trying to resolve the ModuleDef for " + moduleName, t);
}
return false;
}
use of com.google.gwt.core.ext.TreeLogger in project mvp4g by mvp4g.
the class Mvp4gGenerator method generateIncrementally.
@Override
public RebindResult generateIncrementally(TreeLogger logger, GeneratorContext generatorContext, String moduleClass) throws UnableToCompleteException {
TypeOracle typeOracle = generatorContext.getTypeOracle();
assert (typeOracle != null);
JClassType module = typeOracle.findType(moduleClass);
if (module == null) {
logger.log(TreeLogger.ERROR, "Unable to find metadata for module class '" + moduleClass + "'");
throw new UnableToCompleteException();
}
if (module.isInterface() == null) {
logger.log(TreeLogger.ERROR, "'" + moduleClass + "' is not a interface");
throw new UnableToCompleteException();
}
TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG, "Generating mvp4g configuration for module class '" + module.getQualifiedSourceName() + "'", null);
return create(moduleLogger, generatorContext, moduleClass);
}
use of com.google.gwt.core.ext.TreeLogger in project mvp4g by mvp4g.
the class Mvp4gConfigurationFileReaderTest method setUp.
@Before
public void setUp() {
sourceWriter = new SourceWriterTestStub();
TreeLogger tl = new UnitTestTreeLogger.Builder().createLogger();
configuration = new Mvp4gConfiguration(tl, new GeneratorContextStub());
writer = new Mvp4gConfigurationFileWriter(sourceWriter, configuration);
String eventBusInterface = EventBus.class.getName();
String eventBusClass = BaseEventBus.class.getName();
configuration.setEventBus(new EventBusElement(eventBusInterface, eventBusClass, false));
ViewElement view = new ViewElement();
view.setClassName(Object.class.getName());
view.setName("startView");
configuration.getViews().add(view);
PresenterElement presenter = new PresenterElement();
presenter.setClassName(SimplePresenter01.class.getCanonicalName());
presenter.setName("startPresenter");
presenter.setView("startView");
configuration.getPresenters().add(presenter);
StartElement start = new StartElement();
start.setPresenter("startPresenter");
configuration.setStart(start);
GinModuleElement ginModule = new GinModuleElement();
ginModule.setModules(new String[] { DefaultMvp4gGinModule.class.getCanonicalName() });
configuration.setGinModule(ginModule);
TypeOracleStub oracle = (TypeOracleStub) configuration.getOracle();
configuration.setModule(oracle.addClass(Mvp4gModule.class));
}
use of com.google.gwt.core.ext.TreeLogger in project mvp4g by mvp4g.
the class Mvp4gRunAsyncGenerator method generateIncrementally.
@Override
public RebindResult generateIncrementally(TreeLogger logger, GeneratorContext generatorContext, String typeName) throws UnableToCompleteException {
TypeOracle typeOracle = generatorContext.getTypeOracle();
assert (typeOracle != null);
JClassType originalType = typeOracle.findType(typeName);
if (originalType == null) {
logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + typeName + "'");
throw new UnableToCompleteException();
}
if (originalType.isInterface() == null) {
logger.log(TreeLogger.ERROR, "'" + typeName + "' is not a interface");
throw new UnableToCompleteException();
}
TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG, "Generating client proxy for remote service interface '" + originalType.getQualifiedSourceName() + "'", null);
return create(originalType, moduleLogger, generatorContext, typeName);
}
use of com.google.gwt.core.ext.TreeLogger in project google-gin by gwtplus.
the class BindingResolver method resolveBindings.
public void resolveBindings(GinjectorBindings origin) {
TreeLogger branch = logger.branch(TreeLogger.DEBUG, PrettyPrinter.format("Resolving bindings for %s", origin));
// Use providers so that the instances are cleaned up after this method. This ensures that even
// though BindingResolver may be held on to (eg, {@link GinjectorBindings}, we won't leak
// memory used for temporary storage during resolution.
DependencyExplorerOutput output = explorerFactory.create(branch).explore(origin);
UnresolvedBindingValidator validator = validatorFactory.create(branch);
InvalidKeys invalidKeys = validator.getInvalidKeys(output);
if (validator.validate(output, invalidKeys)) {
validator.pruneInvalidOptional(output, invalidKeys);
installerFactory.create(branch).installBindings(output);
}
}
Aggregations