Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsUsing Xtend for template code generation without a grammar
https://www.eclipse.org/forums/index.php/mv/msg/628217/1220225/#msg_1220225
Initially (prior to discovering DSLs) I wrote a bunch of block classes directly in Java, until I got tired of the repetition and figured out the easier way to do it (Xtext/Xtend). Some of those original classes written in Java have more elaborate features than is possible to represent with my current DSL model. I am OK leaving those written in Java for now but I would still like to use my unit test code generator to create unit test cases for them.
And rather than reading a DSL source file, I'd prefer to have the test code generator simply look in a specific place for a specific file name pattern (*CADBlock.java) and then use that name to generate the test case classes for each matching file.
Right now the test case code is isolated in its own Xtend class so all I have to do is to instantiate the class and send it a block class name (i.e. the "*" in *.CADBlock.java). I know that the DSL code generator gets triggered when I save a DSL source file. However, this is part of my DSL workspace, not my application workspace (which uses the DSL plug-ins).
I guess I could import the relevant code-generator Java code into my application workspace. Then I could have Java code look for the matching files and then send the substring over to the Java version of the code generator, to create the unit test classes each time the application runs, right before they are used. It seems a little clunky. Any suggestions as to a cleaner approach? I don't want to have to maintain two copies of the test code generator Java source.]]>Gary Worsham2013-12-10T13:28:21-00:00Re: Using Xtend for template code generation without a grammar
https://www.eclipse.org/forums/index.php/mv/msg/628217/1220280/#msg_1220280
sorry i actually understand nothing. can you please elaborate what you actually want todo
and of course you can use xtend to generate code without grammar.]]>Christian Dietrich2013-12-10T19:35:42-00:00Re: Using Xtend for template code generation without a grammar
https://www.eclipse.org/forums/index.php/mv/msg/628217/1220296/#msg_1220296
Gary Worsham2013-12-10T22:36:17-00:00Re: Using Xtend for template code generation without a grammar
https://www.eclipse.org/forums/index.php/mv/msg/628217/1220320/#msg_1220320
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de]]>Christian Dietrich2013-12-11T06:30:31-00:00