Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Infer DSL by using ANT(Infer DSL by using ANT)
Infer DSL by using ANT [message #1479339] Wed, 19 November 2014 10:55 Go to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Hi,

my DSL is designed to generate a custom persistencelayer. For the code generation I'm using the model inferrer approach.

To integrate the generation into the general build workflow I want to provide an Ant-Target with DSL-sourcefile and target directory as parameters. To achieve this I must call the generation process by my own.

I hoped this thread (Using Xtext and Code Generator without Runtime) is related but as I understand it right he is using the normal generator approach.

Anybody knows how I can call the build process for model inferrer (the process which is invoked if I save my dsl file in the editor) from my class?
Re: Infer DSL by using ANT [message #1479346 is a reply to message #1479339] Wed, 19 November 2014 11:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi

the model inferrer is part of the normal appoach.
the only thing you have to care of is to setup the classpath correct.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Infer DSL by using ANT [message #1479357 is a reply to message #1479346] Wed, 19 November 2014 11:13 Go to previous messageGo to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Christian Dietrich wrote on Wed, 19 November 2014 12:00
hi

the model inferrer is part of the normal appoach.
the only thing you have to care of is to setup the classpath correct.


I've tried to follow your instruction from Using Xtext and Code Generator without Runtime:

Christian Dietrich wrote on Tue, 18 November 2014 16:11
Hi,

(1) adapt the generatorFragment in the workflow to create a java main

Code: [Select all] [Show/ hide]
fragment = generator.GeneratorFragment auto-inject {
generateJavaMain = true
}

(2) regenerate the language. you find now a java main generated for the generator (you may use this one or adapt it for your needs)
(3) run the main once in eclipse
(4) use the export -> java -> runnable jar file wizard to create a all in one jar


But after step 2 there is no main generated. I've tried it with a dummy DSL (the domainmodel example) without model inferrer and without xbase and a main was generated.
Re: Infer DSL by using ANT [message #1479369 is a reply to message #1479357] Wed, 19 November 2014 11:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes - i thought that would be clear - or at least not matter - you have to create the main yourself.
you may have a look at xbase / xtend tests to see how to initialize the resourceset etc.
feel free to file an enhancement request on that


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Infer DSL by using ANT [message #1479378 is a reply to message #1479369] Wed, 19 November 2014 11:32 Go to previous messageGo to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Can you please tell me where I can find the xbase / xtend tests you mentioned?
Re: Infer DSL by using ANT [message #1479384 is a reply to message #1479378] Wed, 19 November 2014 11:38 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
they should be somewhere in xtexts source code at git.eclipse.org.
doesnt the domain model example contain such tests?
afaik Lorenzo Bettinis Xtext Book covers that as well


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:customizing the outline view
Next Topic:XMI model from xtext file
Goto Forum:
  


Current Time: Thu Apr 25 08:55:39 GMT 2024

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

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

Back to the top