Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Question] Xtext 2.0 / Xtend2 Generator Development
[Question] Xtext 2.0 / Xtend2 Generator Development [message #710587] Fri, 05 August 2011 07:35 Go to next message
Tobias L. is currently offline Tobias L.Friend
Messages: 24
Registered: July 2010
Junior Member
Hi *,

with the former Xtext 1.0 and Xpand it was possible to develop Xpand Templates without restarting the "runtime-EclipseApplication" Eclipse Workspace.

Now - with Xtend2 - the Xtend2-Generator generates Java-Code from .xtend classes which doesn't have an effekt on the running "runtime-EclipseApplication" Eclipse Workspace. On every change I must restart "runtime-EclipseApplication" Eclipse... not very good Sad

What is the best practise tipp/solution to develop faster with Xtend2?

Best regards,
Tobias.


Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710590 is a reply to message #710587] Fri, 05 August 2011 07:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hi,

what about using a workflow in the "generator development workspace"?
By default the wizard create an mwe file next to the YourdslGenerator.xtend

~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

[Updated on: Fri, 05 August 2011 07:47]

Report message to a moderator

Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710609 is a reply to message #710590] Fri, 05 August 2011 08:04 Go to previous messageGo to next message
Tobias L. is currently offline Tobias L.Friend
Messages: 24
Registered: July 2010
Junior Member
Thank you for your fast reply.

That is so far correct. I followed the 15 Minutes Tutorial and use the MydslGenerator.xtend.

Now, to test my DSL and Generator I start via run as -> eclipse application a new "runtime-EclipseApplication" Eclipse Workspace.
Here i create a new project with a new abc.mydsl file.
By default the MydslGenerator.xtend starts on every change/save on the abc.mydsl file.

So far so good...

Now, I would like to modify something in the MydslGenerator.xtend... The effekt is, that the xtend-gen/.../MydslGenerator.java is generated automatically.
But these changes doesn't have an effekt in the generated output in the
"runtime-EclipseApplication" Eclipse Workspace. I always must restart the "runtime-EclipseApplication" Eclipse Workspace to see
my generator changes.
Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710615 is a reply to message #710609] Fri, 05 August 2011 08:09 Go to previous messageGo to next message
Tobias L. is currently offline Tobias L.Friend
Messages: 24
Registered: July 2010
Junior Member
solved
Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710619 is a reply to message #710615] Fri, 05 August 2011 08:13 Go to previous messageGo to next message
Tobias L. is currently offline Tobias L.Friend
Messages: 24
Registered: July 2010
Junior Member
the generated mwe points to the old @workflow.MydslGenerator.... i changed this to @my.package.MydslGeneratorMWE and voilĂ 
Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710683 is a reply to message #710619] Fri, 05 August 2011 09:53 Go to previous messageGo to next message
Nikolai Busse is currently offline Nikolai BusseFriend
Messages: 15
Registered: August 2011
Junior Member
Tobias Langlotz wrote on Fri, 05 August 2011 04:13
the generated mwe points to the old @workflow.MydslGenerator.... i changed this to @my.package.MydslGeneratorMWE and voilĂ 


Hi Tobias,

could you please give more details to your solution, i.e.
- do you mean the "generated mwe"
/org.xtext.example.mydsl/src/org/xtext/example/mydsl/generator/MyDslGeneratorMWE.mwe2
or some other file?
- where you had "@workflow.MydslGenerator" which you changed?
or is it somewhere in the properties of the model project (which contains src/model.mydsl)?

Thanks in advance,

Nikolai
Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710951 is a reply to message #710587] Fri, 05 August 2011 16:12 Go to previous messageGo to next message
Tobias L. is currently offline Tobias L.Friend
Messages: 24
Registered: July 2010
Junior Member
The Project-Wizard (of your DSL) generates project with a src folder like src/model/Model.mydsl and src/Generator.mwe2.

This generated mwe2 looks like
module Generator

var targetDir = "src-gen"
var modelPath = "src/model"

Workflow {
	component = @workflow.MydslGenerator auto-inject {}
}


This was the default in Xtext 1.0 with an Xpand Project. Now in Xtext 2.0 you have to change this mwe2 to

module Generator

var targetDir = "src-gen"
var modelPath = "src/model"

Workflow {
	component = @my.company.mydsl.MydslGeneratorMWE auto-inject {}
}


There exists a corresponding mwe2 file in your dsl project.

Best Regards,
Tobias.

Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #713230 is a reply to message #710951] Mon, 08 August 2011 08:50 Go to previous message
Nikolai Busse is currently offline Nikolai BusseFriend
Messages: 15
Registered: August 2011
Junior Member
There was no such Project Wizard in my Xtext 2.0 example project. I had to enable the lines
/org.xtext.example.mydsl/src/org/xtext/example/mydsl/GenerateMyDsl.mwe2
            // project wizard (optional)
            fragment = projectWizard.SimpleProjectWizardFragment {
            	generatorProjectName = "${projectName}"
            	modelFileExtension = file.extensions
            }

regenerate the Xtext artifacts and then, merge
/org.xtext.example.mydsl.ui/plugin.xml_gen into /org.xtext.example.mydsl.ui/plugin.xml.

Now, in the runtime Eclipse, the wizard is there and creates a sample mydsl project
with a file Generator.mwe, which has to be fixed to
component = @org.xtext.example.mydsl.generator.MyDslGeneratorMWE auto-inject {}

The intention of Xtext seems to be that, after a model change, the generator runs implicitely with the Build process.
But this way, template changes in the generator are not reflected.
I have to disable the "Build automatically" in the model project and run the Generator.mwe workflow explicitely to see my latest template changes in effect.

Best regards and thanks a lot for your help,

Nikolai
Previous Topic:How do I use my language
Next Topic:Images in HoverProvider
Goto Forum:
  


Current Time: Wed Apr 14 06:05:47 GMT 2021

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

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

Back to the top