public ModuleDescriptorReader(String moduleName, File srcDir) throws NoSuchModuleException {
RepositoryManagerBuilder builder = new RepositoryManagerBuilder(new NullLogger(), DefaultToolOptions.getDefaultOffline(), (int)DefaultToolOptions.getDefaultTimeout());
RepositoryManager repoManager = builder.buildRepository();
VFS vfs = new VFS();
Context context = new Context(repoManager, vfs);
PhasedUnits pus = new PhasedUnits(context);
List<String> name = ModuleManager.splitModuleName(moduleName);
ModuleManager moduleManager = pus.getModuleManager();
if(Module.DEFAULT_MODULE_NAME.equals(moduleName)){
// visit every folder and skip modules
boolean exists = findDefaultModuleSource(srcDir);
if(!exists)
throw new NoSuchModuleException("No source found for default module");
}else{
visitModule(vfs, pus, name, srcDir, vfs.getFromFile(srcDir), moduleManager);
}
for (PhasedUnit pu : pus.getPhasedUnits()) {
pu.visitSrcModulePhase();
}
this.moduleDescriptor = moduleManager.getOrCreateModule(name, null);
}