Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Two DSL, single project, Activator&injector issues
Two DSL, single project, Activator&injector issues [message #1755248] Wed, 01 March 2017 15:45 Go to next message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
Hi guys,
i merged my two dsl in a single project, where dsl A uses DSL B for expressions.
I Also merged my workflow into a single file like this>
Workflow {

	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "com.mentor.saphirerl"
				rootPath = rootPath
				runtimeTest = {
					enabled = true
				}
				eclipsePlugin = {
					enabled = true
				}
				eclipsePluginTest = {
					enabled = true
				}
				createEclipseMetaData = true
			}
			code = {
				encoding = "windows-1252"
				lineDelimiter = "\r\n"
				fileHeader = "/*\n * generated by Xtext \${version}\n */"
			}
		}
		language = StandardLanguage {
			name = "com.mentor.SaphireExp"
			fileExtensions = "exp"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}
		language = StandardLanguage {
			name = "com.mentor.SaphireRL"
			fileExtensions = "srl"
			referencedResource = "platform:/resource/com.mentor.saphirerl/model/generated/SaphireExp.genmodel"
			}
		
	}
}

When using the DSLs in my external program i have no problem, but when trying to use the eclipse generated app, i get this error:
Quote:

(removed).ui.internal.SaphirerlActivator - Failed to create injector for (removed).SaphireRL

saphirerl.ui.internal.SaphirerlActivator - com.google.inject.internal.util.$ComputationException: java.lang.StackOverflowError
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)

And then i can't open my files.
Do you have any tip how what's going on and how to fix it?
Thanks and best regards!
Re: Two DSL, single project, Activator&injector issues [message #1755352 is a reply to message #1755248] Thu, 02 March 2017 14:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
no i have no idea on what. having a minimal reproducible example would be helpful.
(or at least a stacktrace that contains everything)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755645 is a reply to message #1755352] Mon, 06 March 2017 13:58 Go to previous messageGo to next message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
Hi,
thanks for your reply.
I'm attaching the stack trace (it's too large, i omitted some of the repetitions)

I have this grammar A that only handles expressions, since i need to provide expression level validation, i implemented it as a separated project, the initial definition is:
grammar com.mentor.SaphireExp with org.eclipse.xtext.common.Terminals

generate saphireExp "http://www.mentor.com/SaphireExp"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

ExtExpression:  testExpr=TestExpr | expr=Expression ;

Expression:  OrExpression  ;

TestExpr:
	'?' (var=VarName | alias=ID) '->' (comparators+= Comparator)+ ('default' ':'   defaultExpr=Expression)?
;

Comparator:
	((alias=ID| string=STRING) ':' expression=Expression ";" ) 
;
(etc...)

And then i have grammar B, which handles structural and definition aspects, including many expressions as part of said structure. It is using grammar A:
rammar com.mentor.SaphireRL with com.mentor.SaphireExp

generate saphireRL "http://www.mentor.com/SaphireRL"

import "http://www.mentor.com/SaphireExp" as saphireExp
import "http://www.eclipse.org/emf/2002/Ecore" as ecore


Model :
   (sections+=Section)*;
  
(etc...)


I merged both projects just copying the xtext file from grammar A, including the mwe2 file for it, into grammarB.
When i want to generate the code, i first run mew2 for grammar A, then the workflow for grammar B, which is modified as seen in my first post.
Everything works fine, my both extensions are recognized (meaning i can parse and validate expressions and the complex language), but i cannot use the generated eclipse project, because it fails when tryin to open my files with the stack trace attached.
I hope this clarifies a bit more my problem, maybe i'm missing some additional steps when merging the projects, but i wouldn't know where to start looking.
thanks again for your help, it's very appreciated.
Re: Two DSL, single project, Activator&injector issues [message #1755648 is a reply to message #1755645] Mon, 06 March 2017 14:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
can you share the workflow as well

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755651 is a reply to message #1755648] Mon, 06 March 2017 15:12 Go to previous messageGo to next message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
Sure!
Here are the .text files (exp is the expression oriented grammar and RL is the complete language)
Regards!
Re: Two DSL, single project, Activator&injector issues [message #1755661 is a reply to message #1755651] Mon, 06 March 2017 16:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
why two mwe2 files? i thought you want to have only one

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755672 is a reply to message #1755661] Mon, 06 March 2017 17:50 Go to previous messageGo to next message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
If i don't run the EXP one, the model for it won't be generated, and since it's required by the second grammar it will fail.
I'm pretty sure i don't know how to do things, and that's why the UI is failing
Sad...
Regards
Re: Two DSL, single project, Activator&injector issues [message #1755677 is a reply to message #1755672] Mon, 06 March 2017 18:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i still cannot reproduce. it might have todo with generated once files.
maybe you can create a fresh project and copy the xtexts there

language = StandardLanguage {
			name = "com.mentor.SaphireExp"

			fileExtensions = "exp"

			serializer = {
				generateStub = false
			}
			validator = {
				// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
			}
		}
		language = StandardLanguage {
			referencedResource = "platform:/resource/org.xtext.example.mydsl/model/generated/SaphireExp.genmodel"
			name = "com.mentor.SaphireRL"
			fileExtensions = "rl"

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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755680 is a reply to message #1755677] Mon, 06 March 2017 19:05 Go to previous messageGo to next message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
I really appreciate the effort!
This is the actual set of projects, sorry for not posting them before, but since it's not actually mine, it gets complicated.
I tried the new project approach, with a single mwe2, but it still wants the ecore package from the EXP grammar and it's not finding the references.
Maybe with the full set of files you can get a clearer picture (i hope)
Thanks again!
  • Attachment: SRL.zip
    (Size: 2.60MB, Downloaded 79 times)
Re: Two DSL, single project, Activator&injector issues [message #1755681 is a reply to message #1755680] Mon, 06 March 2017 19:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
this wont work.
one project, one workflow


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755685 is a reply to message #1755681] Mon, 06 March 2017 19:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hmmm did some cleanup/regen and it works fine.
feel free to diff

  • Attachment: export.zip
    (Size: 2.54MB, Downloaded 105 times)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Two DSL, single project, Activator&injector issues [message #1755693 is a reply to message #1755685] Mon, 06 March 2017 20:19 Go to previous message
Rodrigo Ruiz is currently offline Rodrigo RuizFriend
Messages: 28
Registered: March 2017
Junior Member
That was awesome, thank you very much, i'll study this in detail.
have a nice day!
Previous Topic:Servlet Session ID
Next Topic:Xtext formatting language
Goto Forum:
  


Current Time: Fri Apr 19 17:01:57 GMT 2024

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

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

Back to the top