Writing plugin for IDL-like language

I have a simple IDL-like language that I run through a processor to produce java classes that I can then reference from the java world.

I'd like to write a simple plugin to make my life easier in IDEA and I'd like to bounce ideas with the OpenAPI Gods to see what the right approach could be.

Ideally:
1. when opening up the project fresh, the java references to the not-yet-generated classes would not be red. Instead, they would point to the right spot in the IDL-like file.
2. when compiling the project, my plugin would step in to generate the .java classes (if necessary) before the compiler takes over; the classes would be generated in a location that isn't the normal source tree and doesn't interfere with source control (i.e. IDEA doesn't ask me to add them to source control and such.)


Is 1 feasible, or should I expect to have to generate the .java classes before all the references can be resolved?

What is a good location for the generated classes?

Would there be a plugin out there that does something roughly similar that I could draw inspiration from?

I've been away from plugin development for several years now so it's like starting all fresh again..

Thanks

  Vince.

0

I don't have any helpful suggestions, but just wanted to mention that having a Google Protocol Buffers plugin for IDEA would be nice.

0

Hi Vincent,

the Jangaroo EXML plugin does something similar: it generates ActionScript 3 from an XML format.
We chose the following approach:

  • We use a Maven-based approach.
  • Generate code in Maven's "generate code" phase (sic!), which is usually executed when (re-)importing a Maven project into IDEA.
  • Generate code on IDEA's "Build | Make Project"
  • The code is placed outside the normal source tree (src/main/...), namely target/generated-sources/... However, the plugin tells IDEA that this is a source directory, too. The advantage is that IDEA finds and compiles the generated files, the disadvantage is that you cannot hide them from the developer.

Unfortunately, although the plugin is meant to be open source, we don't have the plugin code online yet. If you are interested in code, feel free to contact me.
Also, there is an javascript:; in compiler chaning that could well apply to the Java compiler, too.

Greetings,
-Frank-

0

Not directly related with the original message, but there's actually a plugin for Google protocol buffers: http://plugins.intellij.net/plugin/?idea&id=4942

0

请先登录再写评论。