Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generating with xtend and MWE2
Generating with xtend and MWE2 [message #757894] Mon, 21 November 2011 13:02 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
Hi,

I run my xtend2-based generator as a build participant, but now I need
to run it as a batch process in the Eclipse dev. environment. I guess
using a mwe2 workflow is the obvious solution. I've previously done this
with simple projects, but no I have problems getting the setup to work.
The mwe2 file is as follows:

Workflow {

bean = StandaloneSetup {
scanClassPath = true
registerGeneratedEPackage = "org.eclipse.gmt.emfacade.EmfacadePackage"
registerGenModelFile =
"platform:/resource/org.eclipse.gmt.emfacade/model/emfacade.genmodel"

registerGenModelFile =
"platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
registerGenModelFile =
"platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGenModelFile =
"platform:/resource/org.eclipse.emf.codegen.ecore/model/GenModel.genmodel"
}

component = DirectoryCleaner {
directory = "${targetDir}"
}

component = org.eclipse.xtext.mwe.Reader {
// lookup all resources on the classpath
useJavaClassPath = true

// or define search scope explicitly
path = modelPath

// this class will be generated by the xtext generator
register = org.eclipse.gmt.EmfacadeStandaloneSetup {}
uriFilter = org.eclipse.xtext.mwe.NameBasedFilter {
extension = "xef"
}
loadResource = {
slot = "model"
}
}

component = org.eclipse.xtext.generator.GeneratorComponent {
register = org.eclipse.gmt.EmfacadeStandaloneSetup {}

slot = 'model'
outlet = {
path = targetDir
}
}
}

I try to register the relevant EPackages, but I still get the following
error message:
Caused by: org.eclipse.xtext.parser.ParseException:
java.lang.IllegalStateException: Unresolved proxy
platform:/resource/org.eclipse.gmt.emfacade/model/emfacade.ecore#//FacadeModel.
Make sure the EPackage has been registered.

In the model I use namespaces and refer to both ecore and genmodel files
on the classpath. Will this work as expected with mwe2, i.e. will it
find the relevant model files on the classpath, or do I somehow need to
point it to the files that contains the referred to model elements to
include them in the generation process?

Hallvard
Re: Generating with xtend and MWE2 [message #758065 is a reply to message #757894] Mon, 21 November 2011 20:29 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13769
Registered: July 2009
Senior Member
Hi,

did you try a registerEcoreFile?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generating with xtend and MWE2 [message #758159 is a reply to message #758065] Tue, 22 November 2011 08:10 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 21.11.11 21.29, Christian Dietrich wrote:
>
> did you try a registerEcoreFile?

Yes, I tried a couple of combinations of registerGeneratedEPackage,
registerEcoreFile and registerGenModelFile

I've searched for a place where these are described, particularly when
to use each of them, but I haven't found a good explanation. E.g. when
do I register the package class and when do I register the ecore file?

Hallvard
Re: Generating with xtend and MWE2 [message #758160 is a reply to message #758065] Tue, 22 November 2011 08:15 Go to previous message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 672
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On 21.11.11 21.29, Christian Dietrich wrote:
>
> did you try a registerEcoreFile?

Yes, I tried a couple of combinations of registerGeneratedEPackage,
registerEcoreFile and registerGenModelFile

I've searched for a place where these are described, particularly when
to use each of them, but I haven't found a good explanation. E.g.
- when do I register the EPackage class with registerGeneratedEPackage
and when do I register the ecore file?
- will registering the genmodel file also register the ecore file?
- what about used packages (in this case xbase, jvmtype, genmodel), must
they be (EPackages and/or files) registered separately?

Hallvard
Previous Topic:NullPointerException in getFullyQualifiedName
Next Topic:xpand extension with xpand doesnt work as expected?
Goto Forum:
  


Current Time: Fri Mar 05 17:25:11 GMT 2021

Powered by FUDForum. Page generated in 0.01538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top