if (visitedModules.contains(moduleName)) {
return;
}
visitedModules.add(moduleName);
// prepare module
ModuleElement module;
{
String moduleResourceName = moduleName.replace('.', '/') + ".gwt.xml";
// prepare stream
InputStream is = resources.getResourceAsStream(moduleResourceName);
Assert.isTrueException(is != null, IExceptionConstants.NO_MODULE, moduleName);
// read module
module = Utils.readModule(moduleName, is);
}
// start visit module
if (!visitor.visitModule(module)) {
return;
}
String modulePackageName = CodeUtils.getPackage(moduleName);
// visit "source" packages
{
List<SuperSourceElement> superSourceElements = module.getSuperSourceElements();
List<SourceElement> sourceElements = module.getSourceElements();
// visit explicit
for (SuperSourceElement sourceElement : superSourceElements) {
visitSourcePackage(visitor, module, modulePackageName, sourceElement.getPath(), true);
}
for (SourceElement sourceElement : sourceElements) {
visitSourcePackage(visitor, module, modulePackageName, sourceElement.getPath(), false);
}
// no any source elements, use default
if (superSourceElements.isEmpty() && sourceElements.isEmpty()) {
visitSourcePackage(visitor, module, modulePackageName, "client", false);
}
}
// visit "public" folders
{
// prepare folders
List<PublicElement> publicElements = module.getPublicElements();
if (publicElements.isEmpty()) {
PublicElement defaultPublicElement = new PublicElement();
defaultPublicElement.setPath("public");
publicElements = ImmutableList.of(defaultPublicElement);
}
// visit folders
for (PublicElement publicElement : publicElements) {
String packageName = modulePackageName + "." + publicElement.getPath().replace('/', '.');
visitor.visitPublicPackage(module, packageName);
}
}
// try inherited modules
{
List<InheritsElement> inheritsElements = module.getInheritsElements();
for (InheritsElement inheritsElement : inheritsElements) {
String inheritsName = inheritsElement.getName();
Assert.isTrueException(
inheritsName != null,
IExceptionConstants.INHERITS_NO_NAME,