Search in sources :

Example 1 with GeneratorSettings

use of org.metaborg.spoofax.meta.core.generator.GeneratorSettings in project spoofax by metaborg.

the class LanguageSpecBuilder method generateSources.

public void generateSources(LanguageSpecBuildInput input, @Nullable IFileAccess access) throws IOException, MetaborgException {
    final ISpoofaxLanguageSpec languageSpec = input.languageSpec();
    final FileObject location = languageSpec.location();
    final ISpoofaxLanguageSpecConfig config = languageSpec.config();
    logger.debug("Generating sources for {}", input.languageSpec().location());
    final ContinuousLanguageSpecGenerator generator = new ContinuousLanguageSpecGenerator(new GeneratorSettings(location, config), access, config.sdfEnabled(), config.sdfVersion());
    generator.generateAll();
    componentConfigBuilder.reset();
    componentConfigBuilder.copyFrom(input.languageSpec().config());
    final ILanguageComponentConfig componentConfig = componentConfigBuilder.build(location);
    componentConfigWriter.write(location, componentConfig, access);
    for (IBuildStep buildStep : buildSteps) {
        buildStep.execute(LanguageSpecBuildPhase.generateSources, input);
    }
}
Also used : ISpoofaxLanguageSpec(org.metaborg.spoofax.meta.core.project.ISpoofaxLanguageSpec) ISpoofaxLanguageSpecConfig(org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig) FileObject(org.apache.commons.vfs2.FileObject) ContinuousLanguageSpecGenerator(org.metaborg.spoofax.meta.core.generator.general.ContinuousLanguageSpecGenerator) GeneratorSettings(org.metaborg.spoofax.meta.core.generator.GeneratorSettings) ILanguageComponentConfig(org.metaborg.core.config.ILanguageComponentConfig)

Example 2 with GeneratorSettings

use of org.metaborg.spoofax.meta.core.generator.GeneratorSettings 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

ISpoofaxLanguageSpecConfig (org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig)2 GeneratorSettings (org.metaborg.spoofax.meta.core.generator.GeneratorSettings)2 FileObject (org.apache.commons.vfs2.FileObject)1 ILanguageComponentConfig (org.metaborg.core.config.ILanguageComponentConfig)1 LanguageIdentifier (org.metaborg.core.language.LanguageIdentifier)1 ProjectException (org.metaborg.core.project.ProjectException)1 ContinuousLanguageSpecGenerator (org.metaborg.spoofax.meta.core.generator.general.ContinuousLanguageSpecGenerator)1 ISpoofaxLanguageSpec (org.metaborg.spoofax.meta.core.project.ISpoofaxLanguageSpec)1