Search in sources :

Example 1 with ProjectException

use of org.metaborg.core.project.ProjectException in project spoofax by metaborg.

the class LangSpecGeneratorSettingsBuilder method build.

public LangSpecGeneratorSettings build(FileObject projectLocation, final ISpoofaxLanguageSpecConfigBuilder languageSpecConfigBuilder) throws ProjectException {
    if (!canBuild()) {
        throw new ProjectException("Cannot build incomplete configuration, missing " + Joiner.on(", ").join(stillMissing()));
    }
    if (groupId == null) {
        groupId = defaultGroupId;
    }
    if (version == null) {
        version = defaultVersion;
    }
    if (syntaxType == null) {
        syntaxType = defaultSyntaxType;
    }
    if (analysisType == null) {
        analysisType = defaultAnalysisType;
    }
    if (metaborgVersion == null) {
        metaborgVersion = defaultMetaborgVersion;
    }
    final LanguageIdentifier identifier = new LanguageIdentifier(groupId, id, version);
    final ISpoofaxLanguageSpecConfig config = languageSpecConfigBuilder.withIdentifier(identifier).withName(name).build(projectLocation);
    final GeneratorSettings generatorSettings = new GeneratorSettings(projectLocation, config, analysisType);
    generatorSettings.setMetaborgVersion(metaborgVersion);
    return new LangSpecGeneratorSettings(generatorSettings, extensions, syntaxType);
}
Also used : ProjectException(org.metaborg.core.project.ProjectException) LanguageIdentifier(org.metaborg.core.language.LanguageIdentifier) ISpoofaxLanguageSpecConfig(org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig) GeneratorSettings(org.metaborg.spoofax.meta.core.generator.GeneratorSettings)

Aggregations

LanguageIdentifier (org.metaborg.core.language.LanguageIdentifier)1 ProjectException (org.metaborg.core.project.ProjectException)1 ISpoofaxLanguageSpecConfig (org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig)1 GeneratorSettings (org.metaborg.spoofax.meta.core.generator.GeneratorSettings)1