How can I enable Groovy plugin features in my eclipse plugin? - groovy

I am writing an eclipse plugin which needs to support features from the Groovy eclipse plugin.
The Groovy website talks about Groovy eclipse plugins, and Groovy compiler support within eclipse and maven, but I did not find anything similar to what I need to do here.
If I look at the list of available plugin dependencies, I see a number of them:
How can I enable some discovery mechanism or otherwise, in order to install the Groovy plugin after the installation of my plugin completes?
Which plugin can I add as dependency to achieve this? Or should I have to individually add all of them?

If you want to add single plug-ins you can easily do that in the Manifest-Editor of your plug-in. If you need to add a dependency to a feature, you need to create a feature for your own plug-in and add the additional feature dependency in the feature-Editor.
To find out which groovy plug-ins are required to add the "groovy compiler support", I suppose you must rather look at the groovy features in your installation. Usually complex features like a compiler or the like are grouped within a feature.
Add on:
I think the discovery mechanism is already integrated in p2.
I suppose these plug-ins are part of a feature. Find this feature and add that to your product.
For stability I would recommend to add the specific plug-ins to your product/feature. That way you can be sure, people are using the exact version you proposed in your implmentation.

Related

CodeNarc - disable few rules

I am working on static Groovy scripts analysis. Only tool I've found is CodeNarc, but how can I edit rulesets, without editting CodeNarc.jar?
I am calling CodeNarc from command line:
java -classpath "binary-tools/CodeNarc/groovy-all-2.4.6-jenkins-1.jar:binary-tools/CodeNarc/CodeNarc-1.0.jar:binary-tools/CodeNarc/log4j-1.2.17.jar:binary-tools/CodeNarc/slf4j-api-1.7.2.jar:binary-tools/CodeNarc/slf4j-jdk14-1.7.2.jar" org.codenarc.CodeNarc -rulesetfiles="rulesets/basic.xml,rulesets/generic.xml,rulesets/logging.xml,rulesets/dry.xml,rulesets/serialization.xml"
I see that I can specify which rulesets form INSIDE CodeNarc I can use, I'd like to disable single rules from given ruleset. How to do it?
Depending on what you are using to manage the jar, there should be a configuration option available to set the rules. The location will vary depending on the configuration in gradle, etc. You can see more at http://codenarc.sourceforge.net/codenarc-configuring-rules.html I highly recommend configuring the ruleset to your preferences as some rules are better for certain types of groovy projects than others. If you add some info about your project type (grails, spring boot, etc) and your build system(gradle, maven, etc), I can provide more specific help.

CodeNarc Maven Plugin

We have a project that uses Groovy extensively and we use Maven to build our artifacts. (IntelliJ as our IDE)
We wanted to incorporate some automated code-style checking, and thought we might use codecarc-maven-plugin. However, since that was from Codehaus, which gone now, is the plugin actively supported somewhere else?
Any other good options to run a Groovy style checker automatically during a Maven build?
That's a good catch. I'll add a pull request to update the website link. You can find the new plugin information on GitHub: https://github.com/gleclaire/codenarc-maven-plugin

Using JetBrain's MPS to create an editor plugin

Can I use MPS to create a "conventional" language plugin for IntelliJ?
It looks like MPS' core feature is the transcription from a DSL to Java. However I just want to define the DSL syntax and editor to ship it as a standalone language plugin via the JetBrain plugin repository.
I am uncertain whether that is the purpose of MPS or I have to use the Grammar-Kit to create the plugin as it is described here.
Yes, MPS allows you to create IDEA plugins, just like the Grammar-Kit does. Take the MPS route, if you need any of its core features - projectional editor, modular languages or multi-stage code generator.
Vaclav

Errbot: How can I import one plugin from another

In this case I have a simple JIRA plugin, I'd like to create another plugin that also interacts with JIRA via the first plugin. I have been trying variations of errbot.plugin_manager.get_plugin_obj_by_name('jira') but I haven't found the right way to do this.
You are in luck, it just got implemented in the 4.3.0 version released yesterday:
Basically you need to declare the dependency in the .plug with DependsOn in the [Core] section then you can get the plugin object you depend on with self.get_plugin('pluginName').
https://github.com/errbotio/errbot/blob/master/docs/user_guide/plugin_development/dependencies.rst

How to get dependency list in gradle

I'm developing a plugin for gradle, that will check license types for dependencies. I didn't find anything in plugin API how to get dependency list for the project and then retrieve it's metadata (like license type).
Is it possible in gradle?
For analyzing dependencies in general, check out Configuration in the Gradle Build Language Reference, in particular Configuration.resolvedConfiguration and Configuration.incoming.
That said, Gradle's dependency model doesn't capture licenses. Unless you have some external service that you can query for this information, the other option is to parse Maven/Ivy module descriptors.
Gradle doesn't currently give direct access to Maven/Ivy module descriptors. Instead you'll have create a detached configuration, populate it dynamically with dependencies pointing to the descriptors, resolve the configuration, and parse the descriptors yourself (e.g. with Groovy's excellent XmlSlurper). It's not trivial, but doable.
Another approach is to use the license reporting capabilities of repository managers such as Artifactory combined with Black Duck.

Resources