Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] provide interface for generation
[Xtend] provide interface for generation [message #1693208] Wed, 22 April 2015 12:18 Go to next message
Bastian Mohrmann is currently offline Bastian MohrmannFriend
Messages: 12
Registered: November 2014
Junior Member
Hello eclipse community,

i am currently working on an Xtend plugin that generates some code out of an ecore model instance. I want to implement an interface with which the generation can be started. So far i tried the following:

1. I tried calling the mwe2 workflow from a Maven script and i failed (i am new to Maven and tried out the fornax-oaw-m2-plugin but couldn't get it running)
2. I tried to provide a java interface that calls the mwe2 programmatically by the Mwe2Launcher. It works by rightclick->Run as, but does not work after exporting the plugin anymore...
3. Now i want to create a simple java method that gets as input the file path to the input models and starts the xtend templates on it. All i got right now is this class, but i really have no idea how to call it from another ANT file or Maven script
class MainGenerator2 implements IGenerator{

	override doGenerate(Resource input, IFileSystemAccess fsa) {
        for(generatedFile : CartridgeController.getInstance.testCartridge.doGenerate(input.contents)) {
           	fsa.generateFile(generatedFile.name + generatedFile.extension, '''
        	«FOR f:generatedFile.headerContent»
				«f»
        	«ENDFOR»	
			
        	«FOR f:generatedFile.content»
      			«f»
   		«ENDFOR» 
        	''')
         }
	}
}


I hope someone can link me a good tutorial or just give advise about the best practice here... I implemented the whole code generation by myself but i am really stuck right now and after hours of searching i am quite exhausted.

Regards and thanks in advance,
Bastian
Re: [Xtend] provide interface for generation [message #1693212 is a reply to message #1693208] Wed, 22 April 2015 12:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

did you have a look at the xtext-maven-plugin?
i have included it into my example

https://github.com/cdietrich/xtext-maven-example/blob/master/org.xtext.example.mydsl.model/pom.xml

Btw better ask questions on the new xtend/xtext in the xtext forum


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend] provide interface for generation [message #1693694 is a reply to message #1693212] Mon, 27 April 2015 15:23 Go to previous message
Bastian Mohrmann is currently offline Bastian MohrmannFriend
Messages: 12
Registered: November 2014
Junior Member
Hi,

thanks for the response.

I checked your code, but i am currently not able to understand it. I have to get into Maven a little bit more i think Smile

I implemented a workaround in java that works without mwe2 and the IGenerator interface.

Nevertheless, thanks for the fast response.

Regards,
Bastian
Previous Topic:XTend + artop combined sdk
Next Topic:[XPAND] java.net.MalformedURLException: unknown protocol: ar
Goto Forum:
  


Current Time: Fri Apr 19 00:22:47 GMT 2024

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

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

Back to the top