繁体   English   中英

修改Xtext以编程方式生成的Mwe2工作流程

[英]Modifying of the Mwe2 workflow generated by Xtext programmatically

我正在以编程方式运行Mwe2工作流程,并且需要将Terminals.xtext的referencedResource添加到GenerateYourDsl.mwe2文件中,以便成功运行此工作流程。 提及的GenerateYourDsl.mwe2文件是在创建新项目时由Xtext生成的-我没有对其进行修改。 是否有可能使对象脱离此工作流程,使用Java访问该对象并将该一个属性添加到工作流程的组件属性的language属性中?

这是工作流程:

Workflow {

    component = XtextGenerator {
        configuration = {
            project = StandardProjectConfig {
                baseName = "org.example.yourdsl"
                rootPath = rootPath
                eclipsePlugin = {
                    enabled = true
                }
                createEclipseMetaData = true
            }
            code = {
                encoding = "UTF-8"
                lineDelimiter = "\n"
                fileHeader = "/*\n * generated by Xtext \${version}\n */"
            }
        }
        language = StandardLanguage {
            name = "org.example.yourdsl.YourDsl"
            fileExtensions = "yourdsl"
            //following line needs to be added - in original generated workflow it is not
           referencedResource = "platform:/resource/org.eclipse.xtext/org/eclipse/xtext/common/Terminals.xtext"

            serializer = {
                generateStub = false
            }
            validator = {
                // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
                // Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage
                generateDeprecationValidation = true
            }
        }
    }
}

我正在以编程方式生成项目(使用CliProjectsCreatorWizardConfiguration ),并且需要在生成项目时运行工作流,以便生成src,src-gen文件等。但是由于我正在尝试以编程方式运行(不在Eclipse中)语法中使用了Terminals,出现了这个错误:

XtextLinkingDiagnostic: null:1 Couldn't resolve reference to Grammar 'org.eclipse.xtext.common.Terminals'.
TransformationDiagnostic: null:36 Cannot create datatype WS. If this is supposed to return EString, make sure you have imported 'http://www.eclipse.org/emf/2002/Ecore' (ErrorCode: NoSuchTypeAvailable)
TransformationDiagnostic: null:39 Cannot create datatype NAME_TERMINAL. If this is supposed to return EString, make sure you have imported 'http://www.eclipse.org/emf/2002/Ecore' (ErrorCode: NoSuchTypeAvailable)
TransformationDiagnostic: null:42 Cannot create datatype VALUE_TERMINAL. If this is supposed to return EString, make sure you have imported 'http://www.eclipse.org/emf/2002/Ecore' (ErrorCode: NoSuchTypeAvailable)

无需明确添加终端语法。 如果使用正确的类路径调用工作流,则应通过org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(Object, URI)在类路径上找到它。 看一下选择maven时向导创建的内容:对maven exec插件的调用,并使用正确的类路径调用Mwe2Launcher main

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM