[PDE-Build] Build Groovy files [message #649966] |
Fri, 21 January 2011 04:06  |
Eclipse User |
|
|
|
Hi all,
I am more and more thinking to write some pieces of code in Groovy, aainly in my test plug-ins. That would reduce the cost of writing tests for the same coverage as Java.
I gave it a try yesterday, and could successfully integrate a Groovy class to a plug-in which had the Groovy nature enabled. So that I could run my Groovy test in my development workbench. The Groovy builder automatically generated me the .class file for my .groovy file, and I could use it in the uitestapplication. Good.
It became more complicated when I tried to use this test in headless build. Indeed, it seems that the headless build did not invoke the Groovy builder so that the .class was not generated. Before this event, I thought that the PDE-Build was relying on the JDT compiler, so that the Groovy compilation would be automatically triggered in automated build. But it seems that it is not the case.
An alternative would be to tweak the plug-in's build.xml to add a groovyc task, but that's not straightforward.
Are there any easier workarounds to get it working? Are there plans to make PDE-build extensible to allow JDT extensions such as Groovy-Eclipse to add their steps at compile-time?
Thanks in advance.
--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
|
|
|
|
|
|
|
|
Re: [PDE-Build] Build Groovy files [message #650949 is a reply to message #650884] |
Thu, 27 January 2011 04:26   |
Eclipse User |
|
|
|
> That's basically right. With the ant bug patched, you can create a Compiler adapter for groovy like this (much simpler than what is shipped with Groovy-Eclipse, but the same basic functionality):
>
>
> public class GroovyCompilerAdapter extends JDTCompilerAdapter implements CompilerAdapterExtension {
> public String[] getSupportedFileExtensions() {
> return new String[] { "*.java", "*.groovy" };
> }
> }
>
>
> You also need to edit your build.properties file as described in the blog post, but you can skip specifying the file extensions a second time.
What I have in mind is more a JDTCompilerAdapter that would come with an extension point to add support for other extensions, then there wouldn't have anything to change in build.properties, and PDE-build would be able to build Groovy whenever the extension for .groovy files is present in the platform.
Or to have a ExtensibleDispatcherCompilerAdapter that would dispatch the compile steps to several CompilerAdapter (eg JDT, Groovy) according to their extension.
That way, we could imagine to have plugin in any JDT-friendly language, and to have polyglot bundles without other effort than installing a new language support in Eclipse. This would allow people to write bundles in most of JVM languages. (currently Java, Groovy, Scala; and probably Clojure, Jython and so on in the future...).
--
Mickael Istria -- BonitaSoft S.A.
http://www.bonitasoft.com/products/BPM_download.php
|
|
|
|
Re: [PDE-Build] Build Groovy files [message #651021 is a reply to message #651020] |
Thu, 27 January 2011 08:29  |
Eclipse User |
|
|
|
But, this does make me think of one way that this can be easier. Since we are patching JDT to release wth Groovy-Eclipse, we can patch the compiler adapter as well so that for plugin developers, it is transparent to compile Groovy code (ie- no need for augmenting the buld.properties).
|
|
|
Powered by
FUDForum. Page generated in 0.05920 seconds