use of org.metaborg.core.language.ILanguageDiscoveryRequest in project spoofax by metaborg.
the class LanguageDiscoveryService method request.
@Deprecated
@Override
public Iterable<ILanguageDiscoveryRequest> request(FileObject location) throws MetaborgException {
final Collection<ILanguageDiscoveryRequest> requests = Lists.newLinkedList();
final FileObject[] configFiles;
try {
configFiles = location.findFiles(new FileSelector() {
@Override
public boolean traverseDescendents(FileSelectInfo fileInfo) throws Exception {
final String baseName = fileInfo.getFile().getName().getBaseName();
return !baseName.equals("bin") && !baseName.equals("target");
}
@Override
public boolean includeFile(FileSelectInfo fileInfo) throws Exception {
return fileInfo.getFile().getName().getBaseName().equals(MetaborgConstants.FILE_COMPONENT_CONFIG);
}
});
} catch (FileSystemException e) {
throw new MetaborgException("Searching for language components failed unexpectedly", e);
}
if (configFiles == null || configFiles.length == 0) {
return requests;
}
for (FileObject configFile : configFiles) {
try {
final FileObject directory = configFile.getParent().getParent();
final IComponentCreationConfigRequest request = componentFactory.requestFromDirectory(directory);
requests.add(request);
} catch (FileSystemException e) {
logger.error("Could not resolve parent directory of config file {}, skipping", e, configFile);
continue;
}
}
return requests;
}
Aggregations