Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Multiple output configurations to separate API and Impl code
Multiple output configurations to separate API and Impl code [message #1270205] Wed, 12 March 2014 17:19 Go to next message
Gayan Perera is currently offline Gayan PereraFriend
Messages: 6
Registered: July 2013
Junior Member
Hi,

I have created a DSL which models part my application using xtext. I'm generating interfaces and implementation of some POJOs and Builder classes. My requirment is that API and Impl must be in two different maven artifacts which are submodules. But with xtext eclipse by default generate code the project i have the model file. But by introducing the IConfigurationProvider i manage to output to API and Impl project. But now the problem is the code generation happens at the compile time of the model project which cause the generated API and Impl files to be removed if i execute a clean package in maven. I was wondering whether there is a possibility to move the generation part to API and Impl projects it self, but only output the API classes in the API project and Impl classes on Impl project. Is it possible to load the dsl file from the class path ? But of cause i can have relative path to the dsl file. But main question is whether it is possible to have output configuration as i have mentioned ? Or may be have more customized generation strategy such as used in xtext project generation it self using fragment configuration.


Thanks.
Re: Multiple output configurations to separate API and Impl code [message #1270586 is a reply to message #1270205] Thu, 13 March 2014 07:19 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
AFAIK, you have a lot of options in the Generator to determine
where the output file should go, including abolute paths:
// fsa.generateFile('greetings.txt', 'People to greet: ' +
// resource.allContents
// .filter(typeof(Greeting))
// .map[name]
// .join(', '))
Re: Multiple output configurations to separate API and Impl code [message #1270603 is a reply to message #1270586] Thu, 13 March 2014 07:53 Go to previous messageGo to next message
Gayan Perera is currently offline Gayan PereraFriend
Messages: 6
Registered: July 2013
Junior Member
Do you mean to use multiple generators which are for generating API classes and Impl classes ? If so how can i configure them so that i can run only API generator in API project in maven builds ? Because i'm thinking on removing the build participant from the ui plugin and depend on the maven build to generate code. So any sample that i can refer to get this started ?
Re: Multiple output configurations to separate API and Impl code [message #1270618 is a reply to message #1270603] Thu, 13 March 2014 08:24 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Hi Gayan,

no, in your generator you can have as many fsa.generateFile statements as you need.

Think you can find a couple of threads in this forum about starting the generator outside of the save of a DSL file.

Uli
Re: Multiple output configurations to separate API and Impl code [message #1270676 is a reply to message #1270618] Thu, 13 March 2014 10:11 Go to previous message
Gayan Perera is currently offline Gayan PereraFriend
Messages: 6
Registered: July 2013
Junior Member
Hi Uli,

Yes i have tried the suggestion you have made, but my requirement is bit different. What i want it for do some thing like below.

In API Module:
I want xtext maven plugin to be configured to use only the API code generator.

In Impl Module:
I want xtext maven plugin to be configured to use only the Impl code generator.

In Model Module:
Here i will only have the dsl file which have my model.

So as you can see when each module is built it will only output what it configured to be. Actually in the above setup the model Module will not output any thins.

As i have seen, the xtext maven plugin doesn't seems to support a configuration as above. So i was wondering if there is any other way to get this done. And by the way i like to use ModelInferers if possible with the JvmTypeBuilder if possible.

Thanks.



Previous Topic:Run as... for your DSL
Next Topic:XText 2.4 - 2.5: How to pass information from a AbstractDeclarativeValidator to a ViewPart
Goto Forum:
  


Current Time: Thu Apr 25 17:13:18 GMT 2024

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

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

Back to the top