[Xtend] provide interface for generation [message #1693208] |
Wed, 22 April 2015 08:18  |
Eclipse User |
|
|
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds