本文整理汇总了Java中org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig类的典型用法代码示例。如果您正苦于以下问题:Java ISpoofaxLanguageSpecConfig类的具体用法?Java ISpoofaxLanguageSpecConfig怎么用?Java ISpoofaxLanguageSpecConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ISpoofaxLanguageSpecConfig类属于org.metaborg.spoofax.meta.core.config包,在下文中一共展示了ISpoofaxLanguageSpecConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
@Override public @Nullable ISpoofaxLanguageSpec get(IProject project) throws ConfigException {
if(project instanceof ISpoofaxLanguageSpec) {
return (ISpoofaxLanguageSpec) project;
}
final FileObject location = project.location();
if(!configService.available(location)) {
return null;
}
final ConfigRequest<ISpoofaxLanguageSpecConfig> configRequest = configService.get(location);
if(!configRequest.valid()) {
logger.error("Errors occurred when retrieving language specification configuration from project {}",
project);
configRequest.reportErrors(new StreamMessagePrinter(sourceTextService, false, false, logger));
throw new ConfigException("Configuration for language specification at " + project + " is invalid");
}
final ISpoofaxLanguageSpecConfig config = configRequest.config();
if(config == null) {
// Configuration should never be null if it is available, but sanity check anyway.
return null;
}
return new SpoofaxLanguageSpecWrapper(config, project);
}
示例2: generateSources
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
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);
}
}
示例3: create
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public IdeaLanguageSpec create(final Module module,
final FileObject rootFolder,
@Nullable ISpoofaxLanguageSpecConfig config) {
final ModuleType moduleType = ModuleType.get(module);
if (moduleType != MetaborgModuleType.getModuleType()) {
this.logger.info("Module is not a language specification: {}", module);
return null;
}
@Nullable final ConfigRequest<ISpoofaxLanguageSpecConfig> configRequest = this.configService.get(rootFolder);
if(configRequest == null || !configRequest.valid()) {
this.logger.error(
"Errors occurred when retrieving language specification configuration from project at: {}",
rootFolder);
if (configRequest != null) {
configRequest.reportErrors(new StreamMessagePrinter(this.sourceTextService, false, false, this.logger));
}
return null;
}
if (config == null) {
config = configRequest.config();
}
if(config == null) {
this.logger.error(
"Could not get the configuration of the project: {}",
rootFolder);
return null;
}
return new IdeaLanguageSpec(module, rootFolder, config);
}
示例4: super
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
@Inject
/* package private */ IdeaLanguageSpec(
@Assisted final Module module,
@Assisted final FileObject location,
@Assisted final ISpoofaxLanguageSpecConfig config) {
super(module, location, config);
this.config = config;
}
示例5: JpsLanguageSpec
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
/**
* Initializes a new instance of the {@link JpsLanguageSpec} class.
*
* @param location
* The location of the project root.
*/
@Inject
public JpsLanguageSpec(@Assisted final JpsModule module,
@Assisted final FileObject location,
@Assisted final ISpoofaxLanguageSpecConfig config) {
super(module, location, config);
this.config = config;
}
示例6: withConfig
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
public LangSpecGeneratorSettingsBuilder withConfig(ISpoofaxLanguageSpecConfig config) {
withGroupId(config.identifier().groupId);
withId(config.identifier().id);
withVersion(config.identifier().version);
withName(config.name());
withMetaborgVersion(config.metaborgVersion());
return this;
}
示例7: build
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
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);
}
示例8: GeneratorSettings
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
public GeneratorSettings(FileObject location, ISpoofaxLanguageSpecConfig config, AnalysisType analysisType) throws ProjectException {
if(!config.identifier().valid()) {
throw new ProjectException("Invalid language identifier: " + config.identifier());
}
if(!LanguageIdentifier.validId(config.name())) {
throw new ProjectException("Invalid name: " + name());
}
for(LanguageIdentifier compileIdentifier : config.compileDeps()) {
if(!compileIdentifier.valid()) {
throw new ProjectException("Invalid compile dependency identifier: " + compileIdentifier);
}
}
for(LanguageIdentifier runtimeIdentifier : config.sourceDeps()) {
if(!runtimeIdentifier.valid()) {
throw new ProjectException("Invalid runtime dependency identifier: " + runtimeIdentifier);
}
}
for(LanguageContributionIdentifier contributionIdentifier : config.langContribs()) {
if(!contributionIdentifier.id.valid()) {
throw new ProjectException("Invalid language contribution identifier: " + contributionIdentifier.id);
}
if(!LanguageIdentifier.validId(contributionIdentifier.name)) {
throw new ProjectException("Invalid language contribution name: " + config.name());
}
}
this.location = location;
this.config = config;
this.paths = new SpoofaxLangSpecCommonPaths(location);
this.analysisType = analysisType;
}
示例9: packageBuilderInput
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
private PackageBuilder.Input packageBuilderInput(LanguageSpecBuildInput input, Origin origin)
throws FileSystemException {
final ISpoofaxLanguageSpec languageSpec = input.languageSpec();
final ISpoofaxLanguageSpecConfig config = languageSpec.config();
final FileObject baseLoc = input.languageSpec().location();
final SpoofaxLangSpecCommonPaths paths = new SpoofaxLangSpecCommonPaths(baseLoc);
final FileObject buildInfoLoc = paths.plutoBuildInfoDir();
final SpoofaxContext context = new SpoofaxContext(baseLoc, buildInfoLoc);
final StrategoFormat strFormat = config.strFormat();
final FileObject strJavaStratFileCandidate = paths.strMainJavaStratFile(config.identifier().id);
final @Nullable File strJavaStratFile;
if(strJavaStratFileCandidate.exists()) {
strJavaStratFile = resourceService.localPath(strJavaStratFileCandidate);
} else {
strJavaStratFile = null;
}
final File javaStratClassesDir =
resourceService.localPath(paths.strTargetClassesJavaStratDir(config.identifier().id));
final File dsGeneratedClassesDir = resourceService.localPath(paths.dsTargetClassesGenerateDir());
final File dsManualClassesDir = resourceService.localPath(paths.dsTargetClassesManualDir());
final List<File> strJavaStratIncludeDirs =
Lists.newArrayList(javaStratClassesDir, dsGeneratedClassesDir, dsManualClassesDir);
return new PackageBuilder.Input(context, config.identifier().id, origin, strFormat, strJavaStratFile,
strJavaStratIncludeDirs);
}
示例10: archiveBuilderInput
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
private ArchiveBuilder.Input archiveBuilderInput(LanguageSpecBuildInput input, Origin origin) {
final ISpoofaxLanguageSpec languageSpec = input.languageSpec();
final ISpoofaxLanguageSpecConfig config = languageSpec.config();
final FileObject baseLoc = input.languageSpec().location();
final SpoofaxLangSpecCommonPaths paths = new SpoofaxLangSpecCommonPaths(baseLoc);
final FileObject buildInfoLoc = paths.plutoBuildInfoDir();
final SpoofaxContext context = new SpoofaxContext(baseLoc, buildInfoLoc);
final Iterable<IExportConfig> exports = config.exports();
final LanguageIdentifier languageIdentifier = config.identifier();
return new ArchiveBuilder.Input(context, origin, exports, languageIdentifier);
}
示例11: config
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ISpoofaxLanguageSpecConfig config() {
return this.config;
}
示例12: get
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Nullable
@Override
public ISpoofaxLanguageSpec get(final IProject project)
throws ConfigException {
if(project instanceof JpsLanguageSpec) {
return (JpsLanguageSpec) project;
}
if(!(project instanceof MetaborgJpsProject)) {
this.logger.error("Project {} is not a JPS project, and can therefore not be converted " +
"to a language specification project", project);
return null;
}
final MetaborgJpsProject ideaProject = (MetaborgJpsProject) project;
final FileObject rootFolder = project.location();
@Nullable final ConfigRequest<ISpoofaxLanguageSpecConfig> configRequest = this.configService.get(rootFolder);
if(configRequest == null || !configRequest.valid()) {
this.logger.error(
"Errors occurred when retrieving language specification configuration from project {}",
rootFolder);
if (configRequest != null) {
configRequest.reportErrors(new StreamMessagePrinter(this.sourceTextService, false, false, this.logger));
}
return null;
}
@Nullable final ISpoofaxLanguageSpecConfig config = configRequest.config();
if(config == null) {
// Configuration should never be null if it is available, but sanity check anyway.
this.logger.error(
"Could not get the configuration of the project {}",
rootFolder);
return null;
}
return new JpsLanguageSpec(ideaProject.getModule(), rootFolder, config);
}
示例13: SpoofaxLanguageSpecWrapper
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
public SpoofaxLanguageSpecWrapper(ISpoofaxLanguageSpecConfig config, IProject project) {
this.config = config;
this.project = project;
}
示例14: config
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
@Override public ISpoofaxLanguageSpecConfig config() {
return config;
}
示例15: config
import org.metaborg.spoofax.meta.core.config.ISpoofaxLanguageSpecConfig; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
ISpoofaxLanguageSpecConfig config();