Regenerate XText code in Eclipse?

@maintainers I’m trying to get a clean Eclipse build for diagnosing why the OH2 JSR223 functionality is broken in the snapshot builds (and to set up an environment for creating script examples for documentation). It appears that some of the generated xtend/xtext-related code needs to be regenerated (in …model.rule.runtime, for example). How is that done? I’m also interested in any other suggestions about how to keep the Eclipse workspace and project definitions up-to-date. I am working on the HEAD of the smarthome master branch. Thanks.

Hi @steve1,

Glad to hear that you want to start working on the documentation! I was just about to poke you and @smerschjo again about it. @lewie also already started testing it with his JS examples.

Why do you say that it is broken? Adding JS files in conf/automation/jsr223 I was able to get JS rules executed and shown in the Paper UI as well. I saw a couple of issues (some of which I fixed already), but I wouldn’t call it “broken” in general.

Wrt ESH development: The better place to ask such questions is https://www.eclipse.org/forums/index.php/f/271/.
The ESH IDE setup guides you through the process of generating Xtext files.
BUT: The new jsr233 stuff uses the NEW rule engine, so you do not need the Xtext/model stuff at all in your IDE. So my suggestion is that you use the normal OH2 IDE and simply import the org.eclipse.smarthome.automation bundles into your workspace, add them to the launch config and start using and debugging that code.

The scripts are being loaded multiple times (for the same script, as if OH2 doesn’t realize the script is already loaded) and the script unload callbacks are not happening when the script is deleted. There is a topic that provides more details and that references an open SmartHome issue as a possible cause.

I did look at that page before posting. I didn’t see anything that explicitly described the Xtext generation. I assumed the “Setup tasks” would do it. I ran those in my current workspace and that didn’t solve the problem. I tried installing Eclipse from the beginning using the instructions on the page. That didn’t work either. This is on a Mac, if that’s relevant (I assume it isn’t).

I’ll try to determine which automation bundles are needed to add to my workspace. It’s a bit frustrating because my time availability to work on documentation is very limited and I’m spending most of it trying to set up an IDE environment that builds correctly. This is the same base environment I used for JSR223 development a few months ago.

I can only repeat myself: It is very straight forward to use any existing OH2 IDE setup and merely import all automation bundles into it. Should be a matter of a few minutes only.