Code generation from DSL [message #1862440] |
Tue, 05 December 2023 15:08  |
Eclipse User |
|
|
|
I have a very basic question for which i cannot easily find an answer with google and here it goes:
Starting with https://github.com/LorenzoBettini/packtpub-xtext-book-2nd-examples/tree/master/org.example.entities.parent i want to do the DSL to java generation from the command line using a mwe2 workflow.
There are DSL examples (MyModel.entities) in generatormain.tests and standalone.tests and there is a Xtend generator EntitiesGenerator extends AbstractGenerator. It is possible to execute the EntitiesGenerator in both test projects, but mwe2 is not used here.
Is this (doing the DSL instance(s) to Java translation in a mwe2 workflow) a reasonable target and how do i achieve it?
|
|
|
|
Re: Code generation from DSL [message #1862451 is a reply to message #1862444] |
Tue, 05 December 2023 18:25   |
Eclipse User |
|
|
|
Hi Tamás, this is a nice overview, but most of it is already in the LB book/code and it does not answer my question: Is there a short best practice solution utilizing a mwe2 workflow?
In fact there is a solution, i could write a generator implementing IWorkflowComponent where the generator is entered through invoke().
But that does not look like "best practice", is there perhaps something utilizing the mwe2 clauses language=, fragment=, or something i do not fully understand as of now?
|
|
|
|
Re: Code generation from DSL [message #1862459 is a reply to message #1862456] |
Wed, 06 December 2023 08:30   |
Eclipse User |
|
|
|
A workflow can be easily executed with both eclipse and maven. And i would be a little surprised if this were not possible. If making the Generator a IWorkflowComponent is the only way to go (apart from the "standard" non mwe2 ways), then the discussion ends here.
But is it true? I know there are several non mwe2 ways to execute the generator. But i am curious about the possible mwe2 case.
What about language=, fragment=, bean=, IXtextGeneratorFragment, GeneratorComponent ...
Any possibility to latch in among them? Can IXtextGeneratorFragment, GeneratorComponent be reused by language developers or are they "internal use" only?
|
|
|
Re: Code generation from DSL [message #1862461 is a reply to message #1862459] |
Wed, 06 December 2023 08:48   |
Eclipse User |
|
|
|
you basically need to provide your workflow component.
or use org.eclipse.xtext.generator.GeneratorComponent
IXtextGeneratorFragment etc are for Xtext grammar file => Xtext language code.
what is the problem with
org.eclipse.xtext.generator.GeneratorComponent
[Updated on: Wed, 06 December 2023 08:50] by Moderator Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04151 seconds