I’m currently trying to develop a Gradle plugin for a domain-specific language (DSL) that we use in our company (which is essentially an external DSL that has its own syntax and tools to develop and run programs, most importantly a compiler and a runtime). I had a look on Gradle’s Antlr, Groovy, and the org.grade.language.base.plugins.LanguageBasePlugin, in this order. In the beginning, I was hoping that I can take one of the former two as a guideline. After some time I had to realize that this doesn’t make sense, at least to me, because both build on top of the Java plugin; in particular, both depend on Java source sets somehow in order to define Antlr and Groovy source sets, respectively. Our DSL, however, is not related to Java in any way. So I went on and had a look at the LanguageBasePlugin. The class is currently tagged as
Incubating, which raises the question whether one should rather not use it at its current state. Also, the class and everything around it is documented so little that it’s really hard to understand all that stuff. I’m not complaining, I just realized that the lack of documentation and “hello world” examples prevents me from making considerable progress.
What I’d like to ask here is whether someone can provide me some hints and guidance on how to get started with developing a plugin that adds Gradle build support for another language. More precisely, what would be needed is essentially
- a new type of source set that can be used to specify places where source code files to compile are located,
- a task that takes source sets specified by 1.) as its input (plus some more properties to configure it) and essentially iterates over each source code file and invokes our compiler, which is a command-line executable.
The second point is actually almost clear to me. It’s more the first point and how to wire everything together. A kind of hello world example based on the LanguageBasePlugin, if you consider it stable enough, would probably help most.