Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Xtext/Documentation/Migration

< Xtext‎ | Documentation
Revision as of 10:43, 13 March 2009 by Unnamed Poltroon (Talk) (initial version converted personal notes)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This document describes how Xtext projects of oAW 4.3 can be migrated to TMF Xtext. It assumes that you do have a running version of TMF Xtext as described in the Getting Started Document.

work in progress

Procedure

Setup new workspace with existing oAW Xtext projects

* Might have compile errors, these projects are just for reference
* Should contain generated code

create new TMF Xtext project

Create your new Xtext project in this workspace with the Xtext project wizard. During this process you have to provide a fully qualified language name. Choose this name carefully, it not only affects the name of the language itself (last token). The package names of your projects are directly derived from this, too. To reduce the amount of migration work you should try to choose a name, that results in the same package structure and language name you had on oAW. Doing so, Xpand templates and Xtend files must not change their import statements. Leave the sample grammar unchanged and generate the Xtext artefacts as described in the GettingStarted document.

Start over if the resultung package or grammar names are not as expected. You can simply delete the created projects (be sure to tick "Delete project contents on disk").

setup minimalistic model

Test, whether your generator project works. In the generator project you will find a workflow file in the package workflow. If everything works fine you are now having an empty set of Xtext projects that have package structure and language name in common with your oAW projects.

If not done, yet, put your newly created projects under version control. Having solid checkpoints during your migration can save hours of work.

Extract a simple model file from your original and place it into the model package of your generator project and run the generator again. You should now get some parser errors. This is fine since the default example grammar does not correspond to the syntax of your model file.

migrate grammar and linking

URI -> Feature ImportURI

Int Rule has no sign, if necessary Parser Rules are a good choice

Enums not yet Lexer Rules -> Terminal or DataType ParseRules

Also: See Jan's comment regarding linking https://bugs.eclipse.org/bugs/show_bug.cgi?id=268506#c1

migrate workflow

<component class="org.eclipse.xtext.MweReader" uri="classpath:/model/MyModel.mydsl">
    <!-- this class will be generated by the xtext generator -->
    <register class="org.xtext.example.MyDslStandaloneSetup"/>
</component>

Migrate Components oaw.workflow.common.DirectoryCleaner -> org.eclipse.emf.mwe.utils.DirectoryCleaner "directories" (deprecated) -> "directory"

<component class='org.eclipse.emf.mwe.utils.DirectoryCleaner' directory='${targetDir}'/>

oaw.xpand2.Generator -> org.eclipse.xpand2.Generator

<component class="org.eclipse.xpand2.Generator">
    <expand value="ise::intmsglang::doc::Main::main FOR mymodel"/>
    <metaModel class='org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel'/>
    <outlet overwrite="true" path="${targetDir}" />
</component>

oaw.xtend.XtendComponent -> org.eclipse.xtend.XtendComponent oaw.check.CheckComponent -> org.eclipse.xtend.check.CheckComponent

Postprocessor org.openarchitectureware.xpand2.output.XmlBeautifier -> org.eclipse.xpand2.output.XmlBeautifier

org.openarchitectureware.xpand2.output.JavaBeautifier -> org.eclipse.xpand2.output.JavaBeautifier


migrate checks and templates

Qualified name of stdlib has changed from org.openarchitectureware.util to org.eclipse.xtend.util

extension org::openarchitectureware::util::stdlib::io -> extension org::eclipse::xtend::util::stdlib::io
«EXTENSION org::eclipse::xtend::util::stdlib::io»

migrate headless build

Workflow Runner / Ant Tasks Needed Jars

migrate IDE

TBD

Unexpected errors

ClassCaseException while Parsing

EvaluationException : org.eclipse.xtext.parser.ParseException: java.lang.ClassCastException: java.lang.String

-> Missing ValueConverter

DiagnosticErrors while compiling grammar

Errors such as

XtextLinkingDiagnostic: null:21 Cannot resolve reference to 'ID'
XtextLinkingDiagnostic: null:25 Cannot resolve reference to 'INT'
XtextLinkingDiagnostic: null:238 Cannot resolve reference to 'STRING'

--> Missing super grammar

Cannot resolve reference to 'URI'

Import mechanism has been superseded

Back to the top