Skip to main content



      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 03:35 Go to next message
Eclipse UserFriend
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 03:37 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Fri, 05 August 2011 03:47] by Moderator

Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710609 is a reply to message #710590] Fri, 05 August 2011 04:04 Go to previous messageGo to next message
Eclipse UserFriend
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 04:09 Go to previous messageGo to next message
Eclipse UserFriend
solved
Re: [Question] Xtext 2.0 / Xtend2 Generator Development [message #710619 is a reply to message #710615] Fri, 05 August 2011 04:13 Go to previous messageGo to next message
Eclipse UserFriend
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 05:53 Go to previous messageGo to next message
Eclipse UserFriend
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 12:12 Go to previous messageGo to next message
Eclipse UserFriend
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 04:50 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 03:18:12 EDT 2025

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

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

Back to the top