Tuesday, January 05, 2010

Xtext's new builder infrastructure

The M4 of the current development stream of Xtext (Helios) finally contains the long awaited builder infrastructure. This topic turned out to be a very complex beast, and although we already took two attempts the last one took us about six weeks of very intensive work. But we love the result :-)

What is this builder infrastructure for?
I'd already blogged about the idea of name space based linking.
The builder infrastructure collects lightweight descriptions of all Xtext resources in the workspace. The linking can then use this information. In addition we use this information to compute the transitive hull of affected resources.

Also the builder takes care of validation and will support an extension point where users can hook in code generators and the like. Other features where we'll make use of the new information includes: more sophisticated searches, call graphs, and of course find reference actions. A generic rename refactoring is also something we want to start working on as soon as possible.

The documentation will be updated during the RC phase.

The New & Noteworthy page contains a short screen casts showing the builder in action:



Dirty State aware editing

Note, that state in the builder is shadowed by any dirty editor state:



What about the EMF Index?
Wasn't the EMF Index intended to do this?
It took us some time to find out what Xtext really needs, and in the end we learned that there are a couple of important specialties, like the lazy linking or the linking by name. We didn't want to add those concepts to the EMF index. Therefore we started out to solve the actual problem in Xtext first and later see if the requirements fit and can be handled by the EMF Index project. As a result we came up with a very small interface which can be implemented to use the EMF Index as soon as it supports the needed use cases and is mature enough. Most of the stuff we did is Xtext related, the code which might be replaced by the EMF Index is just a couple of lines.