1
votes

I would like to know if there is a way to organize multiple DSLs inside a single Eclipse project. More specifically, I would like to organize all five Xtext projects of a DSL in some top-level "project folder".

The background is that we manage complexity and enable reuse by making smaller reusable DSLs, e.g. one reusable for expressions and other one for more domain-specific or application-specific aspects. However, each Xtext DSL results in 5 projects, causing a lot of clutter in the Package Explorer when multiple DSLs are involved. A strongly related question has been asked before:

Xtext: define 2 DSL's in one project

The answer there is that multiple DSLs are not needed inside the project for that specific use-case. My use-case is different because I want to be able to easily view the different DSLs and potentially co-develop them.

We are using Xtext in an environment managed by Gradle. We are using the Gradle Eclipse plugin, which creates a lot of Eclipse project files everywhere. As a result, when choosing to "Open Project from File System" in Eclipse, I not only get the option to import the five projects related to the DSL, but also the option of opening the parent folder as a project. This means I can have each DSL (all its five projects) organized neatly in a "project folder". This is exactly what I want! ...

BUT ...

it does not actually work. The figure below shows my package explorer with the five projects of my ExperimentDSL included in the bottom. This DSL works. On top, it shows the folder structure I get when including the project file generated by Gradle, resulting in a "project folder" that can potentially contain multiple DSLs.

enter image description here

As you can see, GenerateExperimentDSL is flagged red and refuses to run. It seems Eclipse somehow treats it as a Java project, but I do not know how to change this or and if this would help solve my problem. Secondly, I would not know how to set up such a project by hand, since the project file in this failing case was generated by Gradle.

Long story short, does anyone know how to get this kind of folder structure to work so that I can keep all my DSLs in the workspace without clutter?

1
It looks like you try to run the workflow from the parent project but you should run it from the dsl project.i recommend you to install gradle buildship in eclipse to get proper support for gradle projects - Christian Dietrich
I have Gradle Buildship installed in Eclipse and we have tasks to manage parts of our project, but not Xtext. The reason I mentioned Gradle is just to provide some background on how I discovered the organization I wanted, even though it is not working. I currently try to run the workflow by simply right-clicking GenerateExperimentDSL.mwe2 and 'Run as MWE2 workflow'. You mention this implies I am running it from the parent project. Is there anyway I can manually set up the structure I want manually and make it work by running it from Eclipse? - Benny Akesson
This is what I meant buildship should do that - Christian Dietrich
I am not quite sure what you mean here. Do you mean that: 1) Buildship should be able to do that with my current setup and it should be working out-of-the-box, or 2) I should use Buildship differently to achieve this? In that case how? - Benny Akesson
Simply create a new xtext project using the wizard. Go to the xxx.mydsl project and run the workflow there - Christian Dietrich

1 Answers

0
votes

What you try to do is currently not possible. Have a look at the concept of WorkingSets in Eclipse that let you achieve something similar