Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Grammar Mixins/Library vs. Tycho/Maven build(How to keep/pre-generate the .genmodel files required to process dependent grammars?)
Grammar Mixins/Library vs. Tycho/Maven build [message #1768014] Wed, 12 July 2017 21:20 Go to next message
Volker Wegert is currently offline Volker WegertFriend
Messages: 182
Registered: July 2009
Senior Member
Hi all,

I have run into some trouble that I don't really know how to untangle. The project I'm working on contains multiple .xtext files - one is a "library" that contains nearly all of the language elements, the other ones import that library and simply define different top-level expressions to represent different objects from that language in different files. The latter files are the ones that are actually define the "concreate languags" and are used to generate the editors and other stuff, very similar to the situation described in https://eclipse.org/Xtext/documentation/301_grammarlanguage.html#grammar-mixins.

In the .mwe2 file, the "library" language is listed first, followed by the other languages. The manual build process (executing the .mwe2 file) appeared to work well for a time - I now realize that it did because I created and compiled the library first and added the concrete language files later on, so that the library.genmodel file was already present at the time the first concrete library was added.

Now I've started to use Maven/Tycho for this project and promptly ran into an issue: Some component cleans out the generated .ecore and .genmodel files from /model/generated before the .mwe2 workflow is executed. (I've already removed the directory from the maven-clean-plugin configuration in the POM, but the files are still deleted - I haven't yet figured out which component is responsible for that, but that isn't my main issue since relying on a pre-existing and probably outdated .genmodel file is not what I want to achieve.) I somewhat naively expected the files to simply be re-generated, but it doesn't appear to be that simple.

From what I understand, the .genmodel file of the library is required to interpret the concrete languages, and since it was deleted, the entire .mwe2 workflow fails to execute with "Couldn't resolve reference to Grammar/EPackage" messages. I believe that I need to separate the workflow into two parts, but I haven't yet been able to figure out how to do so and keep the stuff that generates the language-independent stuff (like the plugin components, tests and other stuff) working. https://eclipse.org/Xtext/documentation/350_continuous_integration.html does not appear to contain information relevant to this case (and appears to be outdated, since it still uses URI references to the language files while the wizard already generates name references... am I right...?) I would be very grateful for some pointers on how to handle this dependency problem.

Thanks in advance
Volker
Re: Grammar Mixins/Library vs. Tycho/Maven build [message #1768021 is a reply to message #1768014] Thu, 13 July 2017 05:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
i wonder what you are exactly doing. my simple example with one workflow works fine

language = StandardLanguage {
			name = "org.xtext.example.mydsla.MyDslA"
			fileExtensions = "mydsla"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}
		language = StandardLanguage {
			referencedResource = "${rootPath}/org.xtext.example.mydsl/src/org/xtext/example/mydsla/MyDslA.xtext"
			name = "org.xtext.example.mydslb.MyDslB"
			fileExtensions = "mydslb"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Grammar Mixins/Library vs. Tycho/Maven build [message #1768022 is a reply to message #1768021] Thu, 13 July 2017 05:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
p.s. in eclipse it was working because it already copied stuff to target/classes so that it can be found on the classpath automatically

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Grammar Mixins/Library vs. Tycho/Maven build [message #1768036 is a reply to message #1768022] Thu, 13 July 2017 07:22 Go to previous message
Volker Wegert is currently offline Volker WegertFriend
Messages: 182
Registered: July 2009
Senior Member
Thanks, that worked. I didn't even try that because a) referencedResource is not mentioned in the documentation at all, and b) when I found out about it in the forums, it was always suggested to specify the .genmodel file.
FYI - The workflow did not work in Eclipse after the generated model files were deleted by the Maven build - I had to revert to the repository files to get the workflow working again.
Anyway, it's working now, many thanks!
Previous Topic:mismatched input '"urn:ietf:params:xml:ns:yang:smiv2:SNMPv2-MIB"' expecting '"'
Next Topic:How to remove the dependency of "org.eclipse.xtext.common.types.ui" plugin
Goto Forum:
  


Current Time: Tue Sep 24 07:54:40 GMT 2024

Powered by FUDForum. Page generated in 0.04006 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top