Search in sources :

Example 1 with MissingDependencyException

use of org.metaborg.core.build.dependency.MissingDependencyException in project spoofax by metaborg.

the class TermFactoryService method getTypesmartContext.

private TypesmartContext getTypesmartContext(ILanguageComponent component) {
    TypesmartContext context = mergedTypesmartContexts.get(component);
    if (context == null) {
        FileObject localContextFile = new SpoofaxCommonPaths(component.location()).strTypesmartExportedFile();
        context = TypesmartContext.load(localContextFile, typesmartLogger);
        try {
            for (ILanguageComponent other : dependencyService.sourceDeps(component)) {
                FileObject otherContextFile = new SpoofaxCommonPaths(other.location()).strTypesmartExportedFile();
                TypesmartContext otherContext = TypesmartContext.load(otherContextFile, typesmartLogger);
                context = context.merge(otherContext);
            }
        } catch (MissingDependencyException e) {
            typesmartLogger.error("Could not load source dependencies of " + component + " to resolve typesmart contexts.", e);
        }
        mergedTypesmartContexts.put(component, context);
    }
    return context;
}
Also used : FileObject(org.apache.commons.vfs2.FileObject) ILanguageComponent(org.metaborg.core.language.ILanguageComponent) TypesmartContext(org.spoofax.terms.typesmart.TypesmartContext) SpoofaxCommonPaths(org.metaborg.spoofax.core.build.SpoofaxCommonPaths) MissingDependencyException(org.metaborg.core.build.dependency.MissingDependencyException)

Aggregations

FileObject (org.apache.commons.vfs2.FileObject)1 MissingDependencyException (org.metaborg.core.build.dependency.MissingDependencyException)1 ILanguageComponent (org.metaborg.core.language.ILanguageComponent)1 SpoofaxCommonPaths (org.metaborg.spoofax.core.build.SpoofaxCommonPaths)1 TypesmartContext (org.spoofax.terms.typesmart.TypesmartContext)1