Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » migrating to xtext-maven-plugin
migrating to xtext-maven-plugin [message #1441913] Fri, 10 October 2014 11:03 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I'm trying to migrate away from the fornax plugin and have some questions regarding xtext-maven-plugin

1. One of the reasons we need to change our maven configuration is: in projects with large number of dependencies the fornax invocation is hitting the windows limit of max command line length. Am I assuming correctly, that the new maven plugin does not force *fork* and hence shouldn't have this kind of problem?

2. A general xtend question: I had some exceptions thrown from classes like org.eclipse.xtext.builder.standalone.StandaloneBuilder. Is there a tool that lets me map line numbers from the stack trace back into xtend source line numbers?

3. It seems I need some way for controlling resource loading. Symptom: I registered the StandaloneSetups of two DLSs, where DSLB references DSLA. During maven build models from DSLB are loaded before DSLA and no cross references can be resolved as the validator output shows. How can I fix this?

4. Does the maven plugin support any configuration options beyond the minimal set shown in the documentation?

thanks,
Stephan
Re: migrating to xtext-maven-plugin [message #1441942 is a reply to message #1441913] Fri, 10 October 2014 11:51 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stephan,

please find the answers inline.

Am 10.10.14 13:03, schrieb Stephan Herrmann:
> I'm trying to migrate away from the fornax plugin and have some
> questions regarding xtext-maven-plugin
>
> 1. One of the reasons we need to change our maven configuration is: in
> projects with large number of dependencies the fornax invocation is
> hitting the windows limit of max command line length. Am I assuming
> correctly, that the new maven plugin does not force *fork* and hence
> shouldn't have this kind of problem?

The Xtext maven plugin does not fork. It uses the VM of the maven build.

>
> 2. A general xtend question: I had some exceptions thrown from classes
> like org.eclipse.xtext.builder.standalone.StandaloneBuilder. Is there a
> tool that lets me map line numbers from the stack trace back into xtend
> source line numbers?

If you copy an Xtend stacktrace into the Eclipse stacktrace console, you
can click on the links and it *should* bring you to the Xtend file. A
feature request for such a tool / stacktrace rewrite is appreciated.

>
> 3. It seems I need some way for controlling resource loading. Symptom: I
> registered the StandaloneSetups of two DLSs, where DSLB references DSLA.
> During maven build models from DSLB are loaded before DSLA and no cross
> references can be resolved as the validator output shows. How can I fix
> this?

The MVN plugin uses the same phases as the Eclipse build. If you can
build these two DSLs within Eclipse, it should also be possible to build
them with maven. That is, all resources are loaded and indexed before
cross references are resolved. Did you configure any special
load-options in your runtime module?

>
> 4. Does the maven plugin support any configuration options beyond the
> minimal set shown in the documentation?

The Javadoc for the maven plugin should contain all the parameters. See
org.eclipse.xtext.maven.XtextGenerator.

Best,
Sebastian

>
> thanks,
> Stephan
>


--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: migrating to xtext-maven-plugin [message #1441951 is a reply to message #1441913] Fri, 10 October 2014 12:01 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
one more question:

5. I need to pass custom parameters into the generator invocation. With fornax + mwe2 I used a custom subclass of org.eclipse.xtext.mwe.Reader and passed my parameters via mwe2. Is the xtext-maven-plugin prepared for generic parameter passing?
Re: migrating to xtext-maven-plugin [message #1441988 is a reply to message #1441951] Fri, 10 October 2014 13:05 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Thanks, Sebastian, for quick answers!

1. (no fork) - Resolved, great!

2. (rfe xtend stacktrace rewrite) - Put on my TODO list, (unless s.o. else is quicker)

3. (loading / linking) - Here I need to go back to debugging. No specific load options, but could indeed be a bug introduced while migrating from importURI to importedNamespaces.
Scope for DSLA-DSLA cross references has a parent based on FilterUriContainer & StateBasedContainer. This parent is missing when computing scopes for DSLB-DSLA cross references. Any idea how to debug this? I try hard not to interfere with the inner workings of ImportedNamespaceAwareLocalScopeProvider, but apparently I do s.t. that breaks it ...

4. (doc) - Meanwhile I found the sources in git, which told me some, but not all. One thing in the maven log raised my curiosity: "Generating stubs into ..." I have no idea what kinds of stubs these would be nor do I need any, nor do I find an option that would control this. But it doesn't seem to hurt Smile

5. (general parameters) - Thinking about an equivalent of the degrees of freedom we have in mwe2, maybe I should "invent" a special setup class for each concrete set of options. Wouldn't it make sense to allow a nested list of properties inside <setup></setup> and let the setup evaluate this (if it implements an interface - say - IConfigurableSetup)?

Stephan
Re: migrating to xtext-maven-plugin [message #1442030 is a reply to message #1441988] Fri, 10 October 2014 14:19 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stephan,

inline again.

> 3. (loading / linking) - Here I need to go back to debugging. No
> specific load options, but could indeed be a bug introduced while
> migrating from importURI to importedNamespaces.
> Scope for DSLA-DSLA cross references has a parent based on
> FilterUriContainer & StateBasedContainer. This parent is missing when
> computing scopes for DSLB-DSLA cross references. Any idea how to debug
> this? I try hard not to interfere with the inner workings of
> ImportedNamespaceAwareLocalScopeProvider, but apparently I do s.t. that
> breaks it ...

Hard to tell from your description. If some code of yours triggers
EcoreUtil.resolve(..) somehow during indexing, that would be the culprit.

>
> 4. (doc) - Meanwhile I found the sources in git, which told me some, but
> not all. One thing in the maven log raised my curiosity: "Generating
> stubs into ..." I have no idea what kinds of stubs these would be nor do
> I need any, nor do I find an option that would control this. But it
> doesn't seem to hurt :)

It doesn't hurt, that's true. You could disable that by setting the
'javaSupport' option to false for your language.

>
> 5. (general parameters) - Thinking about an equivalent of the degrees of
> freedom we have in mwe2, maybe I should "invent" a special setup class
> for each concrete set of options. Wouldn't it make sense to allow a
> nested list of properties inside <setup></setup> and let the setup
> evaluate this (if it implements an interface - say - IConfigurableSetup)?

That would make for a nice addition though I'm not sure how you'd make
these options available to the code generator or where those would come
from when you build the stuff within Eclipse. Some generic service with
a generic impl based on preferences in Eclipse, based on cmd line args
in standalone and based on maven setup params in mvn would be nice,
though. Again a ticket would be helpful :)

Best,
Sebastian

>
> Stephan



--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: migrating to xtext-maven-plugin [message #1442048 is a reply to message #1442030] Fri, 10 October 2014 14:44 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Quote:
> 3. (loading / linking) - Here I need to go back to debugging. No
> specific load options, but could indeed be a bug introduced while
> migrating from importURI to importedNamespaces.
> Scope for DSLA-DSLA cross references has a parent based on
> FilterUriContainer & StateBasedContainer. This parent is missing when
> computing scopes for DSLB-DSLA cross references. Any idea how to debug
> this? I try hard not to interfere with the inner workings of
> ImportedNamespaceAwareLocalScopeProvider, but apparently I do s.t. that
> breaks it ...

Hard to tell from your description. If some code of yours triggers
EcoreUtil.resolve(..) somehow during indexing, that would be the culprit.


Breakpoints on resolve(..) and resolveAll(..) were not triggered, but the following call chain gets me into a wrong state:

DefaultLinkingService.getLinkedObjects(EObject, EReference, INode) line: 118	
MyXtextLinker(Linker).getLinkedObject(EObject, EReference, INode) line: 209	
MyXtextLinker(Linker).ensureIsLinked(EObject, INode, CrossReference, Set<EReference>, IDiagnosticProducer) line: 118	
MyXtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer, ICompositeNode, Set<EReference>) line: 67	
MyXtextLinker(Linker).ensureLinked(EObject, IDiagnosticProducer) line: 56	
MyXtextLinker(Linker).ensureModelLinked(EObject, IDiagnosticProducer) line: 238	
MyXtextLinker(Linker).doLinkModel(EObject, IDiagnosticConsumer) line: 227	
MyXtextLinker(AbstractCleaningLinker).linkModel(EObject, IDiagnosticConsumer) line: 47	
MyXtextLinker(XtextLinker).linkModel(EObject, IDiagnosticConsumer) line: 239	
LazyLinkingResource(XtextResource).doLinking() line: 290	
LazyLinkingResource.doLinking() line: 107	
LazyLinkingResource(XtextResource).updateInternalState(IParseResult) line: 258	
LazyLinkingResource(XtextResource).updateInternalState(IParseResult, IParseResult) line: 248	
LazyLinkingResource(XtextResource).doLoad(InputStream, Map<?,?>) line: 161	
LazyLinkingResource.doLoad(InputStream, Map<?,?>) line: 100	
LazyLinkingResource(ResourceImpl).load(InputStream, Map<?,?>) line: 1518	
LazyLinkingResource(ResourceImpl).load(Map<?,?>) line: 1297	
XtextResourceSet(ResourceSetImpl).demandLoad(Resource) line: 259	
XtextResourceSet(ResourceSetImpl).demandLoadHelper(Resource) line: 274	
XtextResourceSet.getResource(URI, boolean) line: 229	
StandaloneBuilder.launch() line: 227	


My MyXtextLinker overrides afterModelLinked() but commenting this method has no bearing on my current problem.
So: during indexing - line 227 Smile in StandaloneBuilder - we do all the linking, create a XtextLinkingDiagnostic and afterwards the reference in question is *null*.

Later during validation there's no proxy for us to resolve.

MAYBE, Xtext is confused by the fact that the name of the reference is "name"?

I haven't yet found the location where in this situation a proxy should have been set.

thanks,
S.
Re: migrating to xtext-maven-plugin [message #1442058 is a reply to message #1442048] Fri, 10 October 2014 14:56 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Re linking: I think I found the primary culprit: when I initially created MyXtextLinker, what I found in the super class must have been an XtextLinker, so that's what I sub-classed.

Now I see the default binding to use LazyLinker, which pretty much sounds like what we need here. Still no cigar, but I think I can make progress from here.

thanks,
Stephan
Previous Topic:[2.7.0] Cannot run MWE2 workflow to generate my language anymore
Next Topic:Build with Tycho Fornax raises NPE
Goto Forum:
  


Current Time: Fri Apr 26 02:59:52 GMT 2024

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

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

Back to the top