Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » generation with two dsl
generation with two dsl [message #653331] Wed, 09 February 2011 12:11 Go to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
hello


I created two DSL 'metarepDSL and repoDSL)
repoDSL can use elements declared in a .metarepDSL file.
but metarepDSL don't need another dsl.

I have two generation for repoDSL, they work.
but for the generation of metarepDSL I have sometimes (not everytime) this message :
1 error:
	b.repoDSL - /home/jeremie/tocea/EclipseProjects/com.tocea.xtext.repository.launch/testRule/b.repoDSL
		3: Couldn't resolve reference to Rule 'metarep.r1'.
	at org.eclipse.xtext.mwe.Validator.validate(Validator.java:88) ~[na:na]
	at org.eclipse.xtext.mwe.Reader.invokeInternal(Reader.java:165) ~[na:na]
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126) ~[na:na]
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34) ~[na:na]
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201) ~[na:na]
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:31) ~[na:na]
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19) ~[na:na]
	at com.tocea.xtext.tools.AbstractMWE2WorkflowRunner.runFolder(AbstractMWE2WorkflowRunner.java:147) ~[na:na]
	at com.tocea.dsl.metarepository.launch.GenerateMetarRepositoryHandler$GenerateAdapterJob.run(GenerateMetarRepositoryHandler.java:36) ~[na:na]
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) [org.eclipse.core.jobs_3.5.1.R36x_v20100824.jar:na]


so the generator read files repoDSL.. it should not do that.

mt workflow look like that :
module workflow.MetarepositoryDSLGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "UTF-8"
var modelPath = "src/model"

Workflow {

	bean = StandaloneSetup {
		registerGeneratedEPackage = "com.tocea.emf.metaRepository.model.metaRepository.MetaRepositoryPackage"
		registerGeneratedEPackage = "com.tocea.emf.metaRepository.model.repository.RepositoryPackage"
	}
	component = org.eclipse.xtext.mwe.Reader {
	// lookup all resources on the classpath
	// useJavaClassPath = true

	// or define search scope explicitly
		path = modelPath

		// this class will be generated by the xtext generator 
		register = com.tocea.dsl.MetarepositoryDSLStandaloneSetup {}
		load = {
			slot = "metaRepositories"
			type = "MetaRepository"
		}
	}

	component = org.eclipse.xpand2.Generator {
		expand = "templates::Template::main FOR metaRepositories"
		outlet = {
			path = targetDir
		}
		fileEncoding = fileEncoding
	

thats strange that this error is not launch everytime.


regards,

Jérémie
Re: generation with two dsl [message #653335 is a reply to message #653331] Wed, 09 February 2011 12:48 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
In fact,

If I launch the generation for the repoDSL files before the generation for metarepDSL files, it works.
It failed if I launch the generation of metarepDSL first.

Jérémie
Re: generation with two dsl [message #653336 is a reply to message #653335] Wed, 09 February 2011 12:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

shouldn't you call both standalonesetups in your workflow:

register = com.tocea.dsl.MetarepositoryDSLStandaloneSetup {}
register = com.tocea.dsl.OtherDSLStandaloneSetup {}

~ Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: generation with two dsl [message #653345 is a reply to message #653336] Wed, 09 February 2011 13:29 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
maybe.

but I have repoDSL wich dependsod metarepDSL but I don't want that metarepDSL depends of repoDSL.

I will have later to add other language wich will use metarepDSL. I dont want for each language to add
register = com.tocea.dsl.OtherDSLStandaloneSetup {

in metarepDSL.

I want metarepDSL insdependant

Regards,

Jérémie
Re: generation with two dsl [message #653353 is a reply to message #653345] Wed, 09 February 2011 13:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry i thought it was the other way round, but why does your metarepository dsl generator then try to read .repoDSL files?

one reason might be that workflows are not thread safe but you use them with the jobs framework.

Update:

Another point is that it is a bad idea to call

register = com.tocea.dsl.AnyDSLStandaloneSetup when the workflow is started from within eclipse sice this may kill some ecore / xtext registries.

~Christian



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 09 February 2011 13:57]

Report message to a moderator

Re: generation with two dsl [message #653356 is a reply to message #653353] Wed, 09 February 2011 14:01 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member


I really don't know why the generator try to read .repoDSL files.

"one reason might be that workflows are not thread safe but you use them with the jobs framework"

I don't really understand that but maybe you right.
I fight I don't really use the workflow as descibe before. I translate this workflow in java.
(because i need to work in no standAlone. ).

So maybe I have to add something in my java code.

What can I do to make my code thread safe?

I dont really understand the link between the fact to be thread safe anf my problem that the generator read .repoDSL files
Re: generation with two dsl [message #653358 is a reply to message #653356] Wed, 09 February 2011 14:02 Go to previous messageGo to next message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member

I forgot, these two dsl use the same ecore model file

Regards

Jérémie
Re: generation with two dsl [message #653360 is a reply to message #653358] Wed, 09 February 2011 14:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the reader reads all files it knows. maybe you can try to configure it filtering. and you should remove the register stuff from the workflow.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: generation with two dsl [message #653368 is a reply to message #653360] Wed, 09 February 2011 14:45 Go to previous message
jeremie is currently offline jeremieFriend
Messages: 233
Registered: April 2010
Senior Member
Yess Smile

It seams to work Smile.

I add that in the workflow :

import org.eclipse.xtext.mwe.*

omponent = org.eclipse.xtext.mwe.Reader {
	// lookup all resources on the classpath
	// useJavaClassPath = true

	// or define search scope explicitly
		path = modelPath
		uriFilter = NameBasedFilter {
			extension = "metarepDSL"
		}
}
....



thanks Christian

Previous Topic:[MWE2] Command-line code generation
Next Topic:Template Switch per non-Tab-Klick
Goto Forum:
  


Current Time: Thu Apr 25 20:26:02 GMT 2024

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

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

Back to the top